I changed the script to this, mimicking the original check() function:

#!/bin/bash
DRACUT_INSTALL=/bin/true   # dracut-functions.sh exits if it can't find 
dracut-install
. "$(dirname "$0")/dracut-functions.sh"

check() {
    local arg="$1"
    require_binaries "${arg}" || return 1
    return 255
}

echo "Path to check: $1"
ls -la "$1"
echo "Calling check $1"
check "$1"
echo "check $1 returned $?"


Something that does not exist in the given path, but does exist elsewhere in 
PATH:
$ ./demo-defect2.sh /asd/asd/bash
Path to check: /asd/asd/bash
ls: cannot access '/asd/asd/bash': No such file or directory
Calling check /asd/asd/bash
check /asd/asd/bash returned 255


Now something that exists in the given path:
$ ./demo-defect2.sh /bin/bash
Path to check: /bin/bash
-rwxr-xr-x 1 root root 1540520 Feb 13  2026 /bin/bash
Calling check /bin/bash
check /bin/bash returned 255


Finally, something that doesn't exist anywhere:
$ ./demo-defect2.sh /asd/asd/jfhiowehg
Path to check: /asd/asd/jfhiowehg
ls: cannot access '/asd/asd/jfhiowehg': No such file or directory
Calling check /asd/asd/jfhiowehg
check /asd/asd/jfhiowehg returned 1


So check() only returns 1 when the thing definitely doesn't exist. But if it 
exists exactly where specified, or somewhere else in PATH, it returns 255.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2150657

Title:
  Use busybox instead of rust-coreutils in initrd

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/busybox/+bug/2150657/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to