commit 92d85f3c4e37f2e56a099e6bc2a93b1009ba0c74 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:19:16 2019 -0400 Package init diff --git a/2.28-login-lastlog-create.patch b/2.28-login-lastlog-create.patch new file mode 100644 index 0000000..869543e --- /dev/null +++ b/2.28-login-lastlog-create.patch @@ -0,0 +1,12 @@ +diff -up util-linux-2.28/login-utils/login.c.kzak util-linux-2.28/login-utils/login.c +--- util-linux-2.28/login-utils/login.c.kzak 2016-03-08 14:28:16.724156218 +0100 ++++ util-linux-2.28/login-utils/login.c 2016-04-26 12:45:29.235326017 +0200 +@@ -510,7 +510,7 @@ static void log_lastlog(struct login_con + sa.sa_handler = SIG_IGN; + sigaction(SIGXFSZ, &sa, &oldsa_xfsz); + +- fd = open(_PATH_LASTLOG, O_RDWR, 0); ++ fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0); + if (fd < 0) + goto done; + diff --git a/adjtime b/adjtime new file mode 100644 index 0000000..3127bd0 --- /dev/null +++ b/adjtime @@ -0,0 +1,2 @@ +0.0 0 0.0 +0 diff --git a/agetty-Fix-input-of-non-ASCII-characters-in-get_logn.patch b/agetty-Fix-input-of-non-ASCII-characters-in-get_logn.patch new file mode 100644 index 0000000..f0ba225 --- /dev/null +++ b/agetty-Fix-input-of-non-ASCII-characters-in-get_logn.patch @@ -0,0 +1,40 @@ +From 5de9751997cf490088f62f41fd92be57cf7ceea4 Mon Sep 17 00:00:00 2001 +From: Stanislav Brabec +Date: Wed, 27 Feb 2019 23:22:19 +0100 +Subject: [PATCH 666/686] agetty: Fix input of non-ASCII characters in + get_logname() + +As login supports non-ASCII characters in the logname, agetty should be +consistent. + +8b58ffdd re-activated old and ASCII-only get_logname(), which restricted +the input to ASCII only. As the code does not read whole characters, +isascii(ascval) and isprint(ascval) returns nonsenses after entering a +non-ASCII character. + +As keyboard maps don't contain unprintable non-control characters, it +seems to be relatively safe to remove both checks. + +Signed-off-by: Stanislav Brabec +Cc: Lubomir Rintel +Tested-by: Lubomir Rintel +--- + term-utils/agetty.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/term-utils/agetty.c b/term-utils/agetty.c +index 1a3ebc3..0ef8ba3 100644 +--- a/term-utils/agetty.c ++++ b/term-utils/agetty.c +@@ -2175,8 +2175,6 @@ static char *get_logname(struct issue *ie, struct options *op, struct termios *t + case CTL('D'): + exit(EXIT_SUCCESS); + default: +- if (!isascii(ascval) || !isprint(ascval)) +- break; + if ((size_t)(bp - logname) >= sizeof(logname) - 1) + log_err(_("%s: input overrun"), op->tty); + if ((tp->c_lflag & ECHO) == 0) +-- +1.8.3.1 + diff --git a/bash-completion-fix-few-bash-set-u-issues.patch b/bash-completion-fix-few-bash-set-u-issues.patch new file mode 100644 index 0000000..d534465 --- /dev/null +++ b/bash-completion-fix-few-bash-set-u-issues.patch @@ -0,0 +1,157 @@ +From c6f0bdfecc7b1bbadc644eb8f625473c34fe7cae Mon Sep 17 00:00:00 2001 +From: Sami Kerola +Date: Thu, 5 Apr 2018 20:56:53 +0100 +Subject: [PATCH 033/686] bash-completion: fix few bash set -u issues + +This is the same fix as in reference commit, and the same reason. Just +correct few files missed earlier. + +Reference: abbcec4fc9c8d7fb835b4eafd1bc9d82acbf0056 +Signed-off-by: Sami Kerola +--- + bash-completion/chcpu | 4 ++-- + bash-completion/lsblk | 10 +++++----- + bash-completion/lscpu | 2 +- + bash-completion/lslogins | 2 +- + bash-completion/lsns | 2 +- + bash-completion/mount | 2 +- + bash-completion/setpriv | 2 +- + bash-completion/taskset | 2 +- + 8 files changed, 13 insertions(+), 13 deletions(-) + +diff --git a/bash-completion/chcpu b/bash-completion/chcpu +index 33991f4..0d96c25 100644 +--- a/bash-completion/chcpu ++++ b/bash-completion/chcpu +@@ -12,7 +12,7 @@ _chcpu_module() + CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/offline) + for WORD in $(eval echo $CPULIST_ALL); do + if ! [[ $prefix == *"$WORD"* ]]; then +- CPULIST="$WORD $CPULIST" ++ CPULIST="$WORD ${CPULIST:-""}" + fi + done + compopt -o nospace +@@ -26,7 +26,7 @@ _chcpu_module() + CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online) + for WORD in $(eval echo $CPULIST_ALL); do + if ! [[ $prefix == *"$WORD"* ]]; then +- CPULIST="$WORD $CPULIST" ++ CPULIST="$WORD ${CPULIST:-""}" + fi + done + compopt -o nospace +diff --git a/bash-completion/lsblk b/bash-completion/lsblk +index 4fef8fc..bd86f9f 100644 +--- a/bash-completion/lsblk ++++ b/bash-completion/lsblk +@@ -20,15 +20,15 @@ _lsblk_module() + prefix="${cur%$realcur}" + for I in /sys/dev/block/*; do + J=${I##*/} +- MAJOR_ALL="$MAJOR_ALL ${J%%:*}" ++ MAJOR_ALL="${MAJOR_ALL:-""} ${J%%:*}" + done +- for WORD in $MAJOR_ALL; do ++ for WORD in ${MAJOR_ALL:-""}; do + if ! [[ $prefix == *"$WORD"* ]]; then +- MAJOR="$WORD $MAJOR" ++ MAJOR="$WORD ${MAJOR:-""}" + fi + done + compopt -o nospace +- COMPREPLY=( $(compgen -P "$prefix" -W "$MAJOR" -S ',' -- $realcur) ) ++ COMPREPLY=( $(compgen -P "$prefix" -W "${MAJOR:-""}" -S ',' -- $realcur) ) + return 0 + ;; + '-o'|'--output') +@@ -37,7 +37,7 @@ _lsblk_module() + prefix="${cur%$realcur}" + for WORD in $LSBLK_COLS_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then +- LSBLK_COLS="$WORD $LSBLK_COLS" ++ LSBLK_COLS="$WORD ${LSBLK_COLS:-""}" + fi + done + compopt -o nospace +diff --git a/bash-completion/lscpu b/bash-completion/lscpu +index d16af35..69337ac 100644 +--- a/bash-completion/lscpu ++++ b/bash-completion/lscpu +@@ -15,7 +15,7 @@ _lscpu_module() + CONFIGURED ONLINE MAXMHZ MINMHZ" + for WORD in $OPTS_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then +- OPTS="$WORD $OPTS" ++ OPTS="$WORD ${OPTS:-""}" + fi + done + compopt -o nospace +diff --git a/bash-completion/lslogins b/bash-completion/lslogins +index 967b644..795b5d8 100755 +--- a/bash-completion/lslogins ++++ b/bash-completion/lslogins +@@ -35,7 +35,7 @@ _lslogins_module() + prefix="${cur%$realcur}" + for WORD in $LSLOGINS_COLS_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then +- LSLOGINS_COLS="$WORD $LSLOGINS_COLS" ++ LSLOGINS_COLS="$WORD ${LSLOGINS_COLS:-""}" + fi + done + compopt -o nospace +diff --git a/bash-completion/lsns b/bash-completion/lsns +index 8cf0a31..035f43b 100644 +--- a/bash-completion/lsns ++++ b/bash-completion/lsns +@@ -14,7 +14,7 @@ _lsns_module() + prefix="${cur%$realcur}" + for WORD in $LSNS_COLS_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then +- LSNS_COLS="$WORD $LSNS_COLS" ++ LSNS_COLS="$WORD ${LSNS_COLS:-""}" + fi + done + compopt -o nospace +diff --git a/bash-completion/mount b/bash-completion/mount +index 9a33913..c7e4bea 100644 +--- a/bash-completion/mount ++++ b/bash-completion/mount +@@ -15,7 +15,7 @@ _mount_module() + prefix="${cur%$realcur}" + for WORD in $TYPES; do + if ! [[ $prefix == *"$WORD"* ]]; then +- TYPE_COLS="$WORD $TYPE_COLS" ++ TYPE_COLS="$WORD ${TYPE_COLS:-""}" + fi + done + compopt -o nospace +diff --git a/bash-completion/setpriv b/bash-completion/setpriv +index 8ab9e07..bf4737a 100644 +--- a/bash-completion/setpriv ++++ b/bash-completion/setpriv +@@ -38,7 +38,7 @@ _setpriv_module() + GIDS_ALL=$(getent group | awk -F: '{print $3}') + for WORD in $GIDS_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then +- GIDS="$WORD $GIDS" ++ GIDS="$WORD ${GIDS:-""}" + fi + done + compopt -o nospace +diff --git a/bash-completion/taskset b/bash-completion/taskset +index 453b17b..7c9a7bd 100644 +--- a/bash-completion/taskset ++++ b/bash-completion/taskset +@@ -12,7 +12,7 @@ _taskset_module() + CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online) + for WORD in $(eval echo $CPULIST_ALL); do + if ! [[ $prefix == *"$WORD"* ]]; then +- CPULIST="$WORD $CPULIST" ++ CPULIST="$WORD ${CPULIST:-""}" + fi + done + compopt -o nospace +-- +1.8.3.1 + diff --git a/bash-completion-fix-typo-in-blockdev-file.patch b/bash-completion-fix-typo-in-blockdev-file.patch new file mode 100644 index 0000000..7f4cf70 --- /dev/null +++ b/bash-completion-fix-typo-in-blockdev-file.patch @@ -0,0 +1,26 @@ +From 27ea4deb93a15e701d1a1fd791f70677c579b947 Mon Sep 17 00:00:00 2001 +From: Sami Kerola +Date: Thu, 5 Apr 2018 20:56:56 +0100 +Subject: [PATCH 036/686] bash-completion: fix typo in blockdev file + +Signed-off-by: Sami Kerola +--- + bash-completion/blockdev | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/bash-completion/blockdev b/bash-completion/blockdev +index 8050c0f..e7aca26 100644 +--- a/bash-completion/blockdev ++++ b/bash-completion/blockdev +@@ -33,7 +33,7 @@ _blockdev_module() + COMPREPLY=( $(compgen -W "bytes" -- $cur) ) + return 0 + ;; +- '--setbsz'|'--setfra') ++ '--setra'|'--setfra') + COMPREPLY=( $(compgen -W "sectors" -- $cur) ) + return 0 + ;; +-- +1.8.3.1 + diff --git a/blkzone-fix-report-zones-sector-offset-check.patch b/blkzone-fix-report-zones-sector-offset-check.patch new file mode 100644 index 0000000..e03d787 --- /dev/null +++ b/blkzone-fix-report-zones-sector-offset-check.patch @@ -0,0 +1,32 @@ +From 8a7f4b5bfe35ffc5f32cea67335d8265f77a4697 Mon Sep 17 00:00:00 2001 +From: Masato Suzuki +Date: Tue, 23 Oct 2018 18:31:35 +0900 +Subject: [PATCH 447/686] blkzone: fix report zones sector offset check + +To catch an offset error, an offset should be begger than or equal to +a device size in the condition. + +Signed-off-by: Masato Suzuki +--- + sys-utils/blkzone.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/sys-utils/blkzone.c b/sys-utils/blkzone.c +index b6a3aa4..1dcbdf5 100644 +--- a/sys-utils/blkzone.c ++++ b/sys-utils/blkzone.c +@@ -179,8 +179,9 @@ static int blkzone_report(struct blkzone_control *ctl) + + fd = init_device(ctl, O_RDONLY); + +- if (ctl->offset > ctl->total_sectors) +- errx(EXIT_FAILURE, _("%s: offset is greater than device size"), ctl->devname); ++ if (ctl->offset >= ctl->total_sectors) ++ errx(EXIT_FAILURE, ++ _("%s: offset is greater than or equal to device size"), ctl->devname); + + zonesize = blkdev_chunk_sectors(ctl->devname); + if (!zonesize) +-- +1.8.3.1 + diff --git a/chmem-add-initilizer-clang.patch b/chmem-add-initilizer-clang.patch new file mode 100644 index 0000000..227681e --- /dev/null +++ b/chmem-add-initilizer-clang.patch @@ -0,0 +1,28 @@ +From 523de2ec6f41e5cfff31c99393c8d3b1a88a62bf Mon Sep 17 00:00:00 2001 +From: Sami Kerola +Date: Thu, 13 Dec 2018 22:12:26 +0000 +Subject: [PATCH 573/686] chmem: add initilizer [clang] + +warning: use of GNU empty initializer extension [-Wgnu-empty-initializer] + +Signed-off-by: Sami Kerola +--- + sys-utils/chmem.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sys-utils/chmem.c b/sys-utils/chmem.c +index 4a4439a..861f6cf 100644 +--- a/sys-utils/chmem.c ++++ b/sys-utils/chmem.c +@@ -354,7 +354,7 @@ static void __attribute__((__noreturn__)) usage(void) + + int main(int argc, char **argv) + { +- struct chmem_desc _desc = { }, *desc = &_desc; ++ struct chmem_desc _desc = { 0 }, *desc = &_desc; + int cmd = CMD_NONE, zone_id = -1; + char *zone = NULL; + int c, rc; +-- +1.8.3.1 + diff --git a/fallocate-add-missing-semicolon.patch b/fallocate-add-missing-semicolon.patch new file mode 100644 index 0000000..3272e03 --- /dev/null +++ b/fallocate-add-missing-semicolon.patch @@ -0,0 +1,30 @@ +From f1a7cfcb1d487c19c27287fe5136c46f3b7de1ab Mon Sep 17 00:00:00 2001 +From: Matti Niemenmaa +Date: Mon, 10 Sep 2018 15:21:31 +0300 +Subject: [PATCH 386/686] fallocate: add missing semicolon + +This broke compilation when HAVE_POSIX_FALLOCATE was undefined. The typo +dates to the original posix_fallocate support added in commit +833f9a7aae713278eec5f85266597482f18c7370. + +Signed-off-by: Matti Niemenmaa +--- + sys-utils/fallocate.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sys-utils/fallocate.c b/sys-utils/fallocate.c +index 48a1b27..ba3867c 100644 +--- a/sys-utils/fallocate.c ++++ b/sys-utils/fallocate.c +@@ -352,7 +352,7 @@ int main(int argc, char **argv) + posix = 1; + break; + #else +- errx(EXIT_FAILURE, _("posix_fallocate support is not compiled")) ++ errx(EXIT_FAILURE, _("posix_fallocate support is not compiled")); + #endif + case 'v': + verbose++; +-- +1.8.3.1 + diff --git a/fdisk-fix-typo-in-debug-string.patch b/fdisk-fix-typo-in-debug-string.patch new file mode 100644 index 0000000..23b157b --- /dev/null +++ b/fdisk-fix-typo-in-debug-string.patch @@ -0,0 +1,26 @@ +From 36787f7a97c6797ffbd3905427f61f90eed30d56 Mon Sep 17 00:00:00 2001 +From: Vaclav Dolezal +Date: Tue, 29 Aug 2017 15:29:27 +0200 +Subject: [PATCH 100/686] fdisk: fix typo in debug string + +Signed-off-by: Vaclav Dolezal +--- + disk-utils/fdisk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c +index 55af8dc..2126b4c 100644 +--- a/disk-utils/fdisk.c ++++ b/disk-utils/fdisk.c +@@ -100,7 +100,7 @@ int get_user_reply(const char *prompt, char *buf, size_t bufsz) + size_t sz; + int ret = 0; + +- DBG(ASK, ul_debug("asking for user replay %s", is_interactive ? "[interactive]" : "")); ++ DBG(ASK, ul_debug("asking for user reply %s", is_interactive ? "[interactive]" : "")); + + sigemptyset(&act.sa_mask); + sigaction(SIGINT, &act, &oldact); +-- +1.8.3.1 + diff --git a/fix-a-bug-where-switch_root-would-erroneously-try-to.patch b/fix-a-bug-where-switch_root-would-erroneously-try-to.patch new file mode 100644 index 0000000..a222c82 --- /dev/null +++ b/fix-a-bug-where-switch_root-would-erroneously-try-to.patch @@ -0,0 +1,29 @@ +From 9737a1671117e2d8ade95cd46df2c0787d9266cd Mon Sep 17 00:00:00 2001 +From: Paul Asmuth +Date: Fri, 9 Nov 2018 17:02:11 +0100 +Subject: [PATCH 470/686] fix a bug where switch_root would erroneously try to + parse initargs + +before this change, switch_root would try to parse all arguments, +including 'initargs', using getopt, which would lead to an 'unrecognized +option' error when trying to pass a flag to the init program +--- + sys-utils/switch_root.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sys-utils/switch_root.c b/sys-utils/switch_root.c +index 3c66d01..a85ce24 100644 +--- a/sys-utils/switch_root.c ++++ b/sys-utils/switch_root.c +@@ -227,7 +227,7 @@ int main(int argc, char *argv[]) + + atexit(close_stdout); + +- while ((c = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1) ++ while ((c = getopt_long(argc, argv, "+Vh", longopts, NULL)) != -1) + switch (c) { + case 'V': + printf(UTIL_LINUX_VERSION); +-- +1.8.3.1 + diff --git a/hexdump-fix-potential-null-pointer-dereference-warni.patch b/hexdump-fix-potential-null-pointer-dereference-warni.patch new file mode 100644 index 0000000..a5c0d47 --- /dev/null +++ b/hexdump-fix-potential-null-pointer-dereference-warni.patch @@ -0,0 +1,69 @@ +From 577bb86f5b0662ac81699580b55b5a4b11611f01 Mon Sep 17 00:00:00 2001 +From: Sami Kerola +Date: Mon, 10 Dec 2018 21:41:19 +0000 +Subject: [PATCH 557/686] hexdump: fix potential null pointer dereference + warnings + +First three fixes on lines 133, 151, and 280 are cosmetic. Because there +was unobvious null check compiler thought variable might be null, and warned +when after pointer adjustment it was followed without null check. Perhaps +this will not happen sometime in future when compiler is made more smart, +meanwhile lets give better hints to avoid false positive. + +The last change addresses issue that is possible, at least in theory. + +text-utils/hexdump-parse.c:465:12: warning: potential null pointer +dereference [-Wnull-dereference] + +Signed-off-by: Sami Kerola +--- + text-utils/hexdump-parse.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/text-utils/hexdump-parse.c b/text-utils/hexdump-parse.c +index 2b2735b..0b460a7 100644 +--- a/text-utils/hexdump-parse.c ++++ b/text-utils/hexdump-parse.c +@@ -128,8 +128,8 @@ void add_fmt(const char *fmt, struct hexdump *hex) + /* If leading digit, repetition count. */ + if (isdigit(*p)) { + savep = p; +- while (isdigit(*p) && ++p) +- ; ++ while (isdigit(*p)) ++ p++; + if (!isspace(*p) && *p != '/') + badfmt(fmt); + /* may overwrite either white space or slash */ +@@ -146,8 +146,8 @@ void add_fmt(const char *fmt, struct hexdump *hex) + /* byte count */ + if (isdigit(*p)) { + savep = p; +- while (isdigit(*p) && ++p) +- ; ++ while (isdigit(*p)) ++ p++; + if (!isspace(*p)) + badfmt(fmt); + tfu->bcnt = atoi(savep); +@@ -261,7 +261,7 @@ void rewrite_rules(struct hexdump_fs *fs, struct hexdump *hex) + if (fu->bcnt) { + sokay = USEBCNT; + /* skip to conversion character */ +- while (++p1 && strchr(spec, *p1)) ++ for (p1++; strchr(spec, *p1); p1++) + ; + } else { + /* skip any special chars, field width */ +@@ -462,6 +462,8 @@ isint: cs[3] = '\0'; + fu->reps += (hex->blocksize - fs->bcnt) / fu->bcnt; + if (fu->reps > 1 && !list_empty(&fu->prlist)) { + pr = list_last_entry(&fu->prlist, struct hexdump_pr, prlist); ++ if (!pr) ++ continue; + for (p1 = pr->fmt, p2 = NULL; *p1; ++p1) + p2 = isspace(*p1) ? p1 : NULL; + if (p2) +-- +1.8.3.1 + diff --git a/include-add-no-return-function-attribute.patch b/include-add-no-return-function-attribute.patch new file mode 100644 index 0000000..f22c680 --- /dev/null +++ b/include-add-no-return-function-attribute.patch @@ -0,0 +1,32 @@ +From e73456dfbb36c8d19a802ffe46b8ebccd77ccb22 Mon Sep 17 00:00:00 2001 +From: Sami Kerola +Date: Fri, 8 Feb 2019 22:01:05 +0000 +Subject: [PATCH 649/686] include: add no return function attribute + +This warning is repeated 112 times when compiling with all warnings. + +xalloc.h:23:1: warning: function '__err_oom' could be declared with +attribute 'noreturn' [-Wmissing-noreturn] + +Signed-off-by: Sami Kerola +--- + include/xalloc.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/include/xalloc.h b/include/xalloc.h +index 1d225d4..0129a85 100644 +--- a/include/xalloc.h ++++ b/include/xalloc.h +@@ -19,7 +19,8 @@ + # define XALLOC_EXIT_CODE EXIT_FAILURE + #endif + +-static inline void __err_oom(const char *file, unsigned int line) ++static inline void __attribute__((__noreturn__)) ++__err_oom(const char *file, unsigned int line) + { + err(XALLOC_EXIT_CODE, "%s: %u: cannot allocate memory", file, line); + } +-- +1.8.3.1 + diff --git a/last-fix-false-positive-compiler-warning.patch b/last-fix-false-positive-compiler-warning.patch new file mode 100644 index 0000000..08684b5 --- /dev/null +++ b/last-fix-false-positive-compiler-warning.patch @@ -0,0 +1,38 @@ +From e4077e0e445ddc8d81e4fbab599655bb48ac130a Mon Sep 17 00:00:00 2001 +From: Sami Kerola +Date: Thu, 3 May 2018 22:57:59 +0100 +Subject: [PATCH 105/686] last: fix false positive compiler warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +login-utils/last.c: In function ‘list’: +login-utils/last.c:398:36: warning: argument to ‘sizeof’ in ‘strncat’ call +is the same expression as the source; did you mean to use the size of the +destination? [-Wsizeof-pointer-memaccess] + strncat(utline, p->ut_line, sizeof(p->ut_line)); + +The sizeof(utline) is defined as sizeof(p->ut_line) + 1, so the compiler got +that wrong. Lets truncate strncat() otherway around to keep gcc 8.1 happy. + +Signed-off-by: Sami Kerola +--- + login-utils/last.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/login-utils/last.c b/login-utils/last.c +index 80d77d2..59dfdb2 100644 +--- a/login-utils/last.c ++++ b/login-utils/last.c +@@ -395,7 +395,7 @@ static int list(const struct last_control *ctl, struct utmpx *p, time_t logout_t + * uucp and ftp have special-type entries + */ + utline[0] = 0; +- strncat(utline, p->ut_line, sizeof(p->ut_line)); ++ strncat(utline, p->ut_line, sizeof(utline) - 1); + if (strncmp(utline, "ftp", 3) == 0 && isdigit(utline[3])) + utline[3] = 0; + if (strncmp(utline, "uucp", 4) == 0 && isdigit(utline[4])) +-- +1.8.3.1 + diff --git a/last-fix-wtmp-user-name-buffer-overflow-asan.patch b/last-fix-wtmp-user-name-buffer-overflow-asan.patch new file mode 100644 index 0000000..ecbc439 --- /dev/null +++ b/last-fix-wtmp-user-name-buffer-overflow-asan.patch @@ -0,0 +1,29 @@ +From b22332dd4f0042e9fc7248aa918b991d684d8f28 Mon Sep 17 00:00:00 2001 +From: Sami Kerola +Date: Sun, 13 Jan 2019 19:48:59 +0000 +Subject: [PATCH 590/686] last: fix wtmp user name buffer overflow [asan] + +Ensure utmp user name field is null terminated. Without that getpwnam() can +buffer overflow, when wtmp file is malformed. + +Addresses: https://github.com/karelzak/util-linux/issues/715 +Signed-off-by: Sami Kerola +--- + login-utils/last.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/login-utils/last.c b/login-utils/last.c +index 6b25efd..be744b0 100644 +--- a/login-utils/last.c ++++ b/login-utils/last.c +@@ -600,6 +600,7 @@ static int is_phantom(const struct last_control *ctl, struct utmpx *ut) + + if (ut->ut_tv.tv_sec < ctl->boot_time.tv_sec) + return 1; ++ ut->ut_user[__UT_NAMESIZE - 1] = '\0'; + pw = getpwnam(ut->ut_user); + if (!pw) + return 1; +-- +1.8.3.1 + diff --git a/lib-canonicalize-fix-truncation-warning.patch b/lib-canonicalize-fix-truncation-warning.patch new file mode 100644 index 0000000..510c0e8 --- /dev/null +++ b/lib-canonicalize-fix-truncation-warning.patch @@ -0,0 +1,74 @@ +From bf99940f649959fcc73590c043d28b1ab0d83e1c Mon Sep 17 00:00:00 2001 +From: Sami Kerola +Date: Thu, 3 May 2018 22:57:57 +0100 +Subject: [PATCH 103/686] lib/canonicalize: fix truncation warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +lib/canonicalize.c: In function ‘canonicalize_dm_name’: +lib/canonicalize.c:42:45: warning: ‘%s’ directive output may be truncated +writing up to 255 bytes into a region of size 244 [-Wformat-truncation=] + snprintf(path, sizeof(path), "/dev/mapper/%s", name); + +Notice that this warnign fix does not improve code enormously. The earlier +snprintf() truncation will not happen a bit earlier when fgets() is called. +In that sense this change merely makes one easy to silence warning to +disappear, and therefore improve change of noticing useful messaging as such +crops up. + +[kzak@redhat.com: - use macro rather than hardcoded string for mapper path] + +Signed-off-by: Sami Kerola +Signed-off-by: Karel Zak +--- + include/pathnames.h | 2 ++ + lib/canonicalize.c | 5 +++-- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/include/pathnames.h b/include/pathnames.h +index 59cc667..abf0cde 100644 +--- a/include/pathnames.h ++++ b/include/pathnames.h +@@ -131,6 +131,8 @@ + # define _PATH_DEV "/dev/" + #endif + ++#define _PATH_DEV_MAPPER "/dev/mapper" ++ + #define _PATH_DEV_MEM "/dev/mem" + + #define _PATH_DEV_LOOP "/dev/loop" +diff --git a/lib/canonicalize.c b/lib/canonicalize.c +index b600248..ef3342b 100644 +--- a/lib/canonicalize.c ++++ b/lib/canonicalize.c +@@ -16,6 +16,7 @@ + #include + + #include "canonicalize.h" ++#include "pathnames.h" + + /* + * Converts private "dm-N" names to "/dev/mapper/" +@@ -27,7 +28,7 @@ char *canonicalize_dm_name(const char *ptname) + { + FILE *f; + size_t sz; +- char path[256], name[256], *res = NULL; ++ char path[256], name[sizeof(path) - sizeof(_PATH_DEV_MAPPER)], *res = NULL; + + if (!ptname || !*ptname) + return NULL; +@@ -39,7 +40,7 @@ char *canonicalize_dm_name(const char *ptname) + /* read "\n" from sysfs */ + if (fgets(name, sizeof(name), f) && (sz = strlen(name)) > 1) { + name[sz - 1] = '\0'; +- snprintf(path, sizeof(path), "/dev/mapper/%s", name); ++ snprintf(path, sizeof(path), _PATH_DEV_MAPPER "/%s", name); + + if (access(path, F_OK) == 0) + res = strdup(path); +-- +1.8.3.1 + diff --git a/lib-pager-fix-compiler-warning-Wrestrict.patch b/lib-pager-fix-compiler-warning-Wrestrict.patch new file mode 100644 index 0000000..bc7b584 --- /dev/null +++ b/lib-pager-fix-compiler-warning-Wrestrict.patch @@ -0,0 +1,39 @@ +From 3b6ca044daf6a86c650b841c4005b2b6e68453fa Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Wed, 18 Jul 2018 09:41:46 +0200 +Subject: [PATCH 273/686] lib/pager: fix compiler warning [-Wrestrict] +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +lib/pager.c: In function ‘pager_preexec’: +lib/pager.c:148:12: warning: passing argument 2 to restrict-qualified parameter aliases with argument 4 [-Wrestrict] + +Signed-off-by: Karel Zak +--- + lib/pager.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/lib/pager.c b/lib/pager.c +index 9740c71..b3cf6ee 100644 +--- a/lib/pager.c ++++ b/lib/pager.c +@@ -141,11 +141,13 @@ static void pager_preexec(void) + * Work around bug in "less" by not starting it until we + * have real input + */ +- fd_set in; ++ fd_set in, ex; + + FD_ZERO(&in); + FD_SET(STDIN_FILENO, &in); +- select(1, &in, NULL, &in, NULL); ++ ex = in; ++ ++ select(STDIN_FILENO + 1, &in, NULL, &ex, NULL); + + if (setenv("LESS", "FRSX", 0) != 0) + warn(_("failed to set the %s environment variable"), "LESS"); +-- +1.8.3.1 + diff --git a/libblkid-Fix-hidding-typo.patch b/libblkid-Fix-hidding-typo.patch new file mode 100644 index 0000000..e73d1a1 --- /dev/null +++ b/libblkid-Fix-hidding-typo.patch @@ -0,0 +1,28 @@ +From b7fb72090b2d02baf86480b11346f41627291372 Mon Sep 17 00:00:00 2001 +From: Andreas Henriksson +Date: Mon, 12 Nov 2018 20:50:23 +0100 +Subject: [PATCH 479/686] libblkid: Fix hidding typo + +Spelling error spotted by lintian. + +Signed-off-by: Andreas Henriksson +--- + libblkid/src/probe.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c +index 081f882..96aecf3 100644 +--- a/libblkid/src/probe.c ++++ b/libblkid/src/probe.c +@@ -625,7 +625,7 @@ static int hide_buffer(blkid_probe pr, uint64_t off, uint64_t len) + + data = real_off ? x->data + (real_off - x->off) : x->data; + +- DBG(BUFFER, ul_debug("\thidding: off=%"PRIu64" len=%"PRIu64, ++ DBG(BUFFER, ul_debug("\thiding: off=%"PRIu64" len=%"PRIu64, + off, len)); + memset(data, 0, len); + ct++; +-- +1.8.3.1 + diff --git a/libblkid-fix-detection-of-dm-integrity-superblock.patch b/libblkid-fix-detection-of-dm-integrity-superblock.patch new file mode 100644 index 0000000..6e0df5b --- /dev/null +++ b/libblkid-fix-detection-of-dm-integrity-superblock.patch @@ -0,0 +1,29 @@ +From 1741d2ea572be01899107bd171d4e8a3e50c73d9 Mon Sep 17 00:00:00 2001 +From: Milan Broz +Date: Wed, 7 Nov 2018 12:48:37 +0100 +Subject: [PATCH 466/686] libblkid: fix detection of dm-integrity superblock + +Some new features in Linux kernel 4.19 for dm-integrity use metadata +format version 2, patch adds it to detection. + +Signed-off-by: Milan Broz +--- + libblkid/src/superblocks/lvm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libblkid/src/superblocks/lvm.c b/libblkid/src/superblocks/lvm.c +index 17731a8..c7e456f 100644 +--- a/libblkid/src/superblocks/lvm.c ++++ b/libblkid/src/superblocks/lvm.c +@@ -193,7 +193,7 @@ static int probe_integrity(blkid_probe pr, const struct blkid_idmag *mag) + if (sb == NULL) + return errno ? -errno : 1; + +- if (sb->version != 1) ++ if (sb->version !=1 && sb->version != 2) + return 1; + + blkid_probe_sprintf_version(pr, "%u", sb->version); +-- +1.8.3.1 + diff --git a/libblkid-ntfs-fix-compiler-warning-Wpedantic.patch b/libblkid-ntfs-fix-compiler-warning-Wpedantic.patch new file mode 100644 index 0000000..78cb40f --- /dev/null +++ b/libblkid-ntfs-fix-compiler-warning-Wpedantic.patch @@ -0,0 +1,46 @@ +From 9b13b5602e16f719934b29d5efbf5a3aacf9832c Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Wed, 2 Jan 2019 14:44:59 +0100 +Subject: [PATCH 574/686] libblkid: (ntfs) fix compiler warning [-Wpedantic] + +libblkid/src/superblocks/ntfs.c:80:2: warning: ISO C restricts enumerator +values to range of 'int' (4294967295 is too large) [-Wpedantic] + +Addressed: https://github.com/karelzak/util-linux/pull/732 +Signed-off-by: Karel Zak +--- + libblkid/src/superblocks/ntfs.c | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/libblkid/src/superblocks/ntfs.c b/libblkid/src/superblocks/ntfs.c +index 3297309..5ea2a45 100644 +--- a/libblkid/src/superblocks/ntfs.c ++++ b/libblkid/src/superblocks/ntfs.c +@@ -75,10 +75,8 @@ struct file_attribute { + /* Windows 10 Creators edition has extended the cluster size limit to 2MB */ + #define NTFS_MAX_CLUSTER_SIZE (2 * 1024 * 1024) + +-enum { +- MFT_RECORD_ATTR_VOLUME_NAME = 0x60, +- MFT_RECORD_ATTR_END = 0xffffffff +-}; ++#define MFT_RECORD_ATTR_VOLUME_NAME 0x60 ++#define MFT_RECORD_ATTR_END 0xffffffff + + static int probe_ntfs(blkid_probe pr, const struct blkid_idmag *mag) + { +@@ -190,9 +188,9 @@ static int probe_ntfs(blkid_probe pr, const struct blkid_idmag *mag) + if (!attr_len) + break; + +- if (le32_to_cpu(attr->type) == MFT_RECORD_ATTR_END) ++ if (le32_to_cpu(attr->type) == (uint32_t) MFT_RECORD_ATTR_END) + break; +- if (le32_to_cpu(attr->type) == MFT_RECORD_ATTR_VOLUME_NAME) { ++ if (le32_to_cpu(attr->type) == (uint32_t) MFT_RECORD_ATTR_VOLUME_NAME) { + unsigned int val_off = le16_to_cpu(attr->value_offset); + unsigned int val_len = le32_to_cpu(attr->value_len); + unsigned char *val = ((uint8_t *) attr) + val_off; +-- +1.8.3.1 + diff --git a/libfdisk-Fix-multipath-partition-seperators-for-user.patch b/libfdisk-Fix-multipath-partition-seperators-for-user.patch new file mode 100644 index 0000000..736a109 --- /dev/null +++ b/libfdisk-Fix-multipath-partition-seperators-for-user.patch @@ -0,0 +1,61 @@ +From 73775189767195f1d9f5b6b6f6a54e51f61c4356 Mon Sep 17 00:00:00 2001 +From: KyleMahlkuch +Date: Mon, 25 Jun 2018 14:52:01 -0500 +Subject: [PATCH 262/686] libfdisk: Fix multipath partition seperators for + user-friendly names + +The current code assumes "-part" is the only partition sepereator +but this is not true for some distros. + +For example in Ubuntu 18.04 fdisk does not print the correct names for +mpatha: + +~# ls -l /dev/mapper/mpatha* +lrwxrwxrwx 1 root root 7 Feb 1 04:39 /dev/mapper/mpatha -> ../dm-0 +lrwxrwxrwx 1 root root 7 Feb 1 04:38 /dev/mapper/mpatha1 -> ../dm-4 +lrwxrwxrwx 1 root root 7 Feb 1 04:38 /dev/mapper/mpatha2 -> ../dm-5 +lrwxrwxrwx 1 root root 7 Feb 1 04:38 /dev/mapper/mpatha3 -> ../dm-6 + +~# fdisk -l /dev/mapper/mpatha +Device Boot Start End Sectors Size Id Type +/dev/mapper/mpatha-part1 2048 419432447 419430400 200G 83 Linux +/dev/mapper/mpatha-part2 419432448 838862847 419430400 200G 83 Linux +/dev/mapper/mpatha-part3 838862848 1258291199 419428352 200G 83 Linux + +Instead of assuming a partition seperator of "-part" this patch uses +access to check the file system for a partition seperator of "p" or +the absense of a partition seperator. If neither of these work the patch +defaults to "-part" like we had before this patch. +--- + libfdisk/src/utils.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/libfdisk/src/utils.c b/libfdisk/src/utils.c +index 5ba9e04..54e28b2 100644 +--- a/libfdisk/src/utils.c ++++ b/libfdisk/src/utils.c +@@ -153,7 +153,20 @@ char *fdisk_partname(const char *dev, size_t partno) + if ((strncmp(dev, _PATH_DEV_BYID, sizeof(_PATH_DEV_BYID) - 1) == 0) || + strncmp(dev, _PATH_DEV_BYPATH, sizeof(_PATH_DEV_BYPATH) - 1) == 0 || + strncmp(dev, "/dev/mapper", sizeof("/dev/mapper") - 1) == 0) { +- p = "-part"; ++ asprintf(&res, "%.*s%zu", w, dev, partno); ++ if (access(res, F_OK) == 0){ ++ p = ""; ++ } else { ++ /* check for partition seperator "p" */ ++ p = "p"; ++ free(res); ++ asprintf(&res, "%.*s%s%zu", w, dev, p, partno); ++ if (access(res, F_OK) != 0){ ++ /* otherwise, default to "-path" */ ++ p = "-part"; ++ } ++ } ++ free(res); + } + + if (asprintf(&res, "%.*s%s%zu", w, dev, p, partno) <= 0) +-- +1.8.3.1 + diff --git a/libfdisk-fix-compiler-warning-Wmaybe-uninitialized.patch b/libfdisk-fix-compiler-warning-Wmaybe-uninitialized.patch new file mode 100644 index 0000000..ccd2fc1 --- /dev/null +++ b/libfdisk-fix-compiler-warning-Wmaybe-uninitialized.patch @@ -0,0 +1,36 @@ +From b9144a43c03d8ed961c889d9bd113838ac8643ea Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Wed, 18 Jul 2018 10:00:18 +0200 +Subject: [PATCH 277/686] libfdisk: fix compiler warning + [-Wmaybe-uninitialized] + +Signed-off-by: Karel Zak +--- + libfdisk/src/gpt.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c +index aa544f6..4d34ca7 100644 +--- a/libfdisk/src/gpt.c ++++ b/libfdisk/src/gpt.c +@@ -945,7 +945,7 @@ static ssize_t read_lba(struct fdisk_context *cxt, uint64_t lba, + static unsigned char *gpt_read_entries(struct fdisk_context *cxt, + struct gpt_header *header) + { +- size_t sz; ++ size_t sz = 0; + ssize_t ssz; + + unsigned char *ret = NULL; +@@ -1971,7 +1971,7 @@ static int gpt_write_partitions(struct fdisk_context *cxt, + struct gpt_header *header, unsigned char *ents) + { + off_t offset = (off_t) le64_to_cpu(header->partition_entry_lba) * cxt->sector_size; +- size_t towrite; ++ size_t towrite = 0; + ssize_t ssz; + int rc; + +-- +1.8.3.1 + diff --git a/libuuid-fix-name-based-UUIDs.patch b/libuuid-fix-name-based-UUIDs.patch new file mode 100644 index 0000000..835f5cc --- /dev/null +++ b/libuuid-fix-name-based-UUIDs.patch @@ -0,0 +1,113 @@ +From d6ddf07d31dfdc894eb8e7e6842aa856342c526e Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Fri, 31 Aug 2018 12:27:32 +0200 +Subject: [PATCH 369/686] libuuid: fix name-based UUIDs + +The current version is not fully compatible with RFC4122. It +incorrectly encodes UUID variant + + xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx + +where M is UUID version and N is UUID variant. + + $ python -c "import uuid ; print(uuid.uuid5(uuid.UUID(int=0), 'foo'))" + aa752cea-8222-5bc8-acd9-555b090c0ccb + ^^ + +Old version: + + $ uuidgen --namespace 00000000-0000-0000-0000-000000000000 --name 'foo' --sha1 + aa752cea-8222-5bc8-8cd9-555b090c0ccb + ^^ + +Fixed version: + ./uuidgen --namespace 00000000-0000-0000-0000-000000000000 --name 'foo' --sha1; + aa752cea-8222-5bc8-acd9-555b090c0ccb + ^^ + +The patch uses uuid_unpack and uuid_pack. It makes code more readable +and allow to access proper octens. The same way we already use for +time and random based UUIDs. + +Addresses: https://github.com/karelzak/util-linux/issues/683 +Signed-off-by: Karel Zak +--- + libuuid/src/gen_uuid.c | 34 ++++++++++++++++------------------ + 1 file changed, 16 insertions(+), 18 deletions(-) + +diff --git a/libuuid/src/gen_uuid.c b/libuuid/src/gen_uuid.c +index a374e75..27c135d 100644 +--- a/libuuid/src/gen_uuid.c ++++ b/libuuid/src/gen_uuid.c +@@ -96,9 +96,6 @@ + #define THREAD_LOCAL static + #endif + +-/* index with UUID_VARIANT_xxx and shift 5 bits */ +-static unsigned char variant_bits[] = { 0x00, 0x04, 0x06, 0x07 }; +- + #ifdef _WIN32 + static void gettimeofday (struct timeval *tv, void *dummy) + { +@@ -566,21 +563,22 @@ void uuid_generate_md5(uuid_t out, const uuid_t ns, const char *name, size_t len + { + UL_MD5_CTX ctx; + char hash[UL_MD5LENGTH]; ++ uuid_t buf; ++ struct uuid uu; + + ul_MD5Init(&ctx); +- /* hash concatenation of well-known UUID with name */ + ul_MD5Update(&ctx, ns, sizeof(uuid_t)); + ul_MD5Update(&ctx, (const unsigned char *)name, len); +- + ul_MD5Final((unsigned char *)hash, &ctx); + +- memcpy(out, hash, sizeof(uuid_t)); ++ assert(sizeof(buf) <= sizeof(hash)); + +- out[6] &= ~(UUID_TYPE_MASK << UUID_TYPE_SHIFT); +- out[6] |= (UUID_TYPE_DCE_MD5 << UUID_TYPE_SHIFT); ++ memcpy(buf, hash, sizeof(buf)); ++ uuid_unpack(buf, &uu); + +- out[8] &= ~(UUID_VARIANT_MASK << UUID_VARIANT_SHIFT); +- out[8] |= (variant_bits[UUID_VARIANT_DCE] << UUID_VARIANT_SHIFT); ++ uu.clock_seq = (uu.clock_seq & 0x3FFF) | 0x8000; ++ uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x3000; ++ uuid_pack(&uu, out); + } + + /* +@@ -591,20 +589,20 @@ void uuid_generate_sha1(uuid_t out, const uuid_t ns, const char *name, size_t le + { + UL_SHA1_CTX ctx; + char hash[UL_SHA1LENGTH]; ++ uuid_t buf; ++ struct uuid uu; + + ul_SHA1Init(&ctx); +- /* hash concatenation of well-known UUID with name */ + ul_SHA1Update(&ctx, ns, sizeof(uuid_t)); + ul_SHA1Update(&ctx, (const unsigned char *)name, len); +- + ul_SHA1Final((unsigned char *)hash, &ctx); + +- memcpy(out, hash, sizeof(uuid_t)); ++ assert(sizeof(buf) <= sizeof(hash)); + +- out[6] &= ~(UUID_TYPE_MASK << UUID_TYPE_SHIFT); +- out[6] |= (UUID_TYPE_DCE_SHA1 << UUID_TYPE_SHIFT); ++ memcpy(buf, hash, sizeof(buf)); ++ uuid_unpack(buf, &uu); + +- out[8] &= ~(UUID_VARIANT_MASK << UUID_VARIANT_SHIFT); +- out[8] |= (variant_bits[UUID_VARIANT_DCE] << UUID_VARIANT_SHIFT); ++ uu.clock_seq = (uu.clock_seq & 0x3FFF) | 0x8000; ++ uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x5000; ++ uuid_pack(&uu, out); + } +- +-- +1.8.3.1 + diff --git a/losetup-fix-mem-leak-improve-code-coverity-scan.patch b/losetup-fix-mem-leak-improve-code-coverity-scan.patch new file mode 100644 index 0000000..c0e63ac --- /dev/null +++ b/losetup-fix-mem-leak-improve-code-coverity-scan.patch @@ -0,0 +1,37 @@ +From 9c6af25c31540f8310bb6f4e6dbb5621b89053a3 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Wed, 25 Jul 2018 11:56:44 +0200 +Subject: [PATCH 311/686] losetup: fix mem leak, improve code [coverity scan] + +Signed-off-by: Karel Zak +--- + sys-utils/losetup.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c +index 7525d84..7d14f56 100644 +--- a/sys-utils/losetup.c ++++ b/sys-utils/losetup.c +@@ -141,8 +141,7 @@ static int printf_loopdev(struct loopdev_cxt *lc) + + if (loopcxt_get_sizelimit(lc, &x) == 0 && x) + printf(_(", sizelimit %ju"), x); +- printf("\n"); +- return 0; ++ goto done; + } + + printf("%s: [%04d]:%" PRIu64 " (%s)", +@@ -162,6 +161,9 @@ static int printf_loopdev(struct loopdev_cxt *lc) + if (e && *e) + printf(_(", encryption %s (type %u)"), e, type); + } ++ ++done: ++ free(fname); + printf("\n"); + return 0; + } +-- +1.8.3.1 + diff --git a/lscpu-fix-resource-leak-coverity-scan.patch b/lscpu-fix-resource-leak-coverity-scan.patch new file mode 100644 index 0000000..4163a58 --- /dev/null +++ b/lscpu-fix-resource-leak-coverity-scan.patch @@ -0,0 +1,28 @@ +From d29b7ced3b263ac9eda8a37703be0153ad67e882 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Wed, 25 Jul 2018 12:02:28 +0200 +Subject: [PATCH 312/686] lscpu: fix resource leak [coverity scan] + +Signed-off-by: Karel Zak +--- + sys-utils/lscpu.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c +index 35df21c..7f5a9f9 100644 +--- a/sys-utils/lscpu.c ++++ b/sys-utils/lscpu.c +@@ -795,8 +795,9 @@ read_hypervisor(struct lscpu_desc *desc, struct lscpu_modifier *mod) + else if ((features & XEN_FEATURES_PVH_MASK) + == XEN_FEATURES_PVH_MASK) + desc->virtype = VIRT_PARA; +- fclose(fd); + } ++ if (fd) ++ fclose(fd); + } + } else if (read_hypervisor_powerpc(desc) > 0) {} + +-- +1.8.3.1 + diff --git a/lscpu-fixed-part-ID-for-ARM-Cortex-M7.patch b/lscpu-fixed-part-ID-for-ARM-Cortex-M7.patch new file mode 100644 index 0000000..8afaec6 --- /dev/null +++ b/lscpu-fixed-part-ID-for-ARM-Cortex-M7.patch @@ -0,0 +1,25 @@ +From e6601a70ec4a56e99cb7361bb5d3a9c00072f9d8 Mon Sep 17 00:00:00 2001 +From: Mark Sheppard +Date: Mon, 13 Aug 2018 16:45:01 +0100 +Subject: [PATCH 342/686] lscpu: fixed part ID for ARM Cortex-M7 + +--- + sys-utils/lscpu-arm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sys-utils/lscpu-arm.c b/sys-utils/lscpu-arm.c +index 22a9d6f..37b8f66 100644 +--- a/sys-utils/lscpu-arm.c ++++ b/sys-utils/lscpu-arm.c +@@ -60,7 +60,7 @@ static const struct id_part arm_part[] = { + { 0xc21, "Cortex-M1" }, + { 0xc23, "Cortex-M3" }, + { 0xc24, "Cortex-M4" }, +- { 0xc20, "Cortex-M7" }, ++ { 0xc27, "Cortex-M7" }, + { 0xc60, "Cortex-M0+" }, + { 0xd01, "Cortex-A32" }, + { 0xd03, "Cortex-A53" }, +-- +1.8.3.1 + diff --git a/lslogins-remove-duplicate-NULL-check.patch b/lslogins-remove-duplicate-NULL-check.patch new file mode 100644 index 0000000..7a6a115 --- /dev/null +++ b/lslogins-remove-duplicate-NULL-check.patch @@ -0,0 +1,33 @@ +From a81a48779b858b7ab49fff3ed52dec21a26049a5 Mon Sep 17 00:00:00 2001 +From: Sami Kerola +Date: Mon, 10 Dec 2018 20:41:18 +0000 +Subject: [PATCH 556/686] lslogins: remove duplicate NULL check + +Having this excess NULL check in place causes small performance penalty, and +makes compiler to guess wrong if a null should be checked. To me getting +rid of false positive warning is more useful. + +login-utils/lslogins.c:634:7: warning: potential null pointer dereference +[-Wnull-dereference] + +Signed-off-by: Sami Kerola +--- + login-utils/lslogins.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c +index e2a0d43..280768e 100644 +--- a/login-utils/lslogins.c ++++ b/login-utils/lslogins.c +@@ -623,7 +623,7 @@ static int valid_pwd(const char *str) + return 0; + + /* salt$ */ +- for (; p && *p; p++) { ++ for (; *p; p++) { + if (*p == '$') { + p++; + break; +-- +1.8.3.1 + diff --git a/mkswap-fix-page-size-warning-message.patch b/mkswap-fix-page-size-warning-message.patch new file mode 100644 index 0000000..c8f6f17 --- /dev/null +++ b/mkswap-fix-page-size-warning-message.patch @@ -0,0 +1,26 @@ +From 4850e972572179cef74143a09a03fbe7d745c6d8 Mon Sep 17 00:00:00 2001 +From: Noel Cragg +Date: Thu, 29 Nov 2018 11:38:41 +0100 +Subject: [PATCH 488/686] mkswap: fix page size warning message + +Signed-off-by: Karel Zak +--- + disk-utils/mkswap.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c +index cbb99dc..28a139d 100644 +--- a/disk-utils/mkswap.c ++++ b/disk-utils/mkswap.c +@@ -82,7 +82,7 @@ static void init_signature_page(struct mkswap_control *ctl) + if (ctl->user_pagesize != kernel_pagesize) + warnx(_("Using user-specified page size %d, " + "instead of the system value %d"), +- ctl->pagesize, kernel_pagesize); ++ ctl->user_pagesize, kernel_pagesize); + ctl->pagesize = ctl->user_pagesize; + } else + ctl->pagesize = kernel_pagesize; +-- +1.8.3.1 + diff --git a/rename-prevent-no-act-from-setting-no-overwrite.patch b/rename-prevent-no-act-from-setting-no-overwrite.patch new file mode 100644 index 0000000..14d9b5c --- /dev/null +++ b/rename-prevent-no-act-from-setting-no-overwrite.patch @@ -0,0 +1,58 @@ +From 0849ff36605588a7ab7892ab2aae59d73290e225 Mon Sep 17 00:00:00 2001 +From: "G.raud Meyer" +Date: Thu, 29 Mar 2018 12:58:44 +0200 +Subject: [PATCH 022/686] rename: prevent --no-act from setting --no-overwrite + +This fixes a bug introduced by commit fabb90676 ("Added --no-override +option to rename.", 2017-05-27) where the fallthrough meant to let +--no-act set --verbose was changed to set --no-override (the previous +code was too smart). + +Do not let --no-act set --verbose anymore but update the manual to +recommend adding option --verbose. This is to be able to make --no-act +detect only non existing file arguments (in a future commit). +--- + misc-utils/rename.1 | 4 +++- + misc-utils/rename.c | 8 ++++---- + 2 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/misc-utils/rename.1 b/misc-utils/rename.1 +index d476d24..df32946 100644 +--- a/misc-utils/rename.1 ++++ b/misc-utils/rename.1 +@@ -23,7 +23,9 @@ Do not rename a symlink but its target. + Show which files were renamed, if any. + .TP + .BR \-n , " \-\-no\-act" +-Do not make any changes. ++Do not make any changes; add ++.BR \-\-verbose ++to see what would be made. + .TP + .BR \-o , " \-\-no\-overwrite" + Do not overwrite existing files. When +diff --git a/misc-utils/rename.c b/misc-utils/rename.c +index 1d280ad..147e54f 100644 +--- a/misc-utils/rename.c ++++ b/misc-utils/rename.c +@@ -174,13 +174,13 @@ int main(int argc, char **argv) + switch (c) { + case 'n': + noact = 1; +- /* fallthrough */ +- case 'o': +- nooverwrite = 1; +- break; ++ break; + case 'v': + verbose = 1; + break; ++ case 'o': ++ nooverwrite = 1; ++ break; + case 's': + do_rename = do_symlink; + break; +-- +1.8.3.1 + diff --git a/script-be-sensitive-to-another-SIGCHLD-ssi_codes.patch b/script-be-sensitive-to-another-SIGCHLD-ssi_codes.patch new file mode 100644 index 0000000..c7805f1 --- /dev/null +++ b/script-be-sensitive-to-another-SIGCHLD-ssi_codes.patch @@ -0,0 +1,48 @@ +From 27afe5016842c22d256ea9f88b598d637ca0df84 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Wed, 5 Sep 2018 11:51:22 +0200 +Subject: [PATCH] script: be sensitive to another SIGCHLD ssi_codes + +The current signalfd handler cares on CLD_EXITED only. It's pretty +insufficient as there is more situations (and codes) when child no +more running. + +Addresses: https://github.com/karelzak/util-linux/issues/686 +Signed-off-by: Karel Zak +--- + term-utils/script.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/term-utils/script.c b/term-utils/script.c +index 6d5ddd84a..7692f91e2 100644 +--- a/term-utils/script.c ++++ b/term-utils/script.c +@@ -477,10 +477,15 @@ static void handle_signal(struct script_control *ctl, int fd) + + switch (info.ssi_signo) { + case SIGCHLD: +- DBG(SIGNAL, ul_debug(" get signal SIGCHLD")); +- if (info.ssi_code == CLD_EXITED) { ++ DBG(SIGNAL, ul_debug(" get signal SIGCHLD [ssi_code=%d, ssi_status=%d]", ++ info.ssi_code, info.ssi_status)); ++ if (info.ssi_code == CLD_EXITED ++ || info.ssi_code == CLD_KILLED ++ || info.ssi_code == CLD_DUMPED) { + wait_for_child(ctl, 0); + ctl->poll_timeout = 10; ++ ++ /* In case of ssi_code is CLD_TRAPPED, CLD_STOPPED, or CLD_CONTINUED */ + } else if (info.ssi_status == SIGSTOP && ctl->child) { + DBG(SIGNAL, ul_debug(" child stop by SIGSTOP -- stop parent too")); + kill(getpid(), SIGSTOP); +@@ -508,6 +513,7 @@ static void handle_signal(struct script_control *ctl, int fd) + default: + abort(); + } ++ DBG(SIGNAL, ul_debug("signal handle on FD %d done", fd)); + } + + static void do_io(struct script_control *ctl) +-- +2.19.1 + diff --git a/su-be-sensitive-to-another-SIGCHLD-ssi_codes.patch b/su-be-sensitive-to-another-SIGCHLD-ssi_codes.patch new file mode 100644 index 0000000..cf34701 --- /dev/null +++ b/su-be-sensitive-to-another-SIGCHLD-ssi_codes.patch @@ -0,0 +1,31 @@ +From 5932ef81deb0b823ffa52bc6206cdd3c583bb4e9 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Wed, 6 Mar 2019 12:02:30 +0100 +Subject: [PATCH] su: be sensitive to another SIGCHLD ssi_codes + +See the same issue for script: 27afe5016842c22d256ea9f88b598d637ca0df84 + +Signed-off-by: Karel Zak +--- + login-utils/su-common.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/login-utils/su-common.c b/login-utils/su-common.c +index bf4a47126..1662d21bb 100644 +--- a/login-utils/su-common.c ++++ b/login-utils/su-common.c +@@ -437,7 +437,10 @@ static int pty_handle_signal(struct su_context *su, int fd) + + /* The child terminated or stopped. Note that we ignore SIGCONT + * here, because stop/cont semantic is handled by wait_for_child() */ +- if (info.ssi_code == CLD_EXITED || info.ssi_status == SIGSTOP) ++ if (info.ssi_code == CLD_EXITED ++ || info.ssi_code == CLD_KILLED ++ || info.ssi_code == CLD_DUMPED ++ || info.ssi_status == SIGSTOP) + wait_for_child(su); + /* The child is dead, force poll() timeout. */ + if (su->child == (pid_t) -1) +-- +2.19.1 + diff --git a/util-linux-2.32.1.tar.xz b/util-linux-2.32.1.tar.xz new file mode 100644 index 0000000..2b13622 Binary files /dev/null and b/util-linux-2.32.1.tar.xz differ diff --git a/util-linux-60-raw.rules b/util-linux-60-raw.rules new file mode 100644 index 0000000..abbf79d --- /dev/null +++ b/util-linux-60-raw.rules @@ -0,0 +1,8 @@ +# +# Enter raw device bindings here. +# +# An example would be: +# ACTION=="add", KERNEL=="sda", RUN+="/usr/bin/raw /dev/raw/raw1 %N" +# to bind /dev/raw/raw1 to /dev/sda, or +# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/usr/bin/raw /dev/raw/raw2 %M %m" +# to bind /dev/raw/raw2 to the device with major 8, minor 1. diff --git a/util-linux-chsh-chfn.pamd b/util-linux-chsh-chfn.pamd new file mode 100644 index 0000000..2dbc0aa --- /dev/null +++ b/util-linux-chsh-chfn.pamd @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth include system-auth +account include system-auth +password include system-auth +session include system-auth diff --git a/util-linux-login.pamd b/util-linux-login.pamd new file mode 100644 index 0000000..98e30d7 --- /dev/null +++ b/util-linux-login.pamd @@ -0,0 +1,17 @@ +#%PAM-1.0 +auth substack system-auth +auth include postlogin +account required pam_nologin.so +account include system-auth +password include system-auth +# pam_selinux.so close should be the first session rule +session required pam_selinux.so close +session required pam_loginuid.so +session optional pam_console.so +# pam_selinux.so open should only be followed by sessions to be executed in the user context +session required pam_selinux.so open +session required pam_namespace.so +session optional pam_keyinit.so force revoke +session include system-auth +session include postlogin +-session optional pam_ck_connector.so diff --git a/util-linux-remote.pamd b/util-linux-remote.pamd new file mode 100644 index 0000000..100ec98 --- /dev/null +++ b/util-linux-remote.pamd @@ -0,0 +1,15 @@ +#%PAM-1.0 +auth substack password-auth +auth include postlogin +account required pam_nologin.so +account include password-auth +password include password-auth +# pam_selinux.so close should be the first session rule +session required pam_selinux.so close +session required pam_loginuid.so +# pam_selinux.so open should only be followed by sessions to be executed in the user context +session required pam_selinux.so open +session required pam_namespace.so +session optional pam_keyinit.so force revoke +session include password-auth +session include postlogin diff --git a/util-linux-runuser-l.pamd b/util-linux-runuser-l.pamd new file mode 100644 index 0000000..7a9a48c --- /dev/null +++ b/util-linux-runuser-l.pamd @@ -0,0 +1,5 @@ +#%PAM-1.0 +auth include runuser +session optional pam_keyinit.so force revoke +-session optional pam_systemd.so +session include runuser diff --git a/util-linux-runuser.pamd b/util-linux-runuser.pamd new file mode 100644 index 0000000..37f0e84 --- /dev/null +++ b/util-linux-runuser.pamd @@ -0,0 +1,5 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +session optional pam_keyinit.so revoke +session required pam_limits.so +session required pam_unix.so diff --git a/util-linux-su-l.pamd b/util-linux-su-l.pamd new file mode 100644 index 0000000..656a139 --- /dev/null +++ b/util-linux-su-l.pamd @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth include su +account include su +password include su +session optional pam_keyinit.so force revoke +session include su diff --git a/util-linux-su.pamd b/util-linux-su.pamd new file mode 100644 index 0000000..030657f --- /dev/null +++ b/util-linux-su.pamd @@ -0,0 +1,14 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +# Uncomment the following line to implicitly trust users in the "wheel" group. +#auth sufficient pam_wheel.so trust use_uid +# Uncomment the following line to require a user to be in the "wheel" group. +#auth required pam_wheel.so use_uid +auth substack system-auth +auth include postlogin +account sufficient pam_succeed_if.so uid = 0 use_uid quiet +account include system-auth +password include system-auth +session include system-auth +session include postlogin +session optional pam_xauth.so diff --git a/util-linux.spec b/util-linux.spec new file mode 100644 index 0000000..92307e6 --- /dev/null +++ b/util-linux.spec @@ -0,0 +1,305 @@ +%define compldir %{_datadir}/bash-completion/completions/ +%define _pre_version__ 2.32 + +Name: util-linux +Version: %{_pre_version__}.1 +Release: 2 +Summary: A random collection of Linux utilities +License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain +URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git +Source0: https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v%{_pre_version__}/%{name}-%{version}.tar.xz +Source1: util-linux-login.pamd +Source2: util-linux-remote.pamd +Source3: util-linux-chsh-chfn.pamd +Source4: util-linux-60-raw.rules +Source5: adjtime +Source6: util-linux-su.pamd +Source7: util-linux-su-l.pamd +Source8: util-linux-runuser.pamd +Source9: util-linux-runuser-l.pamd + +BuildRequires: audit-libs-devel >= 1.0.6 gettext-devel libselinux-devel ncurses-devel pam-devel zlib-devel popt-devel +BuildRequires: libutempter-devel systemd-devel systemd libuser-devel libcap-ng-devel python-devel gcc gdb + +Requires: coreutils pam >= 1.1.3-7, /etc/pam.d/system-auth audit-libs >= 1.0.6 libuser +Requires: libblkid = %{version}-%{release} libmount = %{version}-%{release} libsmartcols = %{version}-%{release} +Requires: libfdisk = %{version}-%{release} libuuid = %{version}-%{release} systemd systemd-units shadow-utils + +Conflicts: initscripts < 9.79-4 bash-completion < 1:2.1-1 coreutils < 8.20 sysvinit-tools < 2.88-14 +Conflicts: e2fsprogs < 1.41.8-5 filesystem < 3 + +Provides: eject = 2.1.6 rfkill = 0.5 +Provides: util-linux-ng = %{version}-%{release} +Provides: /bin/dmesg /bin/kill /bin/more /bin/mount /bin/umount /sbin/blkid +Provides: /sbin/blockdev /sbin/findfs /sbin/fsck /sbin/nologin +Provides: libfdisk libsmartcols libmount libblkid libuuid uuidd util-linux-user +Obsoletes: libsmartcols libfdisk libmount libblkid libuuid uuidd util-linux-user +Obsoletes: eject <= 2.1.5 rfkill <= 0.5 util-linux-ng < 2.19 + +Patch0000: 2.28-login-lastlog-create.patch + +Patch6000: rename-prevent-no-act-from-setting-no-overwrite.patch +Patch6001: bash-completion-fix-few-bash-set-u-issues.patch +Patch6002: bash-completion-fix-typo-in-blockdev-file.patch +Patch6003: fdisk-fix-typo-in-debug-string.patch +Patch6004: lib-canonicalize-fix-truncation-warning.patch +Patch6005: zramctl-fix-truncation-warning.patch +Patch6006: last-fix-false-positive-compiler-warning.patch +Patch6007: libfdisk-Fix-multipath-partition-seperators-for-user.patch +Patch6008: lib-pager-fix-compiler-warning-Wrestrict.patch +Patch6009: libfdisk-fix-compiler-warning-Wmaybe-uninitialized.patch +Patch6010: losetup-fix-mem-leak-improve-code-coverity-scan.patch +Patch6011: lscpu-fix-resource-leak-coverity-scan.patch +Patch6012: lscpu-fixed-part-ID-for-ARM-Cortex-M7.patch +Patch6013: libuuid-fix-name-based-UUIDs.patch +Patch6014: fallocate-add-missing-semicolon.patch +Patch6015: blkzone-fix-report-zones-sector-offset-check.patch +Patch6016: libblkid-fix-detection-of-dm-integrity-superblock.patch +Patch6017: fix-a-bug-where-switch_root-would-erroneously-try-to.patch +Patch6018: libblkid-Fix-hidding-typo.patch +Patch6019: mkswap-fix-page-size-warning-message.patch +Patch6020: lslogins-remove-duplicate-NULL-check.patch +Patch6021: hexdump-fix-potential-null-pointer-dereference-warni.patch +Patch6022: chmem-add-initilizer-clang.patch +Patch6023: libblkid-ntfs-fix-compiler-warning-Wpedantic.patch +Patch6024: last-fix-wtmp-user-name-buffer-overflow-asan.patch +Patch6025: various-fix-uninitialized-when-used-warnings-clang.patch +Patch6026: include-add-no-return-function-attribute.patch +Patch6027: agetty-Fix-input-of-non-ASCII-characters-in-get_logn.patch +Patch6028: script-be-sensitive-to-another-SIGCHLD-ssi_codes.patch +Patch6029: su-be-sensitive-to-another-SIGCHLD-ssi_codes.patch + +%description +The util-linux package contains a random collection of files that +implements some low-level basic linux utilities. + + +%package devel +Summary: Development package for ${name} +License: LGPLv2+ +Requires: %{name} = %{version}-%{release} pkgconfig +Provides: libfdisk-devel libsmartcols-devel libmount-devel libblkid-devel libuuid-devel +Obsoletes: libfdisk-devel libsmartcols-devel libmount-devel libblkid-devel libuuid-devel + +%description devel +This package contains some library and other necessary files for the +development of %{name}. + +%package -n python-libmount +Summary: Python Package for the libmount library pack +Requires: libmount = %{version}-%{release} +License: LGPLv2+ + +%description -n python-libmount +This package provides python support for users to use the libmount library +to work with mount tables and mount filesystems. + +%package help +Summary: Help package for ${name} +BuildArch: noarch +Requires: %{name} = %{version}-%{release} + +%description help +This package contains some doc and man help files for %{name}. + +%prep +%autosetup -n %{name}-%{version} -p1 + +%build +%define _build_arg0__ CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 $RPM_OPT_FLAGS" SUID_CFLAGS="-fpie" +%define _build_arg1__ SUID_LDFLAGS="-pie -Wl,-z,relro -Wl,-z,now" DAEMON_CFLAGS="$SUID_CFLAGS" DAEMON_LDFLAGS="$SUID_LDFLAGS" + +unset LINGUAS || : +%configure \ + --with-systemdsystemunitdir=%{_unitdir} \ + --disable-silent-rules \ + --disable-bfs \ + --disable-pg \ + --enable-chfn-chsh \ + --enable-usrdir-path \ + --enable-write \ + --enable-raw \ + --with-python=2 \ + --with-systemd \ + --with-udev \ + --with-selinux \ + --with-audit \ + --with-utempter \ + --disable-makeinstall-chown + +%make_build %{_build_arg0__} %{_build_arg1__} + +%check +%if %{?_with_check:1}%{!?_with_check:0} +make check +%endif + +%install +%make_install + +install -d %{buildroot}%{_sysconfdir}/pam.d +install -d %{buildroot}{/run/uuidd,/var/lib/libuuid,/var/log} + +mv %{buildroot}%{_sbindir}/raw %{buildroot}%{_bindir}/raw +install -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/pam.d/login +install -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/pam.d/remote +install -m644 %{SOURCE3} %{buildroot}%{_sysconfdir}/pam.d/chsh +install -m644 %{SOURCE3} %{buildroot}%{_sysconfdir}/pam.d/chfn +install -Dm644 %{SOURCE4} %{buildroot}%{_prefix}/lib/udev/rules.d/60-raw.rules +install -m644 %{SOURCE5} %{buildroot}%{_sysconfdir}/adjtime +install -m644 %{SOURCE6} %{buildroot}%{_sysconfdir}/pam.d/su +install -m644 %{SOURCE7} %{buildroot}%{_sysconfdir}/pam.d/su-l +install -m644 %{SOURCE8} %{buildroot}%{_sysconfdir}/pam.d/runuser +install -m644 %{SOURCE9} %{buildroot}%{_sysconfdir}/pam.d/runuser-l + +ln -sf hwclock %{buildroot}%{_sbindir}/clock +ln -sf ../proc/self/mounts %{buildroot}/etc/mtab + +touch %{buildroot}/var/log/lastlog +chmod 0644 %{buildroot}/var/log/lastlog + +echo ".so man8/raw.8" > %{buildroot}%{_mandir}/man8/rawdevices.8 +echo ".so man8/hwclock.8" > %{buildroot}%{_mandir}/man8/clock.8 + +%find_lang %name + +find %{buildroot}%{_bindir}/ -regextype posix-egrep -type l \ + -regex ".*(linux32|linux64|aarch64|i386|x86_64|uname26)$" \ + -printf "%{_bindir}/%f\n" > %{name}.files +cat %{name}.lang >> %{name}.files + +find %{buildroot}%{_mandir}/man8 -regextype posix-egrep \ + -regex ".*(linux32|linux64|aarch64|i386|x86_64|uname26)\.8.*" \ + -printf "%{_mandir}/man8/%f*\n" > %{name}-help.files + +rm -rf %{buildroot}%{_libdir}/*.{la,a} +rm -rf %{buildroot}%{_libdir}/python*/site-packages/*.{la,a} + +%pre +getent group uuidd >/dev/null || groupadd -r uuidd +getent passwd uuidd >/dev/null || \ +useradd -r -g uuidd -d /var/lib/libuuid -s /sbin/nologin \ + -c "UUID generator helper daemon" uuidd +exit 0 + +%post +/sbin/ldconfig +[ -d /var/log ] || mkdir -p /var/log + +touch /var/log/lastlog +chown root:root /var/log/lastlog +chmod 0644 /var/log/lastlog + +if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled +then + SECXT=`/usr/sbin/matchpathcon -n /var/log/lastlog 2> /dev/null` + if [ -n "$SECXT" ] + then + /usr/bin/chcon "$SECXT" /var/log/lastlog >/dev/null 2>&1 || : + fi +fi +if [ ! -L /etc/mtab ] +then + ln -sf ../proc/self/mounts /etc/mtab || : +fi + +[ -d /run/blkid ] || mkdir -p /run/blkid +for i in /etc/blkid.tab /etc/blkid.tab.old \ + /etc/blkid/blkid.tab /etc/blkid/blkid.tab.old +do + if [ -f "${i}" ] + then + mv "${i}" /run/blkid/ || : + fi +done + +%systemd_post uuidd +if [ $1 -eq 1 ] +then + /bin/systemctl start uuidd > /dev/null 2>&1 || : +fi + +%preun +%systemd_preun uuidd + +%postun +/sbin/ldconfig +%systemd_postun_with_restart uuidd + +%files -f %{name}.files +%exclude %{compldir}/{mount,umount} +%doc AUTHORS libblkid/COPYING +%{!?_licensedir:%global license %%doc} +%license Documentation/licenses/* {libfdisk,libsmartcols,libmount,libuuid}/COPYING +%config(noreplace) %{_sysconfdir}/pam.d/{login,remote,su,su-l,runuser,runuser-l,chfn,chsh} +%config(noreplace) %{_prefix}/lib/udev/rules.d/60-raw.rules +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/adjtime +%dir %attr(2775, uuidd, uuidd) /var/lib/libuuid +%dir %attr(2775, uuidd, uuidd) /run/uuidd +%attr(4755,root,root) %{_bindir}/mount +%attr(4755,root,root) %{_bindir}/umount +%attr(4755,root,root) %{_bindir}/su +%attr(755,root,root) %{_bindir}/login +%attr(2755,root,tty) %{_bindir}/write +%attr(4711,root,root) %{_bindir}/chfn +%attr(4711,root,root) %{_bindir}/chsh +%ghost %attr(0644,root,root) %verify(not md5 size mtime) /var/log/lastlog +%ghost %verify(not md5 size mtime) %config(noreplace,missingok) /etc/mtab +%{_unitdir}/{fstrim.*,uuidd.*} +%{_libdir}/{libfdisk.so.*,libsmartcols.so.*,libmount.so.*,libblkid.so.*,libuuid.so.*} +%{_bindir}/{cal,chrt,col,colcrt,colrm,column,chmem,dmesg,eject,fallocate,fincore,findmnt} +%{_bindir}/{flock,getopt,hexdump,ionice,ipcmk,ipcrm,ipcs,isosize,kill,last,lastb,logger} +%{_bindir}/{look,lsblk,lscpu,lsipc,lslocks,lslogins,lsmem,lsns,mcookie,mesg,more,mountpoint} +%{_bindir}/{namei,nsenter,prlimit,raw,rename,renice,rev,script,scriptreplay,setarch,setpriv} +%{_bindir}/{setsid,setterm,taskset,ul,unshare,utmpdump,uuidgen,uuidparse,wall,wdctl,whereis} +%{_sbindir}/{addpart,agetty,blkdiscard,blkid,blkzone,blockdev,chcpu,ctrlaltdel,delpart,fdisk} +%{_sbindir}/{findfs,fsck,fsck.cramfs,fsck.minix,fsfreeze,fstrim,ldattach,losetup,mkfs,mkfs.cramfs} +%{_sbindir}/{mkfs.minix,mkswap,nologin,partx,pivot_root,readprofile,resizepart,rfkill,rtcwake} +%{_sbindir}/{runuser,sulogin,swaplabel,swapoff,swapon,switch_root,wipefs,zramctl} +%{_sbindir}/{clock,fdformat,hwclock,cfdisk,sfdisk,uuidd} +%{compldir}/{addpart,blkdiscard,blkid,blkzone,blockdev,cal,chcpu,chmem,chrt,col} +%{compldir}/{colcrt,colrm,column,ctrlaltdel,delpart,dmesg,eject,fallocate,fdisk} +%{compldir}/{fincore,findfs,findmnt,flock,fsck,fsck.cramfs,fsck.minix,fsfreeze} +%{compldir}/{fstrim,getopt,hexdump,ionice,ipcmk,ipcrm,ipcs,isosize,last,ldattach} +%{compldir}/{logger,look,losetup,lsblk,lscpu,lsipc,lslocks,lslogins,lsmem,lsns} +%{compldir}/{mcookie,mesg,mkfs,mkfs.cramfs,mkfs.minix,mkswap,more,mountpoint} +%{compldir}/{namei,nsenter,partx,pivot_root,prlimit,raw,readprofile,rename,renice} +%{compldir}/{resizepart,rev,rfkill,rtcwake,runuser,script,scriptreplay,setarch} +%{compldir}/{setpriv,setsid,setterm,su,swaplabel,swapoff,swapon,taskset,ul,unshare} +%{compldir}/{utmpdump,uuidgen,uuidparse,wall,wdctl,whereis,wipefs,write,zramctl} +%{compldir}/{fdformat,hwclock,cfdisk,sfdisk,chfn,chsh,uuidd} + +%files devel +%{_includedir}/{libfdisk,libsmartcols,uuid,blkid,libmount} +%{_libdir}/{libfdisk.so,libsmartcols.so,libuuid.so,libblkid.so,libmount.so} +%{_libdir}/pkgconfig/{fdisk.pc,smartcols.pc,uuid.pc,blkid.pc,mount.pc} + +%files -n python-libmount +%{!?_licensedir:%global license %%doc} +%license Documentation/licenses/COPYING.LGPLv2.1 libmount/COPYING +%{_libdir}/python*/site-packages/libmount/ + +%files help -f %{name}-help.files +%exclude %{_datadir}/doc/util-linux/getopt/* +%doc README NEWS Documentation/deprecated.txt +%doc %attr(0644,-,-) misc-utils/getopt-*.{bash,tcsh} +%{_mandir}/man1/{chfn.1*,chsh.1*,cal.1*,chrt.1*,col.1*,colcrt.1*,colrm.1*,column.1*,dmesg.1*,eject.1*} +%{_mandir}/man1/{fallocate.1*,fincore.1*,flock.1*,getopt.1*,hexdump.1*,ionice.1*,ipcmk.1*,ipcrm.1*,ipcs.1*} +%{_mandir}/man1/{kill.1*,last.1*,lastb.1*,logger.1*,login.1*,look.1*,lscpu.1*,lsipc.1*,lslogins.1*,lsmem.1*} +%{_mandir}/man1/{mcookie.1*,mesg.1*,more.1*,mountpoint.1*,namei.1*,nsenter.1*,prlimit.1*,rename.1*,renice.1*} +%{_mandir}/man1/{rev.1*,runuser.1*,script.1*,scriptreplay.1*,setpriv.1*,setsid.1*,setterm.1*,su.1*,taskset.1*} +%{_mandir}/man1/{ul.1*,unshare.1*,utmpdump.1.gz,uuidgen.1*,uuidparse.1*,wall.1*,whereis.1*,write.1*} +%{_mandir}/man3/{libblkid.3*,uuid.3*,uuid_clear.3*,uuid_compare.3*,uuid_copy.3*,uuid_generate.3*,uuid_generate_random.3*} +%{_mandir}/man3/{uuid_generate_time_safe.3*,uuid_is_null.3*,uuid_parse.3*,uuid_time.3*,uuid_unparse.3*,uuid_generate_time.3*} +%{_mandir}/man5/{fstab.5*,terminal-colors.d.5*} +%{_mandir}/man8/{uuidd.8*,fdformat.8*,hwclock.8*,clock.8*,cfdisk.8*,sfdisk.8*,addpart.8*,agetty.8*} +%{_mandir}/man8/{blkdiscard.8*,blkid.8*,blkzone.8*,blockdev.8*,chcpu.8*,chmem.8*,ctrlaltdel.8*,delpart.8*} +%{_mandir}/man8/{fdisk.8*,findfs.8*,findmnt.8*,fsck.8*,fsck.cramfs.8*,fsck.minix.8*,fsfreeze.8*,fstrim.8*} +%{_mandir}/man8/{isosize.8*,ldattach.8*,losetup.8*,lsblk.8*,lslocks.8*,lsns.8*,mkfs.8*,mkfs.cramfs.8*} +%{_mandir}/man8/{mkfs.minix.8*,mkswap.8*,mount.8*,nologin.8*,partx.8*,pivot_root.8*,raw.8*,rawdevices.8*} +%{_mandir}/man8/{readprofile.8*,resizepart.8*,rfkill.8*,rtcwake.8*,setarch.8*,sulogin.8.gz,swaplabel.8*} +%{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*} + +%changelog +* Sat Sep 21 2019 huzhiyu - 2.32.1-2 +- Package init diff --git a/various-fix-uninitialized-when-used-warnings-clang.patch b/various-fix-uninitialized-when-used-warnings-clang.patch new file mode 100644 index 0000000..f66a557 --- /dev/null +++ b/various-fix-uninitialized-when-used-warnings-clang.patch @@ -0,0 +1,213 @@ +From 4813a5210f6fb979d8f7a592f71a2f9c4d3db179 Mon Sep 17 00:00:00 2001 +From: Sami Kerola +Date: Sat, 9 Feb 2019 09:34:52 +0000 +Subject: [PATCH 647/686] various: fix 'uninitialized when used' warnings + [clang] + +This change fixes "warning: variable 'var' may be uninitialized when used +here [-Wconditional-uninitialized]" warnings reported in various files. + +Signed-off-by: Sami Kerola +--- + disk-utils/mkfs.minix.c | 2 +- + disk-utils/sfdisk.c | 2 +- + libblkid/src/partitions/dos.c | 2 +- + libblkid/src/partitions/partitions.c | 2 +- + libblkid/src/superblocks/ddf_raid.c | 2 +- + libblkid/src/superblocks/hfs.c | 2 +- + libblkid/src/superblocks/zfs.c | 2 +- + libfdisk/src/dos.c | 2 +- + libfdisk/src/table.c | 2 +- + misc-utils/logger.c | 2 +- + misc-utils/uuidd.c | 3 ++- + misc-utils/uuidparse.c | 2 +- + sys-utils/hwclock.c | 2 +- + sys-utils/readprofile.c | 2 +- + 14 files changed, 15 insertions(+), 14 deletions(-) + +diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c +index 54c47da..8e6811f 100644 +--- a/disk-utils/mkfs.minix.c ++++ b/disk-utils/mkfs.minix.c +@@ -685,7 +685,7 @@ static int find_super_magic(const struct fs_control *ctl) + + static void determine_device_blocks(struct fs_control *ctl, const struct stat *statbuf) + { +- unsigned long long dev_blocks; ++ unsigned long long dev_blocks = 0; + + if (S_ISBLK(statbuf->st_mode)) { + int sectorsize; +diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c +index 9f03112..6b3717f 100644 +--- a/disk-utils/sfdisk.c ++++ b/disk-utils/sfdisk.c +@@ -1717,7 +1717,7 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv) + + nparts = fdisk_table_get_nents(tb); + if (nparts) { +- size_t cur_partno; ++ size_t cur_partno = (size_t) -1; + struct fdisk_partition *pa = fdisk_table_get_partition(tb, nparts - 1); + + assert(pa); +diff --git a/libblkid/src/partitions/dos.c b/libblkid/src/partitions/dos.c +index 659ca9a..6c1b519 100644 +--- a/libblkid/src/partitions/dos.c ++++ b/libblkid/src/partitions/dos.c +@@ -55,7 +55,7 @@ static int parse_dos_extended(blkid_probe pr, blkid_parttable tab, + + while (1) { + struct dos_partition *p, *p0; +- uint32_t start, size; ++ uint32_t start = 0, size; + + if (++ct_nodata > 100) + return BLKID_PROBE_OK; +diff --git a/libblkid/src/partitions/partitions.c b/libblkid/src/partitions/partitions.c +index 83c3c4f..eabcf5d 100644 +--- a/libblkid/src/partitions/partitions.c ++++ b/libblkid/src/partitions/partitions.c +@@ -1009,7 +1009,7 @@ blkid_partition blkid_partlist_get_partition_by_partno(blkid_partlist ls, int n) + blkid_partition blkid_partlist_devno_to_partition(blkid_partlist ls, dev_t devno) + { + struct sysfs_cxt sysfs; +- uint64_t start, size; ++ uint64_t start = 0, size; + int i, rc, partno = 0; + + DBG(LOWPROBE, ul_debug("trying to convert devno 0x%llx to partition", +diff --git a/libblkid/src/superblocks/ddf_raid.c b/libblkid/src/superblocks/ddf_raid.c +index fc2c39d..0b82e73 100644 +--- a/libblkid/src/superblocks/ddf_raid.c ++++ b/libblkid/src/superblocks/ddf_raid.c +@@ -78,7 +78,7 @@ static int probe_ddf(blkid_probe pr, + size_t i; + struct ddf_header *ddf = NULL; + char version[DDF_REV_LENGTH + 1]; +- uint64_t off, lba; ++ uint64_t off = 0, lba; + + if (pr->size < 0x30000) + return 1; +diff --git a/libblkid/src/superblocks/hfs.c b/libblkid/src/superblocks/hfs.c +index 7b01174..6f170a3 100644 +--- a/libblkid/src/superblocks/hfs.c ++++ b/libblkid/src/superblocks/hfs.c +@@ -191,7 +191,7 @@ static int probe_hfsplus(blkid_probe pr, const struct blkid_idmag *mag) + unsigned int off = 0; + unsigned int blocksize; + unsigned int cat_block; +- unsigned int ext_block_start; ++ unsigned int ext_block_start = 0; + unsigned int ext_block_count; + unsigned int record_count; + unsigned int leaf_node_head; +diff --git a/libblkid/src/superblocks/zfs.c b/libblkid/src/superblocks/zfs.c +index ec3e1c5..60dca8e 100644 +--- a/libblkid/src/superblocks/zfs.c ++++ b/libblkid/src/superblocks/zfs.c +@@ -218,7 +218,7 @@ static int probe_zfs(blkid_probe pr, + const struct blkid_idmag *mag __attribute__((__unused__))) + { + int swab_endian = 0; +- struct zfs_uberblock *ub; ++ struct zfs_uberblock *ub = NULL; + loff_t offset = 0, ub_offset = 0; + int label_no, found = 0, found_in_label; + void *label; +diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c +index 4178405..91b6cf4 100644 +--- a/libfdisk/src/dos.c ++++ b/libfdisk/src/dos.c +@@ -1707,7 +1707,7 @@ static int dos_add_partition(struct fdisk_context *cxt, + } else { + char hint[BUFSIZ]; + struct fdisk_ask *ask; +- int c; ++ int c = 0; + + /* the default layout for scripts is to create primary partitions */ + if (cxt->script || !fdisk_has_dialogs(cxt)) { +diff --git a/libfdisk/src/table.c b/libfdisk/src/table.c +index 4881db6..1cd37ab 100644 +--- a/libfdisk/src/table.c ++++ b/libfdisk/src/table.c +@@ -720,7 +720,7 @@ int fdisk_diff_tables(struct fdisk_table *a, struct fdisk_table *b, + struct fdisk_iter *itr, + struct fdisk_partition **res, int *change) + { +- struct fdisk_partition *pa, *pb; ++ struct fdisk_partition *pa = NULL, *pb; + int rc = 1; + + assert(itr); +diff --git a/misc-utils/logger.c b/misc-utils/logger.c +index ebdc56e..9f9287d 100644 +--- a/misc-utils/logger.c ++++ b/misc-utils/logger.c +@@ -237,7 +237,7 @@ static int pencode(char *s) + + static int unix_socket(struct logger_ctl *ctl, const char *path, int *socket_type) + { +- int fd, i, type = -1; ++ int fd = -1, i, type = -1; + static struct sockaddr_un s_addr; /* AF_UNIX address of local logger */ + + if (strlen(path) >= sizeof(s_addr.sun_path)) +diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c +index 8b83d91..8d49147 100644 +--- a/misc-utils/uuidd.c ++++ b/misc-utils/uuidd.c +@@ -311,7 +311,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path, + uuid_t uu; + char reply_buf[1024], *cp; + char op, str[UUID_STR_LEN]; +- int i, ns, len, num; ++ int i, ns, len; ++ int num; /* intentionally uninitialized */ + int s = 0; + int fd_pidfile = -1; + int ret; +diff --git a/misc-utils/uuidparse.c b/misc-utils/uuidparse.c +index 777f9db..6a13f2a 100644 +--- a/misc-utils/uuidparse.c ++++ b/misc-utils/uuidparse.c +@@ -144,7 +144,7 @@ static void fill_table_row(struct libscols_table *tb, char const *const uuid) + size_t i; + uuid_t buf; + int invalid = 0; +- int variant, type; ++ int variant = -1, type = -1; + + assert(tb); + assert(uuid); +diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c +index b83e710..238e9f5 100644 +--- a/sys-utils/hwclock.c ++++ b/sys-utils/hwclock.c +@@ -899,7 +899,7 @@ manipulate_clock(const struct hwclock_control *ctl, const time_t set_time, + const struct timeval startup_time, struct adjtime *adjtime) + { + /* The time at which we read the Hardware Clock */ +- struct timeval read_time; ++ struct timeval read_time = { 0 }; + /* + * The Hardware Clock gives us a valid time, or at + * least something close enough to fool mktime(). +diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c +index 0350738..cf07502 100644 +--- a/sys-utils/readprofile.c ++++ b/sys-utils/readprofile.c +@@ -136,7 +136,7 @@ int main(int argc, char **argv) + unsigned long long add0 = 0; + unsigned int step; + unsigned int *buf, total, fn_len; +- unsigned long long fn_add, next_add; /* current and next address */ ++ unsigned long long fn_add = 0, next_add; /* current and next address */ + char fn_name[S_LEN], next_name[S_LEN]; /* current and next name */ + char mode[8]; + int c; +-- +1.8.3.1 + diff --git a/zramctl-fix-truncation-warning.patch b/zramctl-fix-truncation-warning.patch new file mode 100644 index 0000000..047c6a5 --- /dev/null +++ b/zramctl-fix-truncation-warning.patch @@ -0,0 +1,43 @@ +From 8fd27bec0c5cb5ade55cf0a9d606aa1dbeeed95f Mon Sep 17 00:00:00 2001 +From: Sami Kerola +Date: Thu, 3 May 2018 22:57:58 +0100 +Subject: [PATCH 104/686] zramctl: fix truncation warning +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +sys-utils/zramctl.c: In function ‘zram_get_sysfs’: +sys-utils/zramctl.c:220:52: warning: ‘%s’ directive output may be truncated +writing up to 4095 bytes into a region of size 27 [-Wformat-truncation=] + snprintf(z->devname, sizeof(z->devname), "/dev/%s", name); + +As an additional good thing zramctl will no longer allocate 4096 bytes from +stack when just 23 bytes is enough. + +[kzak@redhat.com: - use macro rather than hardcoded string for the path] + +Signed-off-by: Sami Kerola +Signed-off-by: Karel Zak +--- + sys-utils/zramctl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sys-utils/zramctl.c b/sys-utils/zramctl.c +index 8da7b2d..bedb0a0 100644 +--- a/sys-utils/zramctl.c ++++ b/sys-utils/zramctl.c +@@ -215,9 +215,9 @@ static struct sysfs_cxt *zram_get_sysfs(struct zram *z) + return NULL; + if (*z->devname != '/') { + /* canonicalize the device name according to /sys */ +- char name[PATH_MAX]; ++ char name[sizeof(z->devname) - sizeof(_PATH_DEV)]; + if (sysfs_get_devname(&z->sysfs, name, sizeof(name))) +- snprintf(z->devname, sizeof(z->devname), "/dev/%s", name); ++ snprintf(z->devname, sizeof(z->devname), _PATH_DEV "%s", name); + } + } + +-- +1.8.3.1 +