Bug 199174 - top returns with exit code 1 even if no error occurs
Summary: top returns with exit code 1 even if no error occurs
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: procps
Version: 5
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Brian Brock
URL: http://bugs.donarmstrong.com/cgi-bin/...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-07-17 18:30 UTC by Alexander Dupuy
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-09-27 14:51:00 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
patch to fix top exit code returns (282 bytes, patch)
2006-07-17 18:30 UTC, Alexander Dupuy
no flags Details | Diff

Description Alexander Dupuy 2006-07-17 18:30:28 UTC
Description of problem:

top returns with exit code 1 even if there were no problems; it should return
exit code 0.

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

procps-3.2.6-3.5 (goes back to FC4 releases as well, FC3 is fine)

How reproducible:

Extremely

Steps to Reproduce:
1.top -b -n 1 > /dev/null; echo $?
  
Actual results:

1

Expected results:

0

Additional info:
Provided URL of Debian bug report, including following patch:

--- top.c.orig	2006-03-30 18:11:43.000000000 +0200
+++ top.c	2006-03-30 18:13:18.000000000 +0200
@@ -408,7 +408,7 @@ static void end_pgm (int dont_care_sig) 
 static void end_pgm (int dont_care_sig)
 {
    (void)dont_care_sig;
-   bye_bye(stdout, 1, NULL);
+   bye_bye(stdout, 0, NULL);
 }
 
A slightly modified version (small line-number offset) suitable for use with FC5
updates, is attached.

Comment 1 Alexander Dupuy 2006-07-17 18:30:29 UTC
Created attachment 132567 [details]
patch to fix top exit code returns

Comment 2 Karel Zak 2006-09-27 14:51:00 UTC
The patch has been added to FC6. I don't have feedback from upstream maintainer
(yet?), but I think you're right that it seems strange if the top return same
code for error as for standard end.


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