Bug 199174

Summary: top returns with exit code 1 even if no error occurs
Product: [Fedora] Fedora Reporter: Alexander Dupuy <alex.dupuy>
Component: procpsAssignee: Karel Zak <kzak>
Status: CLOSED RAWHIDE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 5CC: albert
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://bugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=341272
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-09-27 14:51:00 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
patch to fix top exit code returns none

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.