Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 436072 - "command" can be a command list in builtin "if"
"command" can be a command list in builtin "if"
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: tcsh (Show other bugs)
5.1
i686 Linux
low Severity low
: rc
: ---
Assigned To: Vitezslav Crhonek
Bill Huang
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-05 02:48 EST by Cai Xianchao
Modified: 2008-03-05 19:56 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-03-05 06:16:32 EST
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. (748 bytes, patch)
2008-03-05 02:48 EST, Cai Xianchao
no flags Details | Diff

  None (edit)
Description Cai Xianchao 2008-03-05 02:48:27 EST
Description of problem:

The manpage says that "command must  be  a  simple  command,  not  an alias,  a
 pipeline,  a command list or a parenthesized command list, but it  may  have 
arguments.", but "command" can be a command list.

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

How reproducible:


Steps to Reproduce:
1.[test@localhost ~]$ ls
test

2.[test@localhost ~]$ pwd
/home/test

3.[test@localhost ~]$ if (1) ls;pwd
test
/home/test

  
Actual results:
The command 'ls' and 'pwd' both are executed correctly.

Expected results:
There is a error outputed or only one command is executed.

Additional info:
Comment 1 Cai Xianchao 2008-03-05 02:48:27 EST
Created attachment 296861 [details]
This is a patch fixing the bug.
Comment 2 Vitezslav Crhonek 2008-03-05 06:16:32 EST
Try:

[test@localhost ~]$ if (0) ls;pwd
/home/test

The second command does have nothing to do with the 'if' statement.
Comment 3 Cai Xianchao 2008-03-05 19:56:35 EST
I see.

The tcsh regards 'if (0) ls;pwd' as two commands, 'if (0) ls' and 'pwd'.

Actually, when I saw something like 'command must  be  a  simple  command', I
thought it would fail and the exit code would be not 0 if 'command is not a
simple command'. 

Thanks for your example.

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