bugs.gw.com
Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000110tcshgeneralpublic2010-12-02 11:372011-04-14 18:24
ReporterVojtech Vitek (V-Teq) 
Assigned ToChristos Zoulas 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version6.17.00 
Target VersionFixed in VersionHEAD 
Summary0000110: [PATCH] Incorrect $status value of pipelined commands
DescriptionThe tcsh documentation states that the $status (or $?) variables hold the
return value of the last command. Therefore in case of pipelines it should be
the last command of the pipeline. This doesn't work properly.

There are two examples:

1)
$ cat /notfound | wc -l
cat: /notfound: No such file or directory
0
$ echo $?
1 <------- should be 0 (the last command - wc - was successful)

2)
$ echo `cat /notfound`
cat: /notfound: No such file or directory

$ echo $?
1 <------- should be 0 (echo was successful)


This bug was originally reported in https://bugzilla.redhat.com/show_bug.cgi?id=638955 [^]

I'm attaching a patch by Tomas Smetana <tsmetana AT redhat.com>.
TagsNo tags attached.
Attached Filespatch file icon tcsh-6.14.00-pipeexit.patch [^] (556 bytes) 2010-12-02 11:37 [Show Content]
patch file icon tcsh-6.17.00-pipe-exit-status.patch [^] (1,580 bytes) 2011-04-14 09:34 [Show Content]
patch file icon tcsh-6.17.00-testsuite.patch [^] (1,261 bytes) 2011-04-14 09:38 [Show Content]

- Relationships

-  Notes
(0000157)
Christos Zoulas (manager)
2011-01-17 19:20

revision 3.115
date: 2011/01/17 16:18:26; author: christos; state: Exp; lines: +6 -2
PR/110: exit status should be the status of the last command in a pipeline
so ignore previous statuses from the pipeline stages.
(0000166)
Christos Zoulas (manager)
2011-01-19 02:36

The patch is wrong; it breaks the unit-tests and has been reverted.
(0000172)
Vojtech Vitek (V-Teq) (reporter)
2011-04-14 09:33
edited on: 2011-04-14 09:39

Here are another two patches that should fix
1) the reported issue
2) "The patch is wrong; it breaks the unit-tests and has been reverted."

The first patch
===============
Fixes 'exit { false }' regression of the original patch.

(0000173)
Vojtech Vitek (V-Teq) (reporter)
2011-04-14 09:37

The second patch
================
Fixes the testsuite which is actually wrong.
(0000174)
Christos Zoulas (manager)
2011-04-14 18:24

applied to head, and added $anyerror to reproduce the old behavior.

- Issue History
Date Modified Username Field Change
2010-12-02 11:37 Vojtech Vitek (V-Teq) New Issue
2010-12-02 11:37 Vojtech Vitek (V-Teq) File Added: tcsh-6.14.00-pipeexit.patch
2011-01-17 19:20 Christos Zoulas Status new => resolved
2011-01-17 19:20 Christos Zoulas Fixed in Version => HEAD
2011-01-17 19:20 Christos Zoulas Resolution open => fixed
2011-01-17 19:20 Christos Zoulas Assigned To => Christos Zoulas
2011-01-17 19:20 Christos Zoulas Note Added: 0000157
2011-01-19 02:35 Christos Zoulas Assigned To Christos Zoulas =>
2011-01-19 02:36 Christos Zoulas Note Added: 0000166
2011-01-19 02:36 Christos Zoulas Assigned To => Christos Zoulas
2011-01-19 02:36 Christos Zoulas Status resolved => acknowledged
2011-04-14 09:33 Vojtech Vitek (V-Teq) Note Added: 0000172
2011-04-14 09:34 Vojtech Vitek (V-Teq) File Added: tcsh-6.17.00-pipe-exit-status.patch
2011-04-14 09:37 Vojtech Vitek (V-Teq) Note Added: 0000173
2011-04-14 09:38 Vojtech Vitek (V-Teq) File Added: tcsh-6.17.00-testsuite.patch
2011-04-14 09:39 Vojtech Vitek (V-Teq) Note Edited: 0000172
2011-04-14 18:24 Christos Zoulas Status acknowledged => closed
2011-04-14 18:24 Christos Zoulas Note Added: 0000174


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker