Bug 10894 - can't set GROUPS until after it's echoed
can't set GROUPS until after it's echoed
Product: Red Hat Linux
Classification: Retired
Component: bash (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
Depends On:
  Show dependency treegraph
Reported: 2000-04-18 12:45 EDT by Jonathan Kamens
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-08-03 08:39:41 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jonathan Kamens 2000-04-18 12:45:25 EDT
> bash -c 'GROUPS=foo; echo $GROUPS'
> bash -c 'echo $GROUPS; GROUPS=foo; echo $GROUPS'
Comment 1 Bernhard Rosenkraenzer 2000-08-03 07:31:22 EDT
Why do you want to set a read-only variable?
Comment 2 Jonathan Kamens 2000-08-03 08:39:41 EDT
1) It wasn't me, it was a shell script I inherited.  I patched around the
problem by changing the variable name, but still, a shell script shouldn't break
in indetermine ways simply because it has the bad luck of choosing a variable
name that bash reserves (speaking of which, where does bash get off reserving
variable names without putting underscores in front of their names or something
to protect the namespace?  but I digress).

2) The bash man page (at least in bash-2.04-4) does not document that GROUPS is
a read-only variable.

3) Well, OK, it *sort of* documents this, since it says that assignments to the
variable are silently discarded (that's really broken; if bash is going to
reserve a variable and not allow its value to be changed, and a shell script
tries to change the variable, bash should immediately crap out, or at least
print an error message, so you have some idea of what's going wrong).  But in
that case, the bug is that I *was* able to change the value of the variable
after echoing it.  That's clearly broken.
Comment 3 Bernhard Rosenkraenzer 2000-11-03 04:51:27 EST
Please discuss this with bug-bash@gnu.org - we can't just change bash's behavior for compatibility reasons with other distributions/OSes using bash.

Note You need to log in before you can comment on or make changes to this bug.