Bug 187322 - Cleanup error handling
Cleanup error handling
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: setarch (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jindrich Novy
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-03-29 19:10 EST by Dmitry V. Levin
Modified: 2013-07-02 19:15 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-04-18 08:18:38 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
setarch-1.9-owl-fixes.patch (4.69 KB, patch)
2006-03-29 19:10 EST, Dmitry V. Levin
no flags Details | Diff

  None (edit)
Description Dmitry V. Levin 2006-03-29 19:10:01 EST
Even such small program like setarch could be cleaned up. :)

Attached patch changes setarch behaviour wrt error handling in more clean way.
Here are 7 examples (old$ is unpatched setarch, new$ is patched):

1. setarch without arguments:

old$ setarch; echo rc=$?
Usage: setarch <arch> [options] [program [program arguments]]

Options:
[options output omitted for brevity]

For more information see setarch(8).
rc=1

new$ setarch; echo rc=$?
setarch: Insufficient arguments
Try `setarch -h' for more information.
rc=1

2. setarch -h:

old$ setarch -h; echo rc=$?
Don't know how to set arch to -h
rc=1

new$ setarch -h; echo rc=$?
Usage: setarch <arch> [options] [program [program arguments]]

Options:
[options output omitted for brevity]

For more information see setarch(8).
rc=0

3. Unrecognized architecture:

old$ setarch foo; echo rc=$?
Don't know how to set arch to foo
rc=1

new$ setarch foo; echo rc=$?
setarch: foo: Unrecognized architecture
rc=1

4. linux32 without arguments:

old$ linux32; echo rc=$?
Usage: linux32 [options] [program [program arguments]]

Options:
[options output omitted for brevity]

For more information see setarch(8).
rc=1

new$ linux32; echo rc=$?
-sh-3.1$ logout
rc=0

5. unknown option:

old$ linux32 -z; echo rc=$?
warning: unknown option `z'
-sh-3.1$ logout
rc=0

new$ linux32 -z; echo rc=$?
linux32: Unknown option `z' ignored
-sh-3.1$ logout
rc=0

6. setarch exec failure

old$ setarch linux32 foo; echo rc=$?
rc=1

new$ setarch linux32 foo; echo rc=$?
setarch: foo: No such file or directory
rc=1

7. linux32 exec failure

old$ linux32 foo; echo rc=$?
rc=1

new$ linux32 foo; echo rc=$?
linux32: foo: No such file or directory
rc=1
Comment 1 Dmitry V. Levin 2006-03-29 19:10:02 EST
Created attachment 127032 [details]
setarch-1.9-owl-fixes.patch
Comment 2 Jindrich Novy 2006-04-18 08:18:38 EDT
Applied with a few modifications, thanks.

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