update version to 2.34

This commit is contained in:
openeuler-basic 2020-01-12 20:18:12 +08:00
parent ac8105a291
commit b5e30714a6
34 changed files with 15 additions and 1550 deletions

View File

@ -1,40 +0,0 @@
From 5de9751997cf490088f62f41fd92be57cf7ceea4 Mon Sep 17 00:00:00 2001
From: Stanislav Brabec <sbrabec@suse.cz>
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 <sbrabec@suse.cz>
Cc: Lubomir Rintel <lkundrak@v3.sk>
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
---
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

View File

@ -1,157 +0,0 @@
From c6f0bdfecc7b1bbadc644eb8f625473c34fe7cae Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
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 <kerolasa@iki.fi>
---
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

View File

@ -1,26 +0,0 @@
From 27ea4deb93a15e701d1a1fd791f70677c579b947 Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
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 <kerolasa@iki.fi>
---
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

View File

@ -1,32 +0,0 @@
From 8a7f4b5bfe35ffc5f32cea67335d8265f77a4697 Mon Sep 17 00:00:00 2001
From: Masato Suzuki <masato.suzuki@wdc.com>
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 <masato.suzuki@wdc.com>
---
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

View File

@ -1,28 +0,0 @@
From 523de2ec6f41e5cfff31c99393c8d3b1a88a62bf Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
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 <kerolasa@iki.fi>
---
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

View File

@ -1,30 +0,0 @@
From f1a7cfcb1d487c19c27287fe5136c46f3b7de1ab Mon Sep 17 00:00:00 2001
From: Matti Niemenmaa <matti.niemenmaa+git@iki.fi>
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 <matti.niemenmaa+git@iki.fi>
---
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

View File

@ -1,26 +0,0 @@
From 36787f7a97c6797ffbd3905427f61f90eed30d56 Mon Sep 17 00:00:00 2001
From: Vaclav Dolezal <vdolezal@redhat.com>
Date: Tue, 29 Aug 2017 15:29:27 +0200
Subject: [PATCH 100/686] fdisk: fix typo in debug string
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
---
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

View File

@ -1,29 +0,0 @@
From 9737a1671117e2d8ade95cd46df2c0787d9266cd Mon Sep 17 00:00:00 2001
From: Paul Asmuth <paul@asmuth.com>
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

View File

@ -1,69 +0,0 @@
From 577bb86f5b0662ac81699580b55b5a4b11611f01 Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
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 <kerolasa@iki.fi>
---
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

View File

@ -1,32 +0,0 @@
From e73456dfbb36c8d19a802ffe46b8ebccd77ccb22 Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
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 <kerolasa@iki.fi>
---
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

View File

@ -1,38 +0,0 @@
From e4077e0e445ddc8d81e4fbab599655bb48ac130a Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
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 <kerolasa@iki.fi>
---
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

View File

@ -1,29 +0,0 @@
From b22332dd4f0042e9fc7248aa918b991d684d8f28 Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
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 <kerolasa@iki.fi>
---
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

View File

