Bug 10894

Summary: can't set GROUPS until after it's echoed
Product: [Retired] Red Hat Linux Reporter: Jonathan Kamens <h1k6zn2m>
Component: bashAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-08-03 12:39:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jonathan Kamens 2000-04-18 16:45:25 UTC
> bash -c 'GROUPS=foo; echo $GROUPS'
3009
> bash -c 'echo $GROUPS; GROUPS=foo; echo $GROUPS'
3009
foo

Comment 1 Bernhard Rosenkraenzer 2000-08-03 11:31:22 UTC
Why do you want to set a read-only variable?

Comment 2 Jonathan Kamens 2000-08-03 12:39:41 UTC
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 09:51:27 UTC
Please discuss this with bug-bash - we can't just change bash's behavior for compatibility reasons with other distributions/OSes using bash.