Hi Chet

Let's go back to the initiating question: assume for a moment that you've
been convinced and decide to add some variation of my patch; should the
default mode be "auto" (*2) or "none" or something else?

Keep in mind it's a per-user setting from /etc/inputrc and ~/.inputrc, so
consistent behaviour can be chosen across every program that uses readline
when «stty -echo» is in effect. It happens to affect «read» in Bash, but
that's far from the only potentially useful case.

My gut feeling is that the hard-coded default should be “none”, and it's
then up to distros whether they ship /etc/inputrc or /etc/skel/.inputrc
that says “auto” or something else.

On Tue, 23 Dec 2025 at 03:06, Chet Ramey <[email protected]> wrote:

> On 12/15/25 10:39 PM, Martin D Kealey wrote:
> > I imagine it's fairly rare to have “read -e -s” in existing code


Does anyone disagree?

A search of StackExchange does show a few instances of «read -e -s» (or
equivalent) but in those scripts *every* «read» is explicitly «read -e», so
it's clear that the authors were treating «read -e» as boilerplate, and
then occasionally adding «-s»; they're not combining those two options
because they expect something different from just «read -s». (*1) They're
also novices, so *everything* is surprising, whether we change something or
not.

> since “-e” is *currently* pointless when “-s” is in effect


(Note that I wrote “*is … pointless*” rather than “*has no effect*”; I'm
well aware that «-e» technically still affects how some control characters
are interpreted. By using “*pointless*” I'm expressing an opinion, a value
judgement, rather than a precise assessment, and while I believe that my
judgement in this case is on a reasonably solid foundation, I'm open to new
information that might sway my opinion.)

So by ‘pointless’ you must mean […]


By "*pointless*" I mean something along the lines of “*seeming to have
negligible practical utility*", especially in the mind of script authors
when they are deciding whether to add the «-e» option to their «read -s»
commands.

Even if users are confident enough to use readline editing blindfolded,
they likely do not expect readline to be enabled when echoing is turned
off, since it almost always isn't, and *trying* just adds junk to their
input.

In that sense, it is pointless for almost all script authors to enable
readline with no-echo, because it will have no effect on *their* users. (*3)

-Martin

(*1: Just to be clear, there is a useful difference between «read -s -N1»
and «read -e -s -N1», but my patch gets out of the way when «-N» (or «-n»)
is used, so that difference is irrelevant to this discussion.)

(*2: I previously defined "auto" as using either «*» or «•» (aka «U+2022»)
depending on whether the locale is based on UTF-8.)

(*3: I acknowledge that vision-impaired users may routinely type editing
keystrokes without regard for whether echoing is enabled. However they're
unlikely to be surprised by the effects of echo-substitution.)

Reply via email to