Bug 433914

Summary: ", and must be a single argument" should be deleted.
Product: Red Hat Enterprise Linux 5 Reporter: Cai Xianchao <caixianchao>
Component: tcshAssignee: Vojtech Vitek <vvitek>
Status: CLOSED NOTABUG QA Contact: Bill Huang <bhuang>
Severity: low Docs Contact:
Priority: low    
Version: 5.1CC: hripps, ovasik
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-17 17:03:20 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:
Attachments:
Description Flags
This is a patch fixing the bug. none

Description Cai Xianchao 2008-02-22 03:26:56 UTC
Description of problem:
There is a statement about option "-b" of tcsh:
"-c  Commands  are  read  from  the  following  argument  (which must be
present, and must be a single  argument),".
But, "commands" may not be a single argument, manpage also says that "any
remaining arguments are placed in the argv shell variable."

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

How reproducible:


Steps to Reproduce:
1.[test@RHEL5 ~]$ tcsh -c pwd ls
/home/test

2.[test@RHEL5 ~]$ echo $?
0
  
Actual results:
It only executed the first command and the return value is 0.

Expected results:
The return is not 0.

Additional info:

Comment 1 Cai Xianchao 2008-02-22 03:26:56 UTC
Created attachment 295585 [details]
This is a patch fixing the bug.

Comment 2 Vitezslav Crhonek 2008-03-04 11:21:27 UTC
Hi,

thanks for report.

I think the man page is correct - e.g. assume those two commands:

tcsh -c 'cat file.txt'
tcsh -c cat file.txt

First command will concatenate file.txt, second will run cat and store
'file.txt' to argv[1]. In my opinion this is the reason, why command "must be a
single argument" statement is present in the man page.

In your example, return value is related only to the result of command in -c
argument (pwd), and pwd command is successful - so it returns zero. 'ls' is
stored in argv[1] and is not used at all.

Comment 3 Cai Xianchao 2008-03-05 00:50:30 UTC
There are two reasons that ", and must be a single argument" should be deleted
in my opioion.
First, I think there will be a error message output if manpage says "something
must be".
Second, the manpage also says "Any remaining arguments are placed in the argv
shell variable", so commands after argument '-c' can not be a single argument.
As a result ", and must be a single argument" is redundant.

Comment 4 RHEL Program Management 2011-01-11 19:58:09 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Comment 5 RHEL Program Management 2011-01-12 15:14:10 UTC
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.

Comment 6 Vojtech Vitek 2011-01-17 17:03:20 UTC
Hi,

the man page is correct in my opinion as well.

Consider following two examples:

1)
$ tcsh -c 'echo 1; echo 2;' echo 3
1
2

..as you can see, "echo 3" was not executed as part of the command, it was just stored as _shell_ argv variable (see below).

2)
$ tcsh -c 'echo $1; echo $2' echo 3
echo
3

..now we have printed first and second _shell_ argv variables (as seen in interactive shell).

Closing as NOTABUG.