Email List: Xaustin-review-lX
[All Lists]

RE: Defect in XCU ed

To: <yyyyyyyyyyyyyyy@xxxxxxxxxxxxx>
Subject: RE: Defect in XCU ed
From: "Schwarz, Konrad" <yyyyyyyyyyyyyy@xxxxxxxxxxx>
Date: Tue, 11 Apr 2006 09:37:01 +0200
Thread-index: AcZdJsumTDefiTcQQnyjbkOju59mmwAEuVVw
Thread-topic: Defect in XCU ed
> -----Original Message-----
> From: Andrew Josey [mailto:yyyyyy@xxxxxxxxxxxxxxxxx] 
>       Defect report from : William Toth , IBM Austin
> 
> (Please direct followup comments direct to 
> yyyyyyyyyyyyyy@xxxxxxxxxxxxx)
> 
> @ page XCU 340 line 13107 section ed objection {WLT-XCU-2}
> 
> Problem:
> 
> Edition of Specification (Year): 2004
> 
> Defect code :  1. Error
> 
> The current SUSv3 text for ed has the following wording, 
> which was supposed to have come from PASC 1003.2-92 #36 
> interpretation request.
> 
> If a terminal disconnect is detected:
> 
>  - If the buffer is not empty and has changed since the last write,
>    the ed utility shall attempt to write a copy of the buffer to a 
>    file named ed.hup in the current directory. If this write fails, 
>    ed shall attempt to write a copy of the buffer to a filename 
>    ed.hup in the directory named by the HOME environment variable. 
>    If both these attempts fail, ed shall exit without saving the
>    buffer.
> 
>  - The ed utility shall not write the file to the currently remembered
>    pathname or return to command mode, and shall terminate with a 
>    non-zero exit status.
> 
> 
> If an end-of-file is detected on standard input:
> 
>  - If the ed utility is in input mode, ed shall terminate input mode
>    and return to command mode.  It is unspecified if any partially 
>    entered lines (that is, input text without a terminating 
>    <newline>) are discarded from the input text.
> 
>  - If the ed utility is in command mode, it shall act as if a q
>    command had been entered.
> 
> 
> The text above ( and in POSIX.2b) is quite different from the 
> changes in the editors note in 1003.2-92 interp #36, which said:
> 
> "If an end-of-file is detected on standard input when input 
> from the user is expected and the standard input is a 
> terminal device, if the buffer is not empty and has changed 
> since the last write, the ed utility shall attempt to write a 
> copy of the buffer to a file. First, the file named ed.hup in 
> the current directory shall be used; if that fails, the file 
> named ed.hup in the directory named by the HOME environment 
> variable shall be used.
> 
>  If an end-of-file is detected on standard input when input 
> from the user is expected and standard input is not a 
> terminal device, the ed utility shall not write the file to 
> the currently remembered pathname or return to command mode, 
> and shall terminate with a nonzero exit status."
> 
> 
> The current wording requires ed to determine the difference 
> between a normal end of file and terminal disconnect when 
> stdin sees an end of file and stdin is a terminal. Whereas 
> the original changes suggested seem to be much more 
> reasonable, just requiring differentiation if stdin is a terminal.

My understanding is that terminal disconnect is signalled by a SIGHUP.
If a SIGHUP arrives, the "terminal disconnect" option applies.  If there
is an EOF on standard input, that case applies.  If both arrive/are
detected simultaneously, there is a race condition, which ed must handle
correctly (basically by blocking SIGHUP after detecting an EOF), so that
one of the two cases is selected.

I think the current wording is correct.

> 
> Action:
> 
> Replace current text with the wording in the IR.
> 
> 

<Prev in Thread] Current Thread [Next in Thread>