Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: worley@alum.mit.edu (Dale R. Worley) Newsgroups: gnu.bash.bug Subject: Re: EOF not disabled in readline Date: Sun, 26 Jul 2020 02:27:29 -0400 Lines: 39 Approved: bug-bash@gnu.org Message-ID: References: (grishalevit@gmail.com) <877duq23la.fsf@hobgoblin.ariadne.com> NNTP-Posting-Host: lists.gnu.org X-Trace: usenet.stanford.edu 1595730468 23468 209.51.188.17 (26 Jul 2020 02:27:48 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Grisha Levit Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcastmailservice.net; s=20180828_2048; t=1595730459; bh=vBwByGlMka7pSCDTOoQRDUegjvGtkNPNpyRgEtW5JPk=; h=Received:Received:Received:Received:From:To:Subject:Date: Message-ID; b=onXLrkSDmlTeKT6MU4NuQpFa9lBrPSK11QioJv+Zy1zh7OciDmabIxonMi0ht4zg3 W+A3KvhwXNreT8Gjckm7M5QfZEtNPWWiyAO4x08bmYvX+bKC3MHimAUVEkkpvbXT4F +fFLBh2Y0YRXtGe1Ux2nUkvDR33GDQRQgsuY8085g9NpiekFDQ3TIXRFINifN9q6hn 17Qrx1ZoLpE8duG2eD1Mm4gvsTUZKCwRig/G4IkyYl3jyRSQ3h6XHiI55Hahmf0zNi W3pdJBYBtmwqve2b64MfOFehK1G4eOP4+yibXAqqGnebbbVvk5mJHJ0dP50zjJ93Az nQi1Xh6gbli0A== X-Xfinity-VMeta: sc=-100.00;st=legit X-Authentication-Warning: hobgoblin.ariadne.com: worley set sender to worley@alum.mit.edu using -f In-Reply-To: (grishalevit@gmail.com) Received-SPF: softfail client-ip=2001:558:fe21:29:69:252:207:41; envelope-from=worley@alum.mit.edu; helo=resqmta-ch2-09v.sys.comcast.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/25 22:27:39 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <877duq23la.fsf@hobgoblin.ariadne.com> Xref: csiph.com gnu.bash.bug:16618 Grisha Levit writes: > It seems that disabling the EOF character does not have an effect on > readline. For example: > > $ stty sane > $ stty eof undef > $ ^D > Use "logout" to leave the shell. > $ read -e; echo $? > ^D > 1 That's messy! When you execute "read -e", you get "If the standard input is coming from a terminal, readline (see READLINE above) is used to obtain the line." In readline, "Line editing is also used when using the -e option to the read builtin. By default, the line editing commands are similar to those of Emacs." But of course, in Emacs, C-d is "delete forward character", and that is duplicated in readline: delete-char (C-d) Delete the character at point. If point is at the beginning of the line, there are no characters in the line, and the last character typed was not bound to delete-char, then return EOF. So when you type C-d, it goes into bash as a character, readline reads it, and returns EOF to its caller, "read". And for "read", "The return code is zero, unless end-of-file is encountered ...". You can verify that analysis by running your example, but instead of typing a single C-d, type X C-b C-d, and see that that C-d deletes the X, rather than causing readline to return EOF. Dale