Bug 438109

Summary: strings which begin with '0' are not recognized as octal numbers
Product: Red Hat Enterprise Linux 5 Reporter: Andrew Ryan <aryan>
Component: tcshAssignee: Vitezslav Crhonek <vcrhonek>
Status: CLOSED ERRATA QA Contact: Bill Huang <bhuang>
Severity: low Docs Contact:
Priority: low    
Version: 5.1CC: azelinka, tao
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 616052 878531 (view as bug list) Environment:
Last Closed: 2009-01-20 20:33:25 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:
Bug Depends On:    
Bug Blocks: 391501, 409971, 878531    
Attachments:
Description Flags
patch backported from tcsh 6.15.01 none

Description David Robinson 2008-03-19 05:27:08 UTC
Description of problem:
The man page for tcsh says that strings which begin with '0' are considered
octal numbers, but they aren't actually treated as such by tcsh.

From tcsh(1):
"Strings which begin with ‘0’ are considered octal numbers. Null or missing
arguments are considered ‘0’. The results of all expressions are strings, which
represent decimal numbers. It is important to note that no two components of an
expression can appear in the same word; except when adjacent to components of
expressions which are syntactically significant to the parser (‘&’ ‘|’ ‘<’ ‘>’
‘(’ ‘)’) they should be surrounded by spaces."

Version-Release number of selected component (if applicable):
tcsh-6.14-12.el5
Red Hat Enterprise Linux Server release 5.1 (Tikanga)

How reproducible:
100%

Steps to Reproduce:
1.
$ cat > test.sh << EOF
#! /bin/tcsh
# test 1
@ i = -020
echo $i
# test 2
if (010 * 2 == 16) then
    echo "16"
endif
# test 3
( exit 010 )
echo $?
EOF

2.
$ ./test.sh 

Actual results:
$ ./test.sh 
-20
10

Expected results:
$ ./test.sh 
-16
16
8

Additional info:
Upstream bug: http://bugs.gw.com/view.php?id=54
Backported patch for RHEL 5 is attached.

Comment 1 David Robinson 2008-03-19 05:27:09 UTC
Created attachment 298477 [details]
patch backported from tcsh 6.15.01

Comment 2 RHEL Program Management 2008-06-02 20:13:08 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 8 errata-xmlrpc 2009-01-20 20:33:25 UTC
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-2009-0060.html