#900564 UID and EUID are not reliably set

Package:
bash
Source:
bash
Description:
GNU Bourne Again SHell
Submitter:
Richard Kettlewell
Date:
2024-04-05 10:21:04 UTC
Severity:
normal
#900564#5
Date:
2018-06-01 10:54:46 UTC
From:
To:
According to the man page:

       UID    Expands to the user ID of the current user, initialized at
shell
              startup.  This variable is readonly.

However, if the variable is set in the environment then it will inherit
it from there rather than initializing it during startup. The same is
true of EUID and perhaps others.

$ bash -c 'echo $UID'
1000
$ env UID=spong bash -c 'echo $UID'
spong

The example is contrived but the issue has a real impact, for example:
http://aptosid.com/index.php?name=PNphpBB2&file=viewtopic&t=2985

ttfn/rjk