Bug 689659
| Summary: | "busybox cp" does not return a correct exit code when "No space left on device" | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 5 | Reporter: | Shinji Kito <skito> | |
| Component: | busybox | Assignee: | Denys Vlasenko <dvlasenk> | |
| Status: | CLOSED ERRATA | QA Contact: | qe-baseos-daemons | |
| Severity: | medium | Docs Contact: | ||
| Priority: | medium | |||
| Version: | 5.6 | CC: | asersen, azelinka, moshiro, ovasik, rvokal | |
| Target Milestone: | rc | |||
| Target Release: | --- | |||
| Hardware: | i386 | |||
| OS: | Linux | |||
| Whiteboard: | ||||
| Fixed In Version: | Doc Type: | Bug Fix | ||
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 752133 (view as bug list) | Environment: | ||
| Last Closed: | 2012-02-21 03:20:53 UTC | Type: | --- | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 668957, 719046, 752133 | |||
|
Description
Shinji Kito
2011-03-22 02:58:53 UTC
(In reply to comment #0) > Related Package Version: busybox-1.2.0-7.el5 > > Steps to Reproduce: > 1. Make sure there is 4GB free space or more > # df -lh > Filesystem Size Used Avail Use% Mounted on > /dev/sda2 48G 19G 26G 43% / > /dev/sda1 494M 27M 442M 6% /boot > tmpfs 7.8G 0 7.8G 0% /dev/shm > /dev/sda5 19G 13G 4.4G 75% /mnt > > 2. # /sbin/busybox cp /root/16GB-file /mnt/ > cp: Write Error: No space left on device > > 3. # echo $? > 0 > > Actual results: > "busybox cp" returns 0 when the command fails. > > Expected results: > "busybox cp" returns 1 when the command fails. > > "cp" command in coreutils returns 1 when it fails. > e.g. > # /bin/cp 16GB-file /mnt/ > cp: writing `/mnt/16GB-file': No space left on device > # echo $? > 1 Can't reproduce: # mkdir ddd # mount -t tmpfs none ddd -o size=100000 Trying upstream (current busybox git): # ./busybox cp busybox_unstripped ddd; echo $? cp: write error: No space left on device 1 # rm ddd/* Trying binary extracted from busybox-1.2.0-7.el5 rpm (the version which doesn't work for you): # ./busybox-1.2.0-7.el5 cp busybox_unstripped ddd; echo $? cp: Write Error: No space left on device 1 # rm ddd/* Trying binary extracted from latest RHEL5 build, busybox-1.2.0-10.el5: # ./busybox-1.2.0-10.el5 cp busybox_unstripped ddd; echo $? cp: Write Error: No space left on device 1 # rm ddd/* In all cases, exit code is 1, as it should be. I was finally able to reproduce it. It seems to happen when last write was partial: write(4, "\0\0\0\0\0\0\0\0\0"..., 8192) = 4096 write(4, "\0\0\0\0\0\0\0\0\0"..., 4096) = -1 ENOSPC (No space left on device) and even then, not always. I will look more into it (need to build bbox from source to track it further). I found the bug: bb_copy_..() routines in 1.2.x were using size_t for total size to copy, and after 4Gb they rolled over to 0, which made bb_copy_..() to return success. Test build with the fix: https://brewweb.devel.redhat.com/taskinfo?taskID=3534963 New build (non-test one): https://brewweb.devel.redhat.com/taskinfo?taskID=3748759 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2012-0308.html |