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

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-03-05 11:16:32 UTC
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 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):
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 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
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-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.