A NOTE has been added to this issue. ====================================================================== https://austingroupbugs.net/view.php?id=1786 ====================================================================== Reported By: eblake Assigned To: ====================================================================== Project: Issue 8 drafts Issue ID: 1786 Category: Shell and Utilities Type: Clarification Requested Severity: Objection Priority: normal Status: Resolved Name: Eric Blake Organization: Red Hat User Reference: ebb.ed Section: XCU ed Page Number: 2801 Line Number: 92899 Final Accepted Text: Resolution: Reopened Fixed in Version: ====================================================================== Date Submitted: 2023-11-02 15:13 UTC Last Modified: 2023-11-20 17:21 UTC ====================================================================== Summary: ed behavior on non-existing filename ====================================================================== Relationships ID Summary ---------------------------------------------------------------------- related to 0000251 Forbid newline, or even bytes 1 through... ======================================================================
---------------------------------------------------------------------- (0006577) geoffclare (manager) - 2023-11-20 17:21 https://austingroupbugs.net/view.php?id=1786#c6577 ---------------------------------------------------------------------- On page 2797 line 92714 section ed ASYNCHRONOUS EVENTS, change:<blockquote>If the buffer is not empty and has changed since the last write, the</blockquote>to:<blockquote>If the buffer is not empty and the buffer change flag is currently set to either <b>changed</b> or <b>changed-and-warned</b> (see the EXTENDED DESCRIPTION section), the</blockquote> On page 2797 line 92725 section ed STDERR, change:<blockquote>The standard error shall be used only for diagnostic messages.</blockquote>to:<blockquote>The standard error shall be used for diagnostic messages and may be used for warning messages.</blockquote> On page 2797 line 92730 section ed EXTENDED DESCRIPTION, after:<blockquote>The <i>ed</i> utility shall operate on a copy of the file it is editing; changes made to the copy shall have no effect on the file until a <b>w</b> (write) command is given. The copy of the text is called the <i>buffer</i>.</blockquote>add these sentences:<blockquote>The <i>ed</i> utility shall keep track of whether the buffer has been modified. This shall be maintained as if via a tri-state internal flag with the state values <b>unchanged</b>, <b>changed</b>, and <b>changed-and-warned</b>, which is:<ul> <li>Initially set to <b>unchanged</b></li> <li>Set to <b>changed</b> by any command that modifies the buffer</li> <li>Set to <b>unchanged</b> by an <b>e</b> or <b>E</b> command that reloads (or empties) the buffer, or a <b>w</b> command that writes the entire buffer</li> <li>Set to either <b>changed-and-warned</b> or <b>unchanged</b> by an <b>e</b> or <b>q</b> command that warns an attempt was made to destroy the editor buffer</li></ul> A command that makes changes to the buffer in such a way that its contents are the same after the command (for example <b>s/a/a/</b>) shall be considered to have modified the buffer, unless explicitly stated otherwise. In the remainder of the description, this flag is referred to as the <i>buffer change flag</i>.</blockquote> On page 2800 line 92839 section ed EXTENDED DESCRIPTION, change:<blockquote>If changes have been made in the buffer since the last w command that wrote the entire buffer</blockquote>to:<blockquote>If the buffer change flag is currently set to <b>changed</b></blockquote> On page 2800 line 92844, change:<blockquote>... and shall continue in command mode with the current line number unchanged. If the <b>e</b> or <b>q</b> command is repeated with no intervening command, it shall take effect.</blockquote>to:<blockquote>... and shall continue in command mode with the buffer change flag set to either <b>changed-and-warned</b> or <b>unchanged</b> and the current line number unchanged. If another <b>e</b> or <b>q</b> command is then attempted with no intervening command that sets the buffer change flag to <b>changed</b>, it shall take effect.</blockquote> On page 2801 line 92881, in the Append Command text, add a sentence:<blockquote>If <text> is empty (that is, the terminating '.' immediately follows the 'a'), the buffer change flag shall not be altered.</blockquote> On page 2801 line 92901, in the Edit Command text, after the sentence:<blockquote>If no pathname is given, the currently remembered pathname, if any, shall be used (see the f command).</blockquote>insert another sentence:<blockquote>If the pathname names a file that does not exist and the buffer change flag is currently set to <b>unchanged</b>, it is unspecified whether this is treated as an error, or whether the resulting buffer is emptied and a warning is written to standard error instead of writing the byte count to standard out.</blockquote> On page 2801 line 92909, in the Edit Command text, change:<blockquote>If the buffer has changed since the last time the entire buffer was written</blockquote>to:<blockquote>If the buffer change flag is currently set to <b>changed</b></blockquote> On page 2802 line 92914, in the Edit Without Checking Command text, change:<blockquote>shall not check to see whether any changes have been made to the buffer since the last <b>w</b> command.</blockquote>to:<blockquote>shall not check the current state of the buffer change flag.</blockquote> On page 2802 line 92918, in the Filename Command text, change:<blockquote>If <i>file</i> is given, the <b>f</b> command shall change the currently remembered pathname to <i>file</i>;</blockquote>to:<blockquote>If <i>file</i> is given, the <b>f</b> command shall change the currently remembered pathname to <i>file</i>, whether or not <i>file</i> names an existing file;</blockquote> On page 2803 line 92977, in the Insert Command text, add a sentence:<blockquote>If <text> is empty (that is, the terminating '.' immediately follows the 'i'), the buffer change flag shall not be altered.</blockquote> On page 2805 Read Command, add a new paragraph at the end (after line 93044):<blockquote>If the number of bytes read is 0 it is unspecified whether the buffer change flag is set to <b>changed</b> or left unaltered.</blockquote> On page 2805 line 93027, in the Quit Command text, change:<blockquote>If the buffer has changed since the last time the entire buffer was written</blockquote>to:<blockquote>If the buffer change flag is currently set to <b>changed</b></blockquote> On page 2805 line 93031, in the Quit Without Checking Command text, change:<blockquote>without checking whether changes have been made in the buffer since the last <i>w</i> command</blockquote>to:<blockquote>without checking the current state of the buffer change flag</blockquote> On page 2807 line 93120, in the Write Command text, change:<blockquote>This usage of the write command with '!' shall not be considered as a ``last <b>w</b> command that wrote the entire buffer'', as described previously; thus, this alone ...</blockquote>to:<blockquote>This usage of the <b>w</b> command with '!' shall not alter the buffer change flag; thus, this alone ...</blockquote> After page 2811 line 93292 section ed RATIONALE, add a paragraph:<blockquote>Implementations are encouraged to set the buffer change flag to <b>changed-and-warned</b> when an <b>e</b> or <b>q</b> command warns that an attempt was made to destroy the editor buffer. Some existing implementations set it to <b>unchanged</b>, but this has the undesirable side-effect that a SIGHUP received after the warning is given does not write the buffer to <b>ed.hup</b>.</blockquote> On page 2811 line 93294, change FUTURE DIRECTIONS from "None" to:<blockquote>A future version of this standard may require that the buffer change flag is set to <b>changed-and-warned</b> when an <b>e</b> or <b>q</b> command warns that an attempt was made to destroy the editor buffer.</blockquote> Issue History Date Modified Username Field Change ====================================================================== 2023-11-02 15:13 eblake New Issue 2023-11-02 15:13 eblake Name => Eric Blake 2023-11-02 15:13 eblake Organization => Red Hat 2023-11-02 15:13 eblake User Reference => ebb.ed 2023-11-02 15:13 eblake Section => XCU ed 2023-11-02 15:13 eblake Page Number => 2801 2023-11-02 15:13 eblake Line Number => 92899 2023-11-02 15:16 eblake Relationship added related to 0000251 2023-11-02 15:18 eblake Description Updated 2023-11-02 15:18 eblake Desired Action Updated 2023-11-13 17:31 geoffclare Note Added: 0006567 2023-11-13 17:32 geoffclare Final Accepted Text => https://austingroupbugs.net/view.php?id=1786#c6567 2023-11-13 17:32 geoffclare Status New => Resolved 2023-11-13 17:32 geoffclare Resolution Open => Accepted As Marked 2023-11-13 17:32 geoffclare Tag Attached: issue8 2023-11-14 16:00 Antonio Diaz Note Added: 0006570 2023-11-16 16:37 eblake Final Accepted Text https://austingroupbugs.net/view.php?id=1786#c6567 => 2023-11-16 16:37 eblake Resolution Accepted As Marked => Reopened 2023-11-16 16:40 eblake Note Added: 0006571 2023-11-16 16:44 eblake Note Edited: 0006571 2023-11-16 16:55 eblake Note Edited: 0006571 2023-11-16 17:55 Antonio Diaz Note Added: 0006572 2023-11-20 09:33 geoffclare Note Added: 0006574 2023-11-20 17:21 geoffclare Note Added: 0006577 ======================================================================