Current-Users archive

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

HEADS-UP: /bin/sh: extensive bug fixes about to be committed



I am about to make 4 commits to /bin/sh which fix 4 different sets of bugs:

1) aliases - which have been more broken than anyone would believe, in so
many ways (beyond the serious one fixed just a short while ago) but which I
suspect that no-one really cares about, as (almost) no-one is complaining.
If this one was all there was, I'd just do it, and no-one would care.
However do note that as aliases are implemented in the parser (they have to
be), and affect the sh input routines, there is some potential for problems
(but I doubt that these changes, even though they affect the most basic
aspects of the lower layers of the shell, will cause any issues).

2) More "$@" expansion problems (this one fixes the the (new) failing sh ATF
tests).   This makes some significant parser and parameter expansion changes,
and affects some of the most fragile code in the shell.
	*** Almost anything is possible here. ***
All the sh ATF tests, (including the new ones), and others, pass, but that
is no guarantee everything is good, and some of these changes are in the
post-doc of hackery, so please be on the lookout for any strange behaviour.

3) Fix the "export" command, and in particular "export -x" so that it does
what it was intended to do (and as documented) rather than something a bit
different than that (and not useful.)   (This issue detected by a not yet
committed ATF test program for shell built-ins ... WIP.)

4) Fix (well, improve anyway) trap handling: DTRT with break, continue,
return, executed in a trap handler and affecting (or even not intended
to affect) a loop/function being executed when the trap occurred.
Generate the correct exit codes when the shell exits from a trap.
Also make T=$(trap) work the way it is supposed to (and so remove one
of the BUGS from sh(1)).  This change also prevents scripts/users from
playing about with SIGCHLD, as doing so can affect correct operation of the
shell (scripts can still set a trap, or pretend to ignore, SIGCHLD, it will
simply have no effect).   I intend to make SIGCHLD traps operate the way
they do in bash, where the trap handler is run for each background job
that completes, which actually makes setting a SIGCHLD trap useful, instead
of being both useless and destructive as they are now.  This latter
part is not yet done however (for now, SIGCHLD traps are just ignored).


Other than #3 above, most of the code (or at least ideas and inspiration)
for this come from FreeBSD, and the need to handle much of it was inspired
by testing done by Martijn Dekker using his (yet to be released) "modernish"
(shell implemented in shell - kind of)  (you might have noticed some other,
simpler to fix, bugs already fixed due to his reports as well.)

These are being committed all in a lump, they will happen one after another,
as close together as my update/commit process will allow, as I have been
developing them all in parallel, all in one source tree.   Then I have
separated the changes out into these 4 separate pieces for CVS commit
purposes, so the various changes are better documented.

While I believe I have made each change stand alone (as much as they can be
given that the same source files tend to be affected by more than one of
these) but the intermediate steps have had much less testing than the final
result (though they have all at least been build tested, and successfully
run the sh ATF tests), so if you happen to get a build which doesn't have
all 4 of them, and something fails, please update and try again.

I am not intending any of these changes to be pulled up to -8 (fixes that
were made during this process that can easily be pulled up have been
separated out and committed earlier, that's from where the changes made
in the past week or two have come).

Please send me (or current-users) e-mail, or submit a PR, or both of those
if you find something no longer working that looks like it might be
caused by these shell changes.   If possible, please include enough details
of just what went wrong so that I can duplicate the problem.

kre




Home | Main Index | Thread Index | Old Index