Bug 982691 - virt-sandbox exit code wraps back to 0 at 256,512 etc.
Summary: virt-sandbox exit code wraps back to 0 at 256,512 etc.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt-sandbox
Version: 19
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Daniel Berrangé
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-09 15:10 UTC by Martin Jenner
Modified: 2013-07-09 15:15 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-07-09 15:15:54 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Martin Jenner 2013-07-09 15:10:46 UTC
Description of problem: 

The exit code after running virt-sandbox wraps at number 256,512 etc. back to 0.


Version-Release number of selected component (if applicable):
F19 RC1
kernel-3.9.5-301.fc19.x86_64
libvirt-sandbox-0.2.0-1.fc19.x86_64
libvirt-1.0.5.1-1.fc19.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Create a test command/script to execute inside the container

# cat <<EOF >/usr/local/bin/exit-code-test.sh 
#!/bin/bash

exit 256
EOF
# chmod 755 /usr/local/bin/exit-code-test.sh

2. run the above command/script using virt-sandbox

# virt-sandbox -c lxc:/// -n container-001 /usr/local/bin/exit-code-test.sh
# echo $?

For my testing I just repeated steps 1 and 2 editing the exit value in script exit-code-test.sh between test runs.


Actual results:
Exit code wraps at 256 and returns value 0

Expected results:
Exit code should not wrap around and return the actual exit code of the command

Comment 1 Daniel Berrangé 2013-07-09 15:15:54 UTC
Err, that's nothing todo with libvirt-sandbox. This is simply a UNIX limitation. You can't have any exit code > 255, since only 8 bits are available. You can see this just using bash directly

# bash
$ exit 256
# echo $?
0


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