bug-bash
[Top][All Lists]
Advanced

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

read-only UID/EUID vars when invoked as sh


From: peter
Subject: read-only UID/EUID vars when invoked as sh
Date: 24 Sep 2000 21:47:47 -0000

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: FreeBSD
Compiler: cc 
Compilation CFLAGS:  -DHAVE_SETLINEBUF -DHAVE_VFPRINTF -DHAVE_UNISTD_H 
-DHAVE_STDLIB_H -DHAVE_LIMITS_H        -DHAVE_GETGROUPS -DHAVE_RESOURCE 
-DHAVE_SYS_PARAM -DVOID_SIGHANDLER -D__BSD_4_4__ -DRLIMTYPE=quad_t 
-DHAVE_WAIT_H        -DHAVE_GETWD -DHAVE_DUP2 -DHAVE_STRERROR -DHAVE_DIRENT 
-DHAVE_DIRENT_H -DHAVE_STRING_H        -DHAVE_VARARGS_H -DHAVE_STRCHR 
-DHAVE_STRCASECMP -DHAVE_DEV_FD        -Di386 -DFreeBSD -DSHELL -DHAVE_ALLOCA   
       -O -pipe
uname output: FreeBSD massive.dataloss.net 4.1-STABLE FreeBSD 4.1-STABLE #0: 
Sun Sep 17 21:38:28 CEST 2000     
root@massive.dataloss.net:/usr/obj/usr/src/sys/MASSIVE  i386

Bash Version: 1.14
Patch Level: 7

Description:
        Even when invoked as sh, bash creates the read-only variables
        UID and EUID. This breaks shellscripts that expect to be invoked
        with these variables set to meaningful values (like: the UID
        to switch to before starting a certain daemon).

Repeat-By:
        On a redhat-6.2 box where /bin/sh is a symlink to bash:

bash$ env - UID=blah /bin/sh -c 'echo $UID; UID=blah'
11109
/bin/sh: UID: read-only variable

        On a FreeBSD box where /bin/sh is the FreeBSD /bin/sh:

bash$ env - UID=blah /bin/sh -c 'echo $UID; UID=blah'
blah

        
Fix:
        Don't overwrite existing UID/EUID vars (and sure as *hell* don't
        make m readonly *anytime*) when invoked as sh.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]