NetBSD-Bugs archive

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

PR/56464 CVS commit: [netbsd-9] src/bin/sh



The following reply was made to PR bin/56464; it has been noted by GNATS.

From: "Martin Husemann" <martin%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc: 
Subject: PR/56464 CVS commit: [netbsd-9] src/bin/sh
Date: Sat, 6 Nov 2021 13:35:43 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Nov  6 13:35:43 UTC 2021
 
 Modified Files:
 	src/bin/sh [netbsd-9]: main.c memalloc.c memalloc.h options.c sh.1
 	    shell.h
 
 Log Message:
 Pull up following revision(s) (requested by kre in ticket #1371):
 
 	bin/sh/main.c: revision 1.87
 	bin/sh/main.c: revision 1.88
 	bin/sh/memalloc.h: revision 1.20
 	bin/sh/sh.1: revision 1.235
 	bin/sh/memalloc.c: revision 1.34
 	bin/sh/memalloc.c: revision 1.35
 	bin/sh/memalloc.h: revision 1.19
 	bin/sh/shell.h: revision 1.31
 	bin/sh/options.c: revision 1.56
 
 PR bin/56464
 
 After almost 30 years, finally do the right thing and read $HOME/.profile
 rather than .profile in the initial directory (it was that way in version
 1.1 ...)   All other ash descendants seem to have fixed this long ago.
 While here, copy a feature from FreeBSD which allows "set +p" (if a
 shell run by a setuid process with the -p flag is privileged) to reset
 the privileges.  Once done (the set +p) it cannot be undone (a later
 set -p sets the 'p' flag, but that's all it does) - that just becomes a
 one bit storage location.
 
 We do this, as (also copying from FreeBSD, and because it is the right
 thing to do) we don't run .profile in a privileged shell - FreeBSD run
 /etc/suid_profile in that case (not a good name, it also applies to setgid
 shells) but I see no real need for that, we run /etc/profile in any case,
 anything that would go in /etc/suid_profile can just go in /etc/profile
 instead (with suitable guards so the commands only run in priv'd shells).
 
 One or two minor DEBUG mode changes (notably having priv'd shells identify
 themselves in the DEBUG trace) and sh.1 changes with doc of the "set +p"
 change, the effect that has on $PSc and a few other wording tweaks.
 
 XXX pullup -9   (not -8, this isn't worth it for the short lifetime
 that has left - if it took 28+ years for anyone to notice this, it
 cannot be having all that much effect).
 
 Use a type-correct end marker for strstrcat() rather than NULL, as
 for a function with unknown number & types of args, the compiler isn't
 able to automatically convert to the correct type.   Issue pointed out
 in off list e-mail by Rolland Illig ... Thanks.
 
 The first arg (pointer to where to put length of result) is of a known
 type, so doesn't have the same issue - we can keep using NULL for that
 one when the length isn't needed.
 Also, make sure to return a correctly null terminated null string in
 the (absurd) case that there are no non-null args to strstrcat() (though
 there are much better ways to generate "" on the stack).  Since there is
 currently just one call in the code, and it has real string args, this
 isn't an issue for now, but who knows, some day.
 
 NFCI - if there is any real change, then it is a change that is required.
 
 XXX pullup -9 (together with the previous changes)
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.82.2.1 -r1.82.2.2 src/bin/sh/main.c
 cvs rdiff -u -r1.33 -r1.33.2.1 src/bin/sh/memalloc.c
 cvs rdiff -u -r1.18 -r1.18.2.1 src/bin/sh/memalloc.h
 cvs rdiff -u -r1.53 -r1.53.2.1 src/bin/sh/options.c
 cvs rdiff -u -r1.223 -r1.223.2.1 src/bin/sh/sh.1
 cvs rdiff -u -r1.29 -r1.29.2.1 src/bin/sh/shell.h
 
 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