Bug 122470

Summary: [patch] exit status on fetch(1) manual page
Product: Documentation Reporter: Jaakko Heinonen <jh>
Component: Books & ArticlesAssignee: Murray Stokely <murray>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
fetch.1-exit-status.diff none

Description Jaakko Heinonen 2008-04-05 17:00:09 UTC
fetch(1) manual page states that fetch(1) exits with status zero or one:

EXIT STATUS
     The fetch command returns zero on success, or one on failure.  If multi-
     ple URLs are listed on the command line, fetch will attempt to retrieve
     each one of them in turn, and will return zero only if they were all suc-
     cessfully retrieved.

However it's possible that it exits with status other than zero or one:

$ fetch -h foo
usage: fetch [-146AFMPRUadlmnpqrsv] [-N netrc] [-o outputfile]
             [-S bytes] [-B bytes] [-T seconds] [-w seconds]
             [-h host -f file [-c dir] | URL ...]
$ echo $?
64
Comment 1 minimarmot 2008-04-08 03:24:12 UTC
Hello,

On 4/5/08, Jaakko Heinonen <jh@saunalahti.fi> wrote:
[snip]
>  fetch(1) manual page states that fetch(1) exits with status zero or one:
>
>  EXIT STATUS
>      The fetch command returns zero on success, or one on failure.  If multi-
>      ple URLs are listed on the command line, fetch will attempt to retrieve
>      each one of them in turn, and will return zero only if they were all suc-
>      cessfully retrieved.
>
>  However it's possible that it exits with status other than zero or one:
>
>  $ fetch -h foo
>  usage: fetch [-146AFMPRUadlmnpqrsv] [-N netrc] [-o outputfile]
>              [-S bytes] [-B bytes] [-T seconds] [-w seconds]
>              [-h host -f file [-c dir] | URL ...]
>  $ echo $?
>  64
>

It seems that fetch(1) can also return EX_USAGE when it is not
invoked as it is expecting; this macro is defined to be 64 in
/usr/include/sysexits.h

We might as well change the man page to say ``EX_USAGE
is returned when .Nm is not invoked properly.''

-Ben Kaduk
Comment 2 Murray Stokely freebsd_committer freebsd_triage 2008-12-15 01:57:39 UTC
Responsible Changed
From-To: freebsd-doc->murray

I have an outstanding patch to fetch out for review.  I will make this 
change in a follow up submit.
Comment 3 murray.stokely 2008-12-16 05:43:45 UTC
I have a patch to address this out for review :

http://people.freebsd.org/~murray/patches/fetch-unused-vars-20081215.diff

- Murray
Comment 4 Murray Stokely freebsd_committer freebsd_triage 2008-12-17 18:00:24 UTC
State Changed
From-To: open->patched

Instead of the last patch, des suggested just updating the return 
values to 1 as the man page states.  This updated patch was committed 
to HEAD : 

http://people.freebsd.org/~murray/patches/fetch-unused-vars-20081216.diff 

Will MFC in a few weeks to 7.x.  This change will not likely be 
present in the upcoming 7.1 release.
Comment 5 Murray Stokely freebsd_committer freebsd_triage 2009-01-09 03:56:18 UTC
State Changed
From-To: patched->closed

This change has been merged to 7-stable and will be present in FreeBSD 
7.2.  Thanks for your submission!