Source-Changes archive

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

CVS commit: [netbsd-8] src/bin/sh



Module Name:    src
Committed By:   snj
Date:           Mon Jun  5 08:10:24 UTC 2017

Modified Files:
        src/bin/sh [netbsd-8]: cd.c eval.c exec.c exec.h mail.c sh.1

Log Message:
Pull up following revision(s) (requested by kre in ticket #5):
        bin/sh/cd.c: revision 1.48
        bin/sh/eval.c: revision 1.141
        bin/sh/exec.c: revision 1.48
        bin/sh/exec.h: revision 1.25
        bin/sh/mail.c: revisions 1.17, 1.18
        bin/sh/sh.1: revision 1.147
Make cd (really) do cd -P, and not just claim that is what it is doing
while doing a half-hearted, broken, partial, version of cd -L instead.
The latter (as the manual says) is not supported, what's more, it is an
abomination, and should never be supported (anywhere.)
Fix the doc so that the pretense that we notice when a path given crosses
a symlink (and turns on printing of the destination directory) is claimed
no more (that used to be true until late Dec 2016, but was changed).  Now
the print happens if -o cdprint is set, or if an entry from CDPATH that is
not "" or "." is used (or if the "cd dest repl" cd cmd variant is used.)
Fix CDPATH processing: avoid the magic '%' processing that is used for
PATH and MAILPATH from corrupting CDPATH.  The % magic (both variants)
remains undocumented.
Also, don't double the '/' if an entry in PATH or CDPATH ends in '/'
(as in CDPATH=":/usr/src/").  A "cd usr.bin" used to do
chdir("/usr/src//usr.bin").  No more.  This is almost invisible,
and relatively harmless, either way....
Also fix a bug where if a plausible destination directory in CDPATH
was located, but the chdir() failed (eg: permission denied) and then
a later "." or "" CDPATH entry succeeded, "print" mode was turned on.
That is:
        cd /tmp; mkdir bin
        mkdir -p P/bin; chmod 0 P/bin
        CDPATH=/tmp/P:
        cd bin
would cd to /tmp/bin (correctly) but print it (incorrectly).
Also when in "cd dest replace" mode, if the result of the replacement
generates '-' as the path named, as in:
        cd $PWD -
then simply change to '-' (or attempt to, with CDPATH search), rather
than having this being equivalent to "cd -")
Because of these changes, the pwd command (and $PWD) essentially
always acts as pwd -P, even when called as pwd -L (which is still
the default.)   That is, even more than it did before.
Also fixed a (kind of minor) mem management error (CDPATH related)
"whosoever shall padvance must stunalloc before repeating" (and the
same for MAILPATH).
--
If we are going to keep the MAILPATH % hack, then at least do something
rational.  Since it isn't documented, what "rational" is is up for
discussion, but what it did before was not it (it was nonsense...).


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.47.6.1 src/bin/sh/cd.c
cvs rdiff -u -r1.140 -r1.140.2.1 src/bin/sh/eval.c
cvs rdiff -u -r1.47 -r1.47.2.1 src/bin/sh/exec.c
cvs rdiff -u -r1.24 -r1.24.8.1 src/bin/sh/exec.h
cvs rdiff -u -r1.16 -r1.16.90.1 src/bin/sh/mail.c
cvs rdiff -u -r1.146 -r1.146.2.1 src/bin/sh/sh.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index