busybox: Fix broken install command

This commit is contained in:
Dylan Araps 2020-04-22 19:27:33 +03:00
parent 3239525b1c
commit aef6d4f223
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
5 changed files with 41 additions and 3 deletions

View File

@ -19,8 +19,8 @@ make CC="${CC:-cc}" HOSTCC="${CC:-cc}"
make CONFIG_PREFIX="$1/usr" install
# Aptly name the busybox binaries.
mv "$1/usr/bin/busybox" "$1/usr/bin/busybox-suid"
mv "$1/usr/bin/busybox-nosuid" "$1/usr/bin/busybox"
mv -f "$1/usr/bin/busybox" "$1/usr/bin/busybox-suid"
mv -f "$1/usr/bin/busybox-nosuid" "$1/usr/bin/busybox"
# Install the non-suid symlinks.
"$1/usr/bin/busybox" --list | while read -r bin; do

View File

@ -3,6 +3,7 @@ d0f940a72f648943c1f2211e0e3117387c31d765137d92bd8284a3fb9752a998 busybox-1.31.1
8d84b1719dca2a751c09072c20cd782a3c47f119a68d35316f89d851daf67b88 fsck-resolve-uuid.patch
0f54301a73af461e8066bc805b48d991cfed513d08a2f036e015b19f97cb424a modprobe-kernel-version.patch
68e0c7d5e96902d3b890e89d9b018ae11d53ed3104bfedd624a1485df58b11cb print-unicode.patch
f0e17fefc0af6b10205d72b242b6ef7481a58ff07726c62890ebc5893b96a396 install-fix-chown.patch
05be5fde1da4b94bea5b2e6f5813873acd558c75508f9a772a71061f3c0d6a6f .config
b4479adaabffb1fe9af7db676929e8f5f6bbc47869c5309a19056aa66196fbce .config-suid
76978b2b69361d47b3bb314a8a320ca274b2af7339c571be1a19f0e1d8c4da6a acpid.run

View File

@ -0,0 +1,36 @@
chown must precede chmod because on some systems,
chown clears the set[ug]id bits for non-superusers,
resulting in incorrect permissions.
diff --git a/coreutils/install.c b/coreutils/install.c
index 8270490..0256aeb 100644
--- a/coreutils/install.c
+++ b/coreutils/install.c
@@ -244,6 +244,14 @@ int install_main(int argc, char **argv)
}
}
+ /* Set the user and group id */
+ if ((opts & (OPT_OWNER|OPT_GROUP))
+ && lchown(dest, uid, gid) == -1
+ ) {
+ bb_perror_msg("can't change %s of %s", "ownership", dest);
+ ret = EXIT_FAILURE;
+ }
+
/* Set the file mode (always, not only with -m).
* GNU coreutils 6.10 is not affected by umask. */
if (chmod(dest, mode) == -1) {
@@ -254,13 +262,6 @@ int install_main(int argc, char **argv)
if (use_default_selinux_context)
setdefaultfilecon(dest);
#endif
- /* Set the user and group id */
- if ((opts & (OPT_OWNER|OPT_GROUP))
- && lchown(dest, uid, gid) == -1
- ) {
- bb_perror_msg("can't change %s of %s", "ownership", dest);
- ret = EXIT_FAILURE;
- }
next:
if (ENABLE_FEATURE_CLEAN_UP && isdir)
free(dest);

View File

@ -3,6 +3,7 @@ patches/adduser-no-setgid.patch
patches/fsck-resolve-uuid.patch
patches/modprobe-kernel-version.patch
patches/print-unicode.patch
patches/install-fix-chown.patch
files/.config
files/.config-suid
files/acpid.run

View File

@ -1 +1 @@
1.31.1 6
1.31.1 7