Bug 138663 - system(3) man page confuses users about "return value of 127"
Summary: system(3) man page confuses users about "return value of 127"
Status: Open
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-09 15:20 UTC by Gennady Proskurin
Modified: 2018-04-10 22:58 UTC (History)
1 user (show)

See Also:


Attachments
system.txt (488 bytes, text/plain; charset=UTF-8)
2014-05-30 20:42 UTC, Sevan Janiyan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gennady Proskurin freebsd_committer freebsd_triage 2009-09-09 15:20:00 UTC
from system(3) man page

RETURN VALUES
     The system() function returns the exit status of the shell as returned by
     waitpid(2), or -1 if an error occurred when invoking fork(2) or
     waitpid(2).  A return value of 127 means the execution of the shell
     failed.


It should be clearly mentioned, that "return value of 127" applies to result of WEXITSTATUS() or something (termination status for a program), not to return value of system() itself.

Fix: 

man from OpenBSD, for example:

RETURN VALUES
     If a child process cannot be created, or the termination status of the
     shell cannot be obtained, system() returns -1 and sets errno to indicate
     the error.  If execution of the shell fails, system() returns the termi-
     nation status for a program that terminates with a call of exit(127).
How-To-Repeat: man 3 system
read section "RETURN VALUES"
Comment 1 Glen Barber freebsd_committer freebsd_triage 2010-09-14 03:16:13 UTC
Responsible Changed
From-To: freebsd-doc->gjb

I'll take this.
Comment 2 Glen Barber freebsd_committer freebsd_triage 2010-10-01 12:50:49 UTC
Responsible Changed
From-To: gjb->freebsd-doc

Back to the pool for now due to lack of time.
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2012-03-05 00:22:38 UTC
Responsible Changed
From-To: freebsd-doc->eadler

I'll take it.
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2012-07-25 07:49:27 UTC
Responsible Changed
From-To: eadler->freebsd-doc

I won't be getting to this any time soon
Comment 5 Joel Dahl freebsd_committer freebsd_triage 2013-04-22 12:05:48 UTC
Responsible Changed
From-To: freebsd-doc->Take
Comment 6 Joel Dahl freebsd_committer freebsd_triage 2013-04-22 12:06:17 UTC
Responsible Changed
From-To: Take->joel

Take
Comment 7 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:34 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped