Bug 11726

Summary: blockdev always returns 0
Product: Busybox Reporter: Paul Whittaker <whitpa>
Component: OtherAssignee: unassigned
Status: RESOLVED WORKSFORME    
Severity: minor CC: busybox-cvs
Priority: P5    
Version: 1.30.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Paul Whittaker 2019-03-14 00:47:50 UTC
The blockdev applet always returns a zero exit code, which is not consistent with util-linux blockdev behaviour.

In particular, this is a problem for the "blockdev --rereadpt" case, which does not provide stdout output.  Automation may be relying on a non-zero exit code from blockdev to indicate a BLKRRPART ioctl failure.
Comment 1 Denys Vlasenko 2019-03-30 17:55:46 UTC
Can't reproduce:

busybox blockdev --rereadpt /dev/sda

execve("./busybox", ["./busybox", "blockdev", "--rereadpt", "/dev/sda"], 0x7ffdd1fbf4b8 /* 53 vars */) = 0
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
prctl(PR_SET_NAME, "busybox")           = 0
getuid32()                              = 0
open("/dev/sda", O_RDONLY|O_LARGEFILE)  = 3
ioctl(3, BLKRRPART)                     = -1 EBUSY (Device or resource busy)
write(2, "blockdev: /dev/sda: Device or resource busy\n", 44) = 44
exit(1)                                 = ?
+++ exited with 1 +++