NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/52458 (\n in prompt breaks history mechanism in /bin/sh)



Thanks for the thorough explanation of the bug.

On Sat,  5 Aug 2017 10:44:46 +0000 (UTC) kre%NetBSD.org@localhost wrote:
> This can be fixed in either of two ways (I tested both, separately).
> 
> First, rather than testing "if PS1, new entry, else, append" change
> it to, "If not PS2, new entry, else, append" (or if you like, "If
> PS2, append, else new entry" which is the same thing with more code
> churn.)

Note that this, on its own, would break if I put a '\n' in PS2.  That's
unlikely to be a problem in practice (I routinely use a newline in PS1,
but I've never heard of anyone putting one in PS2 and it seems like a
silly idea).

> Alternatively, when the prompt is being expanded, save, and then
> restore, the "which prompt" variable, so after the expansion is
> done, the state is unchanged.

That sounds like a more general fix.

Thanks,

--
IDL


Home | Main Index | Thread Index | Old Index