@ -1,74 +0,0 @@
From bf99940f649959fcc73590c043d28b1ab0d83e1c Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
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 <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
---
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 <sys/stat.h>
#include "canonicalize.h"
+#include "pathnames.h"
/*
* Converts private "dm-N" names to "/dev/mapper/<name>"
@@ -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 "<name>\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

View File

@ -1,39 +0,0 @@
From 3b6ca044daf6a86c650b841c4005b2b6e68453fa Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
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 <kzak@redhat.com>
---
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

View File

@ -1,28 +0,0 @@
From b7fb72090b2d02baf86480b11346f41627291372 Mon Sep 17 00:00:00 2001
From: Andreas Henriksson <andreas@fatal.se>
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 <andreas@fatal.se>
---
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

View File

@ -1,29 +0,0 @@
From 1741d2ea572be01899107bd171d4e8a3e50c73d9 Mon Sep 17 00:00:00 2001
From: Milan Broz <gmazyland@gmail.com>
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 <gmazyland@gmail.com>
---
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

View File

@ -1,46 +0,0 @@
From 9b13b5602e16f719934b29d5efbf5a3aacf9832c Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
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 <kzak@redhat.com>
---
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

View File

@ -1,61 +0,0 @@
From 73775189767195f1d9f5b6b6f6a54e51f61c4356 Mon Sep 17 00:00:00 2001
From: KyleMahlkuch <Kyle.Mahlkuch@ibm.com>
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

View File

@ -1,36 +0,0 @@
From b9144a43c03d8ed961c889d9bd113838ac8643ea Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 18 Jul 2018 10:00:18 +0200
Subject: [PATCH 277/686] libfdisk: fix compiler warning
[-Wmaybe-uninitialized]
Signed-off-by: Karel Zak <kzak@redhat.com>
---
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

View File

@ -1,113 +0,0 @@
From d6ddf07d31dfdc894eb8e7e6842aa856342c526e Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
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 <kzak@redhat.com>
---
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

View File

@ -1,37 +0,0 @@
From 9c6af25c31540f8310bb6f4e6dbb5621b89053a3 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
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 <kzak@redhat.com>
---
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

View File

@ -1,28 +0,0 @@
From d29b7ced3b263ac9eda8a37703be0153ad67e882 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 25 Jul 2018 12:02:28 +0200
Subject: [PATCH 312/686] lscpu: fix resource leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
---
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

View File

@ -1,25 +0,0 @@
From e6601a70ec4a56e99cb7361bb5d3a9c00072f9d8 Mon Sep 17 00:00:00 2001
From: Mark Sheppard <mark@ddf.net>
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

View File

@ -1,33 +0,0 @@
From a81a48779b858b7ab49fff3ed52dec21a26049a5 Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
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 <kerolasa@iki.fi>
---
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

View File

@ -1,26 +0,0 @@
From 4850e972572179cef74143a09a03fbe7d745c6d8 Mon Sep 17 00:00:00 2001
From: Noel Cragg <noel@squeezehead.com>
Date: Thu, 29 Nov 2018 11:38:41 +0100
Subject: [PATCH 488/686] mkswap: fix page size warning message
Signed-off-by: Karel Zak <kzak@redhat.com>
---
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

View File

@ -1,58 +0,0 @@
From 0849ff36605588a7ab7892ab2aae59d73290e225 Mon Sep 17 00:00:00 2001
From: "G.raud Meyer" <graud@gmx.com>
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

View File

@ -1,48 +0,0 @@
From 27afe5016842c22d256ea9f88b598d637ca0df84 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
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 <kzak@redhat.com>
---
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

View File

@ -1,31 +0,0 @@
From 5932ef81deb0b823ffa52bc6206cdd3c583bb4e9 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
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 <kzak@redhat.com>
---
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

Binary file not shown.

BIN
util-linux-2.34.tar.xz Normal file

Binary file not shown.

View File

@ -1,8 +1 @@
#
# 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.

View File

@ -1,9 +1,9 @@
%define compldir %{_datadir}/bash-completion/completions/
%define _pre_version__ 2.32
%define _pre_version__ 2.34
Name: util-linux
Version: %{_pre_version__}.1
Release: 5
Version: %{_pre_version__}
Release: 1
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
@ -38,37 +38,7 @@ 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
Patch6030: fdisk-fix-quit-dialog-for-non-libreadline-version.patch
Patch6000: fdisk-fix-quit-dialog-for-non-libreadline-version.patch
%description
The util-linux package contains a random collection of files that
@ -247,8 +217,8 @@ fi
%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}/{cal,chrt,col,colcrt,colrm,column,chmem,dmesg,eject,fallocate,fincore,findmnt,choom}
%{_bindir}/{flock,getopt,hexdump,ionice,ipcmk,ipcrm,ipcs,isosize,kill,last,lastb,logger,hardlink}
%{_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}
@ -276,7 +246,7 @@ fi
%files -n python-libmount
%{!?_licensedir:%global license %%doc}
%license Documentation/licenses/COPYING.LGPLv2.1 libmount/COPYING
%license libmount/COPYING
%{_libdir}/python*/site-packages/libmount/
%files help -f %{name}-help.files
@ -288,10 +258,10 @@ fi
%{_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}/man1/{ul.1*,unshare.1*,utmpdump.1.gz,uuidgen.1*,uuidparse.1*,wall.1*,whereis.1*,write.1*,choom.1*,hardlink.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}/man5/{fstab.5*,terminal-colors.d.5*,adjtime_config.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*}
@ -301,6 +271,12 @@ fi
%{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*}
%changelog
* Sun Jan 12 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.34-1
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:update version to 2.34
* Wed Jan 8 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.32.1-5
- Type:enhancement
- ID:NA

View File

@ -1,213 +0,0 @@
From 4813a5210f6fb979d8f7a592f71a2f9c4d3db179 Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
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 <kerolasa@iki.fi>
---
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

View File

@ -1,43 +0,0 @@
From 8fd27bec0c5cb5ade55cf0a9d606aa1dbeeed95f Mon Sep 17 00:00:00 2001
From: Sami Kerola <kerolasa@iki.fi>
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 <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
---
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