Bug 436901 - It should not be allowed if environment variable begins with a digit
It should not be allowed if environment variable begins with a digit
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: tcsh617 (Show other bugs)
5.1
i386 Linux
low Severity low
: rc
: ---
Assigned To: Vojtech Vitek
BaseOS QE - Apps
:
Depends On:
Blocks: 672592
  Show dependency treegraph
 
Reported: 2008-03-10 21:36 EDT by Cai Xianchao
Modified: 2015-03-04 18:56 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Previously, the tcsh shell allowed to name variables in incorrect formats, such as by beginning a variable name with a digit. This issue has been fixed: variable names are now verified according to Unix variable-naming conventions.
Story Points: ---
Clone Of:
: 672592 (view as bug list)
Environment:
Last Closed: 2011-07-21 04:49:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
This is a patch fixing the bug. (268 bytes, patch)
2008-03-10 21:36 EDT, Cai Xianchao
no flags Details | Diff
Patch for environment variable names (499 bytes, patch)
2011-01-14 07:36 EST, Vojtech Vitek
no flags Details | Diff
Patch to fix variable name conventions (set, setenv, foreach) (2.08 KB, patch)
2011-01-17 09:46 EST, Vojtech Vitek
no flags Details | Diff

  None (edit)
Description Cai Xianchao 2008-03-10 21:36:53 EDT
Description of problem:

If an env variable begins with a digit, the part of digits will be parsed as
$argv[num]. It is not allowed in both bash and ksh too.

Version-Release number of selected component (if applicable):
tcsh-6.15.00

How reproducible:


Steps to Reproduce:
1.[test@localhost ~]$ setenv 1t a
2.[test@localhost ~]$ echo $1t
t
  
Actual results:
't'.

Expected results:
'a'.


Additional info:
Comment 1 Cai Xianchao 2008-03-10 21:36:53 EDT
Created attachment 297554 [details]
This is a patch fixing the bug.
Comment 2 Vojtech Vitek 2010-11-30 09:39:31 EST
True, both bash and ksh don't allow you to set variable starting with number.
$ export 1t=a
bash/ksh: export: `1t=a': not a valid identifier

Have you tried to send this patch to upstream?
(The issue is still valid in tcsh 6.17.00.)
Comment 3 RHEL Product and Program Management 2011-01-11 14:58:01 EST
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.
Comment 4 RHEL Product and Program Management 2011-01-12 10:14:26 EST
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.
Comment 5 Vojtech Vitek 2011-01-14 07:36:15 EST
Created attachment 473516 [details]
Patch for environment variable names

I have improved your patch a little, according to UNIX variables name conventions: "All variables must begin with a letter (or an underscore), followed by zero or more alpha-numeric chars or underscores."

I will fix few more bugs in naming convention (foreach, do-while and other builtins) as well. Then I will propose it to upstream as one patch.
Comment 6 Vojtech Vitek 2011-01-17 09:46:15 EST
Created attachment 473854 [details]
Patch to fix variable name conventions (set, setenv, foreach)

Proposed to upstream: http://bugs.gw.com/view.php?id=113
Comment 7 Vojtech Vitek 2011-01-18 05:42:14 EST
The patch has been accepted by upstream (6.17.03b).
Comment 13 Miroslav Svoboda 2011-07-01 17:42:47 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Previously, the tcsh shell allowed to name variables in incorrect formats, such as by beginning a variable name with a digit. This issue has been fixed: variable names are now verified according to Unix variable-naming conventions.
Comment 14 errata-xmlrpc 2011-07-21 04:49:21 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-1072.html
Comment 15 errata-xmlrpc 2011-07-21 08:08:58 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-1072.html

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