diff options
-rw-r--r-- | core/busybox/APKBUILD | 4 | ||||
-rw-r--r-- | core/busybox/bb-tar-numeric-owner.patch | 92 |
2 files changed, 95 insertions, 1 deletions
diff --git a/core/busybox/APKBUILD b/core/busybox/APKBUILD index c8383b1a7d..7c3ff2e6f9 100644 --- a/core/busybox/APKBUILD +++ b/core/busybox/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=busybox pkgver=1.13.3 -pkgrel=3 +pkgrel=4 pkgdesc="Size optimized toolbox of many common UNIX utilities" url=http://busybox.net license=GPL-2 @@ -14,6 +14,7 @@ source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2 busybox-1.13.2-depmod2.patch busybox-1.13.3-ash.patch busybox-1.13.3-hush.patch + bb-tar-numeric-owner.patch $install busyboxconfig" @@ -46,6 +47,7 @@ a743ec04f378b8456a725c7270b0be8b busybox-1.13.2-modprobe-errormsg.patch 3c43008545e069749d2d653532e1feb3 busybox-1.13.2-depmod2.patch ed7537bc7193ab35f4e4ac6ce26d8270 busybox-1.13.3-ash.patch 4a5fe634708150f65b6d9b51dba20a51 busybox-1.13.3-hush.patch +0b5b2d7db201f90cd08f4a3164ee29a1 bb-tar-numeric-owner.patch 56b78c358797cd15fb64719a48939267 busybox.post-install 56b78c358797cd15fb64719a48939267 busybox.post-upgrade fa6b9e2021102a53c43875ef0704d6f3 busyboxconfig" diff --git a/core/busybox/bb-tar-numeric-owner.patch b/core/busybox/bb-tar-numeric-owner.patch new file mode 100644 index 0000000000..ad6481ffe4 --- /dev/null +++ b/core/busybox/bb-tar-numeric-owner.patch @@ -0,0 +1,92 @@ +Index: archival/tar.c +=================================================================== +--- a/archival/tar.c (revision 26114) ++++ b/archival/tar.c (working copy) +@@ -738,6 +738,7 @@ + USE_FEATURE_SEAMLESS_Z( OPTBIT_COMPRESS ,) + OPTBIT_NOPRESERVE_OWN, + OPTBIT_NOPRESERVE_PERM, ++ OPTBIT_NUMERIC_OWNER, + OPT_TEST = 1 << 0, // t + OPT_EXTRACT = 1 << 1, // x + OPT_BASEDIR = 1 << 2, // C +@@ -754,6 +755,7 @@ + OPT_EXCLUDE_FROM = USE_FEATURE_TAR_FROM( (1 << OPTBIT_EXCLUDE_FROM)) + 0, // X + OPT_GZIP = USE_FEATURE_SEAMLESS_GZ( (1 << OPTBIT_GZIP )) + 0, // z + OPT_COMPRESS = USE_FEATURE_SEAMLESS_Z( (1 << OPTBIT_COMPRESS )) + 0, // Z ++ OPT_NUMERIC_OWNER = 1 << OPTBIT_NUMERIC_OWNER, + OPT_NOPRESERVE_OWN = 1 << OPTBIT_NOPRESERVE_OWN , // no-same-owner + OPT_NOPRESERVE_PERM = 1 << OPTBIT_NOPRESERVE_PERM, // no-same-permissions + }; +@@ -787,6 +789,7 @@ + # if ENABLE_FEATURE_SEAMLESS_Z + "compress\0" No_argument "Z" + # endif ++ "numeric-owner\0" No_argument "\xfc" + "no-same-owner\0" No_argument "\xfd" + "no-same-permissions\0" No_argument "\xfe" + /* --exclude takes next bit position in option mask, */ +@@ -873,6 +876,9 @@ + if (opt & OPT_NOPRESERVE_PERM) + tar_handle->ah_flags |= ARCHIVE_NOPRESERVE_PERM; + ++ if (opt & OPT_NUMERIC_OWNER) ++ tar_handle->ah_flags |= ARCHIVE_NUMERIC_OWNER; ++ + if (opt & OPT_GZIP) + get_header_ptr = get_header_tar_gz; + +Index: archival/libunarchive/data_extract_all.c +=================================================================== +--- a/archival/libunarchive/data_extract_all.c (revision 26114) ++++ b/archival/libunarchive/data_extract_all.c (working copy) +@@ -114,22 +114,23 @@ + } + + if (!(archive_handle->ah_flags & ARCHIVE_NOPRESERVE_OWN)) { +-#if ENABLE_FEATURE_TAR_UNAME_GNAME +- uid_t uid = file_header->uid; +- gid_t gid = file_header->gid; ++ if (ENABLE_FEATURE_TAR_UNAME_GNAME && ++ !(archive_handle->ah_flags & ARCHIVE_NUMERIC_OWNER)) { ++ uid_t uid = file_header->uid; ++ gid_t gid = file_header->gid; + +- if (file_header->uname) { +- struct passwd *pwd = getpwnam(file_header->uname); +- if (pwd) uid = pwd->pw_uid; ++ if (file_header->uname) { ++ struct passwd *pwd = getpwnam(file_header->uname); ++ if (pwd) uid = pwd->pw_uid; ++ } ++ if (file_header->gname) { ++ struct group *grp = getgrnam(file_header->gname); ++ if (grp) gid = grp->gr_gid; ++ } ++ lchown(file_header->name, uid, gid); ++ } else { ++ lchown(file_header->name, file_header->uid, file_header->gid); + } +- if (file_header->gname) { +- struct group *grp = getgrnam(file_header->gname); +- if (grp) gid = grp->gr_gid; +- } +- lchown(file_header->name, uid, gid); +-#else +- lchown(file_header->name, file_header->uid, file_header->gid); +-#endif + } + if ((file_header->mode & S_IFMT) != S_IFLNK) { + /* uclibc has no lchmod, glibc is even stranger - +Index: include/unarchive.h +=================================================================== +--- a/include/unarchive.h (revision 26114) ++++ b/include/unarchive.h (working copy) +@@ -11,6 +11,7 @@ + #define ARCHIVE_EXTRACT_NEWER 16 + #define ARCHIVE_NOPRESERVE_OWN 32 + #define ARCHIVE_NOPRESERVE_PERM 64 ++#define ARCHIVE_NUMERIC_OWNER 128 + + typedef struct file_header_t { + char *name; |