Bug 187322 - Cleanup error handling
Summary: Cleanup error handling
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: setarch   
(Show other bugs)
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jindrich Novy
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-03-30 00:10 UTC by Dmitry V. Levin
Modified: 2013-07-02 23:15 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-04-18 12:18:38 UTC
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-30 00:10 UTC, Dmitry V. Levin
no flags Details | Diff

Description Dmitry V. Levin 2006-03-30 00:10:01 UTC
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-30 00:10:02 UTC
Created attachment 127032 [details]
setarch-1.9-owl-fixes.patch

Comment 2 Jindrich Novy 2006-04-18 12:18:38 UTC
Applied with a few modifications, thanks.


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