Bug 438109 - strings which begin with '0' are not recognized as octal numbers
strings which begin with '0' are not recognized as octal numbers
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: tcsh (Show other bugs)
5.1
All Linux
low Severity low
: rc
: ---
Assigned To: Vitezslav Crhonek
Bill Huang
: Patch
Depends On:
Blocks: 391501 409971 878531
  Show dependency treegraph
 
Reported: 2008-03-19 01:27 EDT by Andrew Ryan
Modified: 2012-11-23 04:32 EST (History)
2 users (show)

See Also:
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 15:33:25 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
patch backported from tcsh 6.15.01 (700 bytes, patch)
2008-03-19 01:27 EDT, David Robinson
no flags Details | Diff

  None (edit)
Description David Robinson 2008-03-19 01:27:08 EDT
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 01:27:09 EDT
Created attachment 298477 [details]
patch backported from tcsh 6.15.01
Comment 2 RHEL Product and Program Management 2008-06-02 16:13:08 EDT
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 15:33:25 EST
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

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