Bug 436072 - "command" can be a command list in builtin "if"
Summary: "command" can be a command list in builtin "if"
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: tcsh
Version: 5.1
Hardware: i686
OS: Linux
Target Milestone: rc
: ---
Assignee: Vitezslav Crhonek
QA Contact: Bill Huang
Depends On:
TreeView+ depends on / blocked
Reported: 2008-03-05 07:48 UTC by Cai Xianchao
Modified: 2008-03-06 00:56 UTC (History)
0 users

Clone Of:
Last Closed: 2008-03-05 11:16:32 UTC

Attachments (Terms of Use)
This is a patch fixing the bug. (748 bytes, patch)
2008-03-05 07:48 UTC, Cai Xianchao
no flags Details | Diff

Description Cai Xianchao 2008-03-05 07:48:27 UTC
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):

How reproducible:

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

2.[test@localhost ~]$ pwd

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

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 07:48:27 UTC
Created attachment 296861 [details]
This is a patch fixing the bug.

Comment 2 Vitezslav Crhonek 2008-03-05 11:16:32 UTC

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

The second command does have nothing to do with the 'if' statement.

Comment 3 Cai Xianchao 2008-03-06 00:56:35 UTC
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.