udevadm lock did not propagate the return code from the child process
because all positive values were treated as success.
v2:
Now 'udevadm test-builtin' ignores all positive return values from the
builtin commands. Otherwise, as the hwdb builtin returns an positive value
when a matching entry found, 'udevadm test-builtin hwdb' will fail.
v3:
Initialize partition table before calling 'sfdisk --delete'.
Co-authored-by: Yu Watanabe <watanabe.yu+github@gmail.com>
}
r = udev_builtin_run(event, cmd, arg_command, true);
- if (r < 0)
+ if (r < 0) {
log_debug_errno(r, "Builtin command '%s' fails: %m", arg_command);
+ goto finish;
+ }
+ r = 0;
finish:
udev_builtin_exit();
return r;
return udevadm_main(argc, argv);
}
-DEFINE_MAIN_FUNCTION(run);
+DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run);
udevadm control --reload
+ # initialize partition table
+ for disk in {0..9}; do
+ echo 'label: gpt' | udevadm lock --device="${devices[$disk]}" sfdisk -q "${devices[$disk]}"
+ done
+
# Delete the partitions, immediately recreate them, wait for udev to settle
# down, and then check if we have any dangling symlinks in /dev/disk/. Rinse
# and repeat.