diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-26 17:41:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-26 17:41:48 +0000 |
commit | 44ad8616fc71dc577a8a09be7cd05a034606feeb (patch) | |
tree | 2b6e157c29d7eae810d06ee00dd3169de654ef39 | |
parent | Releasing progress-linux version 2.40-6~progress7.99u1. (diff) | |
download | util-linux-44ad8616fc71dc577a8a09be7cd05a034606feeb.tar.xz util-linux-44ad8616fc71dc577a8a09be7cd05a034606feeb.zip |
Merging debian version 2.40-7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
23 files changed, 1080 insertions, 24 deletions
diff --git a/debian/changelog b/debian/changelog index 29cd22d..1e382a1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,32 @@ +util-linux (2.40-7) unstable; urgency=medium + + [ Chris Hofstaedtler ] + * Import upstream stable/v2.40 up to a8aa0b5f154a44557f5bae5a4027bdbfe42b0323 + * lsns: fix netns use + * libmount: fix comment typo for mnt_fs_get_comment() + * libmount: Fix access check for utab in context + * lsblk: simplify SOURCES code + * findmnt: always zero-terminate SOURCES data + * agetty: Don't override TERM passed by the user + * libsmartcols: reset wrap after calculation + * lslocks: remove a unused local variable + * lslocks: don't abort gathering per-process information even if + opening a /proc/[0-9]* fails + * lsns: tolerate lsns_ioctl(fd, NS_GET_{PARENT,USERNS}) failing with ENOSYS + * lsns: report with warnx if a namespace related ioctl fails with ENOSYS + * Fix misplaced else in mnt_update_already_done + * findmnt: revise the code for -I and -D option (Closes: #1069634) + * libblkid: topology/ioctl: simplify ioctl handling + * libblkid: topology/ioctl: correctly handle kernel types + * pam_lastlog2: link against liblastlog + * libblkid: Fix segfault when blkid.conf doesn't exist (Closes: #1069634) + + [ Helmut Grohne ] + * Fix /usr-move mitigation (Closes: #1069064). + Thanks! + + -- Chris Hofstaedtler <zeha@debian.org> Fri, 26 Apr 2024 11:41:02 +0200 + util-linux (2.40-6~progress7.99u1) graograman-backports; urgency=medium * Uploading to graograman-backports, remaining changes: diff --git a/debian/patches/series b/debian/patches/series index d7dddf5..ab03306 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -10,5 +10,22 @@ debian/tests-mark-fadvise-drop-as-known-failing-on-buildds.patch upstream/tests-lsfd-mkfds-multiplexing-skip-if-proc-pid-syscall-is.patch upstream/audit-arch.h-add-defines-for-m68k-sh.patch upstream/Revert-lib-pager-Apply-pager-specific-fixes-only-when-nee.patch +upstream/libblkid-Fix-segfault-when-blkid.conf-doesn-t-exist.patch +upstream/pam_lastlog2-link-against-liblastlog.patch +upstream/libblkid-topology-ioctl-correctly-handle-kernel-types.patch +upstream/libblkid-topology-ioctl-simplify-ioctl-handling.patch +upstream/findmnt-revise-the-code-for-I-and-D-option.patch +upstream/Fix-misplaced-else-in-mnt_update_already_done.patch +upstream/lsns-report-with-warnx-if-a-namespace-related-ioctl-fails.patch +upstream/lsns-tolerate-lsns_ioctl-fd-NS_GET_-PARENT-USERNS-failing.patch +upstream/lslocks-don-t-abort-gathering-per-process-information-eve.patch +upstream/lslocks-remove-a-unused-local-variable.patch +upstream/libsmartcols-reset-wrap-after-calculation.patch +upstream/agetty-Don-t-override-TERM-passed-by-the-user.patch +upstream/findmnt-always-zero-terminate-SOURCES-data.patch +upstream/lsblk-simplify-SOURCES-code.patch +upstream/libmount-Fix-access-check-for-utab-in-context.patch +upstream/libmount-fix-comment-typo-for-mnt_fs_get_comment.patch +upstream/lsns-fix-netns-use.patch progress-linux/0001-agetty-prompt.patch progress-linux/0002-login-prompt.patch diff --git a/debian/patches/upstream/Fix-misplaced-else-in-mnt_update_already_done.patch b/debian/patches/upstream/Fix-misplaced-else-in-mnt_update_already_done.patch new file mode 100644 index 0000000..eca8867 --- /dev/null +++ b/debian/patches/upstream/Fix-misplaced-else-in-mnt_update_already_done.patch @@ -0,0 +1,28 @@ +From: Gavin Lloyd <gavinhungry@gmail.com> +Date: Tue, 9 Apr 2024 17:38:02 -0700 +Subject: Fix misplaced else in mnt_update_already_done + +See 477401f0de + +(cherry picked from commit 6b316e0c9f1feb61bef3bb14b1356be8fbefcc17) +--- + libmount/src/tab_update.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libmount/src/tab_update.c b/libmount/src/tab_update.c +index 87512af..d44d190 100644 +--- a/libmount/src/tab_update.c ++++ b/libmount/src/tab_update.c +@@ -982,9 +982,9 @@ int mnt_update_already_done(struct libmnt_update *upd) + if (mnt_optstr_get_missing(fs->user_optstr, upd->fs->user_optstr, NULL) == 0) { + upd->missing_options = 1; + DBG(UPDATE, ul_debugobj(upd, " missing options detected")); +- } +- } else +- rc = 1; ++ } else ++ rc = 1; ++ } + + } else if (upd->target) { + /* umount */ diff --git a/debian/patches/upstream/agetty-Don-t-override-TERM-passed-by-the-user.patch b/debian/patches/upstream/agetty-Don-t-override-TERM-passed-by-the-user.patch new file mode 100644 index 0000000..11df871 --- /dev/null +++ b/debian/patches/upstream/agetty-Don-t-override-TERM-passed-by-the-user.patch @@ -0,0 +1,31 @@ +From: Daan De Meyer <daan.j.demeyer@gmail.com> +Date: Fri, 19 Apr 2024 20:07:47 +0200 +Subject: agetty: Don't override TERM passed by the user + +Before 4869b259d68f65ea88df625ce8df9c0177d55a01, any TERM passed +on the agetty command line would be used instead of the default TERM. +After 4869b259d68f65ea88df625ce8df9c0177d55a01, the default TERM is +used unconditionally. + +Fix the regression by checking if the user passed a custom TERM. + +Fixes: 4869b259d68f65ea88df625ce8df9c0177d55a01 +(cherry picked from commit af354e92111769d57e43eb4f1825c0d99c894ddb) +--- + term-utils/agetty.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/term-utils/agetty.c b/term-utils/agetty.c +index 0fc6f15..0b9eb8b 100644 +--- a/term-utils/agetty.c ++++ b/term-utils/agetty.c +@@ -1196,7 +1196,8 @@ static void open_tty(const char *tty, struct termios *tp, struct options *op) + #endif + } + +- op->term = get_terminal_default_type(op->tty, !(op->flags & F_VCONSOLE)); ++ if (!op->term) ++ op->term = get_terminal_default_type(op->tty, !(op->flags & F_VCONSOLE)); + if (!op->term) + log_err(_("failed to allocate memory: %m")); + diff --git a/debian/patches/upstream/findmnt-always-zero-terminate-SOURCES-data.patch b/debian/patches/upstream/findmnt-always-zero-terminate-SOURCES-data.patch new file mode 100644 index 0000000..b173277 --- /dev/null +++ b/debian/patches/upstream/findmnt-always-zero-terminate-SOURCES-data.patch @@ -0,0 +1,46 @@ +From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= <thomas@t-8ch.de> +Date: Sun, 21 Apr 2024 20:00:31 +0200 +Subject: findmnt: always zero-terminate SOURCES data +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +libsmartcols expects it's data fields to be zero terminated. +See the call to strlen() in scols_column_greatest_wrap(). +ul_buffer however does not guarantee that termination, +ul_buffer_append_strings() discard the zero-termination. + +Always zero-terminate in get_data_col_sources() and drop the now +unnecessary variable "i". + +Closes: https://github.com/util-linux/util-linux/issues/2980 +Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de> +(cherry picked from commit 6594679e9af805075c282da35b1b2a8d767e403b) +--- + misc-utils/findmnt.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c +index 2e4d59e..f40b137 100644 +--- a/misc-utils/findmnt.c ++++ b/misc-utils/findmnt.c +@@ -552,7 +552,6 @@ static char *get_vfs_attr(struct libmnt_fs *fs, int sizetype) + static char *get_data_col_sources(struct libmnt_fs *fs, int evaluate, size_t *datasiz) + { + const char *tag = NULL, *p = NULL; +- int i = 0; + const char *device = NULL; + char *val = NULL; + blkid_dev_iterate iter; +@@ -602,10 +601,8 @@ static char *get_data_col_sources(struct libmnt_fs *fs, int evaluate, size_t *da + dev = blkid_verify(blk_cache, dev); + if (!dev) + continue; +- if (i != 0) +- ul_buffer_append_data(&buf, "\0", 1); + ul_buffer_append_string(&buf, blkid_dev_devname(dev)); +- i++; ++ ul_buffer_append_data(&buf, "\0", 1); + } + blkid_dev_iterate_end(iter); + free(val); diff --git a/debian/patches/upstream/findmnt-revise-the-code-for-I-and-D-option.patch b/debian/patches/upstream/findmnt-revise-the-code-for-I-and-D-option.patch new file mode 100644 index 0000000..7ec4aaf --- /dev/null +++ b/debian/patches/upstream/findmnt-revise-the-code-for-I-and-D-option.patch @@ -0,0 +1,160 @@ +From: Masatake YAMATO <yamato@redhat.com> +Date: Fri, 5 Apr 2024 22:40:36 +0900 +Subject: findmnt: revise the code for -I and -D option + +Fixes #2913. + +3dd79293b5b655da9d913dedd8facb08959a7826 added -I option. +However, the code used bit flags (FL_DF and FL_DF_INODES) wrongly; +the code broke the output of -D option. + +Signed-off-by: Masatake YAMATO <yamato@redhat.com> +(cherry picked from commit aa0c45e8686df509c169121473d2cfb4fe18c3ea) +--- + misc-utils/findmnt.c | 28 ++++++++---------- + misc-utils/findmnt.h | 2 +- + tests/expected/findmnt/df-options | 4 +++ + tests/ts/findmnt/df-options | 62 +++++++++++++++++++++++++++++++++++++++ + 4 files changed, 80 insertions(+), 16 deletions(-) + create mode 100644 tests/expected/findmnt/df-options + create mode 100755 tests/ts/findmnt/df-options + +diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c +index cc397da..2e4d59e 100644 +--- a/misc-utils/findmnt.c ++++ b/misc-utils/findmnt.c +@@ -1636,7 +1636,7 @@ int main(int argc, char *argv[]) + break; + case 'I': + flags &= ~FL_TREE; +- flags |= FL_DF_INODES; ++ flags |= (FL_DF_INODES | FL_DF); + break; + case 'i': + flags |= FL_INVERT; +@@ -1775,22 +1775,20 @@ int main(int argc, char *argv[]) + if (collist) + list_colunms(); /* print end exit */ + +- if (!ncolumns && (flags & FL_DF_INODES)) { ++ if (!ncolumns && (flags & FL_DF)) { + add_column(columns, ncolumns++, COL_SOURCE); + add_column(columns, ncolumns++, COL_FSTYPE); +- add_column(columns, ncolumns++, COL_INO_TOTAL); +- add_column(columns, ncolumns++, COL_INO_USED); +- add_column(columns, ncolumns++, COL_INO_AVAIL); +- add_column(columns, ncolumns++, COL_INO_USEPERC); +- add_column(columns, ncolumns++, COL_TARGET); +- } +- else if (!ncolumns && (flags & FL_DF)) { +- add_column(columns, ncolumns++, COL_SOURCE); +- add_column(columns, ncolumns++, COL_FSTYPE); +- add_column(columns, ncolumns++, COL_SIZE); +- add_column(columns, ncolumns++, COL_USED); +- add_column(columns, ncolumns++, COL_AVAIL); +- add_column(columns, ncolumns++, COL_USEPERC); ++ if (flags & FL_DF_INODES) { ++ add_column(columns, ncolumns++, COL_INO_TOTAL); ++ add_column(columns, ncolumns++, COL_INO_USED); ++ add_column(columns, ncolumns++, COL_INO_AVAIL); ++ add_column(columns, ncolumns++, COL_INO_USEPERC); ++ } else { ++ add_column(columns, ncolumns++, COL_SIZE); ++ add_column(columns, ncolumns++, COL_USED); ++ add_column(columns, ncolumns++, COL_AVAIL); ++ add_column(columns, ncolumns++, COL_USEPERC); ++ } + add_column(columns, ncolumns++, COL_TARGET); + } + +diff --git a/misc-utils/findmnt.h b/misc-utils/findmnt.h +index 5c69450..85ab68d 100644 +--- a/misc-utils/findmnt.h ++++ b/misc-utils/findmnt.h +@@ -24,7 +24,7 @@ enum { + FL_SHADOWED = (1 << 20), + FL_DELETED = (1 << 21), + FL_SHELLVAR = (1 << 22), +- FL_DF_INODES = (1 << 23) | FL_DF, ++ FL_DF_INODES = (1 << 23), + + /* basic table settings */ + FL_ASCII = (1 << 25), +diff --git a/tests/expected/findmnt/df-options b/tests/expected/findmnt/df-options +new file mode 100644 +index 0000000..3f0f509 +--- /dev/null ++++ b/tests/expected/findmnt/df-options +@@ -0,0 +1,4 @@ ++-D: OK ++-I: OK ++--df: OK ++--dfi: OK +diff --git a/tests/ts/findmnt/df-options b/tests/ts/findmnt/df-options +new file mode 100755 +index 0000000..58208b9 +--- /dev/null ++++ b/tests/ts/findmnt/df-options +@@ -0,0 +1,62 @@ ++#!/bin/bash ++ ++# This file is part of util-linux. ++# ++# This file is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This file is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++TS_TOPDIR="${0%/*}/../.." ++TS_DESC="the columns enabled with -D and -I options" ++ ++. "$TS_TOPDIR"/functions.sh ++ts_init "$*" ++ ++ts_check_test_command "$TS_CMD_FINDMNT" ++ts_check_prog "head" ++ ++ts_cd "$TS_OUTDIR" ++ ++D_expectation="SOURCE FSTYPE SIZE USED AVAIL USE% TARGET" ++I_expectation="SOURCE FSTYPE INO.TOTAL INO.USED INO.AVAIL INO.USE% TARGET" ++{ ++ if [[ $($TS_CMD_FINDMNT --raw -D | head -1) == "$D_expectation" ]]; then ++ echo "-D: OK" ++ else ++ echo "-D: ERROR" ++ $TS_CMD_FINDMNT --raw -D ++ echo $? ++ fi ++ ++ if [[ $($TS_CMD_FINDMNT --raw -I | head -1) == "$I_expectation" ]]; then ++ echo "-I: OK" ++ else ++ echo "-I: ERROR" ++ $TS_CMD_FINDMNT --raw -I ++ echo $? ++ fi ++ ++ if [[ $($TS_CMD_FINDMNT --raw --df | head -1) == "$D_expectation" ]]; then ++ echo "--df: OK" ++ else ++ echo "--df: ERROR" ++ $TS_CMD_FINDMNT --raw --df ++ echo $? ++ fi ++ ++ if [[ $($TS_CMD_FINDMNT --raw --dfi | head -1) == "$I_expectation" ]]; then ++ echo "--dfi: OK" ++ else ++ echo "--dfi: ERROR" ++ $TS_CMD_FINDMNT --raw --dfi ++ echo $? ++ fi ++} >> "$TS_OUTPUT" 2>> "$TS_ERRLOG" ++ ++ts_finalize diff --git a/debian/patches/upstream/libblkid-Fix-segfault-when-blkid.conf-doesn-t-exist.patch b/debian/patches/upstream/libblkid-Fix-segfault-when-blkid.conf-doesn-t-exist.patch new file mode 100644 index 0000000..0e6490c --- /dev/null +++ b/debian/patches/upstream/libblkid-Fix-segfault-when-blkid.conf-doesn-t-exist.patch @@ -0,0 +1,75 @@ +From: Karel Zak <kzak@redhat.com> +Date: Mon, 1 Apr 2024 12:14:50 +0200 +Subject: libblkid: Fix segfault when blkid.conf doesn't exist + +* Move 'line' and 'uevent' to the beginning of the LIBECONF code. +* Remove unwanted space between function name and arguments. +* Check for 'line' pointer before dereferencing. + +References: https://github.com/util-linux/util-linux/pull/2883 +Signed-off-by: Karel Zak <kzak@redhat.com> +(cherry picked from commit 7e357241b413a01c37b0b4d064bc0a47e3259361) +--- + libblkid/src/config.c | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/libblkid/src/config.c b/libblkid/src/config.c +index 7b8b04f..66c1864 100644 +--- a/libblkid/src/config.c ++++ b/libblkid/src/config.c +@@ -153,6 +153,8 @@ struct blkid_config *blkid_read_config(const char *filename) + #else /* !HAVE_LIBECONF */ + + static econf_file *file = NULL; ++ char *line = NULL; ++ bool uevent = false; + econf_err error; + + if (filename) { +@@ -187,7 +189,6 @@ struct blkid_config *blkid_read_config(const char *filename) + } + } + +- bool uevent = false; + if ((error = econf_getBoolValue(file, NULL, "SEND_UEVENT", &uevent))) { + if (error != ECONF_NOKEY) { + DBG(CONFIG, ul_debug("couldn't fetch SEND_UEVENT corrently: %s", econf_errString(error))); +@@ -209,7 +210,6 @@ struct blkid_config *blkid_read_config(const char *filename) + } + } + +- char *line = NULL; + if ((error = econf_getStringValue(file, NULL, "EVALUATE", &line))) { + conf->nevals = 0; + if (error != ECONF_NOKEY) { +@@ -219,7 +219,7 @@ struct blkid_config *blkid_read_config(const char *filename) + DBG(CONFIG, ul_debug("key CACHE_FILE not found, using built-in default ")); + } + } else { +- if (*line && parse_evaluate(conf, line) == -1) ++ if (line && *line && parse_evaluate(conf, line) == -1) + goto err; + } + +@@ -238,8 +238,8 @@ dflt: + if (f) + fclose(f); + #else +- econf_free (file); +- free (line); ++ econf_free(file); ++ free(line); + #endif + return conf; + err: +@@ -248,8 +248,8 @@ err: + #ifndef HAVE_LIBECONF + fclose(f); + #else +- econf_free (file); +- free (line); ++ econf_free(file); ++ free(line); + #endif + return NULL; + } diff --git a/debian/patches/upstream/libblkid-topology-ioctl-correctly-handle-kernel-types.patch b/debian/patches/upstream/libblkid-topology-ioctl-correctly-handle-kernel-types.patch new file mode 100644 index 0000000..8f28f7f --- /dev/null +++ b/debian/patches/upstream/libblkid-topology-ioctl-correctly-handle-kernel-types.patch @@ -0,0 +1,89 @@ +From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= <thomas@t-8ch.de> +Date: Tue, 2 Apr 2024 18:55:29 +0200 +Subject: libblkid: topology/ioctl: correctly handle kernel types +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Commit 5d71d711d07a ("libblkid: topolicy/ioctl: use union for multiple data types") +incorrectly assumed that set_ulong and set_int refer to the type +returned by the kernel. Instead the different function pointer names +refer to the types of the function pointers. +However all ioctls, except for the later added BLKGETDISKSEQ, return +32bit integers. +This made libblkid also interpret the upper 32bits too, leading to +garbage values. + +Introduce a new member 'kernel_size' to also handle the 64bit +BLKGETDISKSEQ. + +Drop data.ul as it is no actually used. + +Closes #2904 +Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de> +(cherry picked from commit a10081a52c48a5232db30d8e0a7a7570cc8163ae) +--- + libblkid/src/topology/ioctl.c | 29 +++++++++++++++++++---------- + 1 file changed, 19 insertions(+), 10 deletions(-) + +diff --git a/libblkid/src/topology/ioctl.c b/libblkid/src/topology/ioctl.c +index 3560a2f..4be20e8 100644 +--- a/libblkid/src/topology/ioctl.c ++++ b/libblkid/src/topology/ioctl.c +@@ -24,6 +24,7 @@ + static const struct topology_val { + + long ioc; ++ size_t kernel_size; + + /* functions to set probing result */ + int (*set_ulong)(blkid_probe, unsigned long); +@@ -31,11 +32,16 @@ static const struct topology_val { + int (*set_u64)(blkid_probe, uint64_t); + + } topology_vals[] = { +- { BLKALIGNOFF, NULL, blkid_topology_set_alignment_offset }, +- { BLKIOMIN, blkid_topology_set_minimum_io_size }, +- { BLKIOOPT, blkid_topology_set_optimal_io_size }, +- { BLKPBSZGET, blkid_topology_set_physical_sector_size }, +- { BLKGETDISKSEQ, .set_u64 = blkid_topology_set_diskseq }, ++ { BLKALIGNOFF, sizeof(int), ++ .set_int = blkid_topology_set_alignment_offset }, ++ { BLKIOMIN, sizeof(int), ++ .set_ulong = blkid_topology_set_minimum_io_size }, ++ { BLKIOOPT, sizeof(int), ++ .set_ulong = blkid_topology_set_optimal_io_size }, ++ { BLKPBSZGET, sizeof(int), ++ .set_ulong = blkid_topology_set_physical_sector_size }, ++ { BLKGETDISKSEQ, sizeof(uint64_t), ++ .set_u64 = blkid_topology_set_diskseq }, + /* we read BLKSSZGET in topology.c */ + }; + +@@ -48,18 +54,21 @@ static int probe_ioctl_tp(blkid_probe pr, + const struct topology_val *val = &topology_vals[i]; + int rc = 1; + union { +- unsigned long ul; +- int i; ++ int s32; + uint64_t u64; +- } data; ++ } data = { 0 }; + + if (ioctl(pr->fd, val->ioc, &data) == -1) + goto nothing; + ++ /* Convert from kernel to libblkid type */ ++ if (val->kernel_size == 4) ++ data.u64 = data.s32; ++ + if (val->set_int) +- rc = val->set_int(pr, data.i); ++ rc = val->set_int(pr, data.u64); + else if (val->set_ulong) +- rc = val->set_ulong(pr, data.ul); ++ rc = val->set_ulong(pr, data.u64); + else + rc = val->set_u64(pr, data.u64); + diff --git a/debian/patches/upstream/libblkid-topology-ioctl-simplify-ioctl-handling.patch b/debian/patches/upstream/libblkid-topology-ioctl-simplify-ioctl-handling.patch new file mode 100644 index 0000000..7dac8b2 --- /dev/null +++ b/debian/patches/upstream/libblkid-topology-ioctl-simplify-ioctl-handling.patch @@ -0,0 +1,117 @@ +From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= <thomas@t-8ch.de> +Date: Thu, 4 Apr 2024 07:24:58 +0200 +Subject: libblkid: topology/ioctl: simplify ioctl handling +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Coverity complains about the data copy within the union. +Instead unroll the loop which is less code and easier to follow. + +Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de> +(cherry picked from commit 2ab95860db0b7423906911b8b9e9f231332c2c11) +--- + libblkid/src/topology/ioctl.c | 85 ++++++++++++++----------------------------- + 1 file changed, 27 insertions(+), 58 deletions(-) + +diff --git a/libblkid/src/topology/ioctl.c b/libblkid/src/topology/ioctl.c +index 4be20e8..7b15c9e 100644 +--- a/libblkid/src/topology/ioctl.c ++++ b/libblkid/src/topology/ioctl.c +@@ -18,69 +18,38 @@ + + #include "topology.h" + +-/* +- * ioctl topology values +- */ +-static const struct topology_val { +- +- long ioc; +- size_t kernel_size; +- +- /* functions to set probing result */ +- int (*set_ulong)(blkid_probe, unsigned long); +- int (*set_int)(blkid_probe, int); +- int (*set_u64)(blkid_probe, uint64_t); +- +-} topology_vals[] = { +- { BLKALIGNOFF, sizeof(int), +- .set_int = blkid_topology_set_alignment_offset }, +- { BLKIOMIN, sizeof(int), +- .set_ulong = blkid_topology_set_minimum_io_size }, +- { BLKIOOPT, sizeof(int), +- .set_ulong = blkid_topology_set_optimal_io_size }, +- { BLKPBSZGET, sizeof(int), +- .set_ulong = blkid_topology_set_physical_sector_size }, +- { BLKGETDISKSEQ, sizeof(uint64_t), +- .set_u64 = blkid_topology_set_diskseq }, +- /* we read BLKSSZGET in topology.c */ +-}; +- + static int probe_ioctl_tp(blkid_probe pr, + const struct blkid_idmag *mag __attribute__((__unused__))) + { +- size_t i; +- +- for (i = 0; i < ARRAY_SIZE(topology_vals); i++) { +- const struct topology_val *val = &topology_vals[i]; +- int rc = 1; +- union { +- int s32; +- uint64_t u64; +- } data = { 0 }; +- +- if (ioctl(pr->fd, val->ioc, &data) == -1) +- goto nothing; +- +- /* Convert from kernel to libblkid type */ +- if (val->kernel_size == 4) +- data.u64 = data.s32; +- +- if (val->set_int) +- rc = val->set_int(pr, data.u64); +- else if (val->set_ulong) +- rc = val->set_ulong(pr, data.u64); +- else +- rc = val->set_u64(pr, data.u64); +- +- if (rc) +- goto err; +- } ++ uint64_t u64; ++ int s32; ++ ++ if (ioctl(pr->fd, BLKALIGNOFF, &s32) == -1) ++ return 1; ++ if (blkid_topology_set_alignment_offset(pr, s32)) ++ return -1; ++ ++ if (ioctl(pr->fd, BLKIOMIN, &s32) == -1) ++ return 1; ++ if (blkid_topology_set_minimum_io_size(pr, s32)) ++ return -1; ++ ++ if (ioctl(pr->fd, BLKIOOPT, &s32) == -1) ++ return 1; ++ if (blkid_topology_set_optimal_io_size(pr, s32)) ++ return -1; ++ ++ if (ioctl(pr->fd, BLKPBSZGET, &s32) == -1) ++ return 1; ++ if (blkid_topology_set_physical_sector_size(pr, s32)) ++ return -1; ++ ++ if (ioctl(pr->fd, BLKGETDISKSEQ, &u64) == -1) ++ return 1; ++ if (blkid_topology_set_physical_sector_size(pr, u64)) ++ return -1; + + return 0; +-nothing: +- return 1; +-err: +- return -1; + } + + const struct blkid_idinfo ioctl_tp_idinfo = diff --git a/debian/patches/upstream/libmount-Fix-access-check-for-utab-in-context.patch b/debian/patches/upstream/libmount-Fix-access-check-for-utab-in-context.patch new file mode 100644 index 0000000..a305ec8 --- /dev/null +++ b/debian/patches/upstream/libmount-Fix-access-check-for-utab-in-context.patch @@ -0,0 +1,39 @@ +From: Karel Zak <kzak@redhat.com> +Date: Mon, 22 Apr 2024 13:09:04 +0200 +Subject: libmount: Fix access check for utab in context + +The function mnt_has_regular_utab() properly detects that the utab is +not writable, but this is ignored by the high-level context API. As a +result, the library later attempts to update the file and ends up with +a warning in mount(8): + + $ mkdir sys + $ unshare --map-root-user --mount + $ mount --rbind /sys sys + $ umount --lazy sys; echo $? + umount: /home/user/sys: filesystem was unmounted, but failed to update userspace mount table. + 16 + +In this case, the utab should be ignored. + +Fixes: https://github.com/util-linux/util-linux/issues/2981 +Signed-off-by: Karel Zak <kzak@redhat.com> +(cherry picked from commit 97f7bfc0fdf74b6a6e220ba9d2f620386e660b29) +--- + libmount/src/context.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/libmount/src/context.c b/libmount/src/context.c +index 952287a..5206c1d 100644 +--- a/libmount/src/context.c ++++ b/libmount/src/context.c +@@ -367,8 +367,7 @@ const char *mnt_context_get_writable_tabpath(struct libmnt_context *cxt) + { + assert(cxt); + +- context_init_paths(cxt, 1); +- return cxt->utab_path; ++ return mnt_context_utab_writable(cxt) ? cxt->utab_path : NULL; + } + + diff --git a/debian/patches/upstream/libmount-fix-comment-typo-for-mnt_fs_get_comment.patch b/debian/patches/upstream/libmount-fix-comment-typo-for-mnt_fs_get_comment.patch new file mode 100644 index 0000000..27f8867 --- /dev/null +++ b/debian/patches/upstream/libmount-fix-comment-typo-for-mnt_fs_get_comment.patch @@ -0,0 +1,23 @@ +From: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> +Date: Mon, 22 Apr 2024 14:01:25 +0800 +Subject: libmount: fix comment typo for mnt_fs_get_comment() + +Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> +(cherry picked from commit c630dbc38f7cd1f838e65e2c43d8375bce1ec20f) +--- + libmount/src/fs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libmount/src/fs.c b/libmount/src/fs.c +index 79e32a1..26f2c69 100644 +--- a/libmount/src/fs.c ++++ b/libmount/src/fs.c +@@ -1454,7 +1454,7 @@ int mnt_fs_get_attribute(struct libmnt_fs *fs, const char *name, + * mnt_fs_get_comment: + * @fs: fstab/mtab/mountinfo entry pointer + * +- * Returns: 0 on success, 1 when not found the @name or negative number in case of error. ++ * Returns: comment string + */ + const char *mnt_fs_get_comment(struct libmnt_fs *fs) + { diff --git a/debian/patches/upstream/libsmartcols-reset-wrap-after-calculation.patch b/debian/patches/upstream/libsmartcols-reset-wrap-after-calculation.patch new file mode 100644 index 0000000..0f27560 --- /dev/null +++ b/debian/patches/upstream/libsmartcols-reset-wrap-after-calculation.patch @@ -0,0 +1,88 @@ +From: Karel Zak <kzak@redhat.com> +Date: Tue, 16 Apr 2024 10:49:31 +0200 +Subject: libsmartcols: reset wrap after calculation + +Fixes: https://github.com/util-linux/util-linux/issues/2956 +Signed-off-by: Karel Zak <kzak@redhat.com> +(cherry picked from commit 62f64717ec134b10c5a670403c2d8c43b608e671) +--- + libsmartcols/src/calculate.c | 7 +++++-- + libsmartcols/src/print.c | 20 +++++++++++++------- + 2 files changed, 18 insertions(+), 9 deletions(-) + +diff --git a/libsmartcols/src/calculate.c b/libsmartcols/src/calculate.c +index 84198da..deabb07 100644 +--- a/libsmartcols/src/calculate.c ++++ b/libsmartcols/src/calculate.c +@@ -413,10 +413,8 @@ int __scols_calculate(struct libscols_table *tb, struct ul_buffer *buf) + size_t colsepsz; + int sorted = 0; + +- + DBG(TAB, ul_debugobj(tb, "-----calculate-(termwidth=%zu)-----", tb->termwidth)); + tb->is_dummy_print = 1; +- + colsepsz = scols_table_is_noencoding(tb) ? + mbs_width(colsep(tb)) : + mbs_safe_width(colsep(tb)); +@@ -430,6 +428,11 @@ int __scols_calculate(struct libscols_table *tb, struct ul_buffer *buf) + while (scols_table_next_column(tb, &itr, &cl) == 0) { + int is_last; + ++ memset(&cl->wstat, 0, sizeof(cl->wstat)); ++ cl->width = 0; ++ cl->width_treeart = 0; ++ scols_column_reset_wrap(cl); ++ + if (scols_column_is_hidden(cl)) + continue; + +diff --git a/libsmartcols/src/print.c b/libsmartcols/src/print.c +index 88ab5a2..ab279e3 100644 +--- a/libsmartcols/src/print.c ++++ b/libsmartcols/src/print.c +@@ -764,11 +764,11 @@ notree: + } + } + ++done: + /* reset wrapping after greatest chunk calculation */ + if (cal && scols_column_is_wrap(cl)) + scols_column_reset_wrap(cl); + +-done: + DBG(COL, ul_debugobj(cl, "__cursor_to_buffer rc=%d", rc)); + return rc; + } +@@ -802,8 +802,12 @@ static int print_line(struct libscols_table *tb, + rc = __cursor_to_buffer(tb, buf, 0); + if (!rc) + rc = print_data(tb, buf); +- if (!rc && scols_column_has_pending_wrap(cl)) +- pending = 1; ++ if (!rc) { ++ if (scols_column_has_pending_wrap(cl)) ++ pending = 1; ++ else ++ scols_column_reset_wrap(cl); ++ } + scols_table_reset_cursor(tb); + } + fputs_color_line_close(tb); +@@ -827,10 +831,12 @@ static int print_line(struct libscols_table *tb, + rc = __cursor_to_buffer(tb, buf, 0); + if (!rc) + rc = print_pending_data(tb, buf); +- if (!rc && scols_column_has_pending_wrap(cl)) +- pending = 1; +- if (!rc && !pending) +- scols_column_reset_wrap(cl); ++ if (!rc) { ++ if (scols_column_has_pending_wrap(cl)) ++ pending = 1; ++ else ++ scols_column_reset_wrap(cl); ++ } + } else + print_empty_cell(tb, cl, ln, NULL, ul_buffer_get_bufsiz(buf)); + scols_table_reset_cursor(tb); diff --git a/debian/patches/upstream/lsblk-simplify-SOURCES-code.patch b/debian/patches/upstream/lsblk-simplify-SOURCES-code.patch new file mode 100644 index 0000000..e7cde87 --- /dev/null +++ b/debian/patches/upstream/lsblk-simplify-SOURCES-code.patch @@ -0,0 +1,61 @@ +From: Karel Zak <kzak@redhat.com> +Date: Mon, 22 Apr 2024 11:51:56 +0200 +Subject: lsblk: simplify SOURCES code + +This complicated implementation originated from an early version of +zero-separated items for libsmartcols. It is no longer necessary. + +References: https://github.com/util-linux/util-linux/pull/2983 +Signed-off-by: Karel Zak <kzak@redhat.com> +(cherry picked from commit af4c7dac191abadc33aae75916583c890cd2ebc3) +--- + libsmartcols/src/column.c | 2 +- + misc-utils/lsblk.c | 8 +++----- + 2 files changed, 4 insertions(+), 6 deletions(-) + +diff --git a/libsmartcols/src/column.c b/libsmartcols/src/column.c +index 5700bac..586a485 100644 +--- a/libsmartcols/src/column.c ++++ b/libsmartcols/src/column.c +@@ -470,7 +470,7 @@ char *scols_wrapnl_nextchunk(const struct libscols_column *cl __attribute__((unu + * This is built-in function for scols_column_set_wrapfunc(). This function + * walk string separated by \0. + * +- * For example for data "AAA\0BBB\0CCC" the next chunk is "BBB". ++ * For example for data "AAA\0BBB\0CCC\0" the next chunk is "BBB". + * + * Returns: next chunk + * +diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c +index 30bd2ed..15d9b19 100644 +--- a/misc-utils/lsblk.c ++++ b/misc-utils/lsblk.c +@@ -935,8 +935,7 @@ static char *device_get_data( + ul_buffer_append_string(&buf, "[SWAP]"); + else + ul_buffer_append_string(&buf, mnt_fs_get_target(fs)); +- if (i + 1 < n) +- ul_buffer_append_data(&buf, "\0", 1); ++ ul_buffer_append_data(&buf, "\0", 1); + } + str = ul_buffer_get_data(&buf, datasiz, NULL); + break; +@@ -953,8 +952,7 @@ static char *device_get_data( + if (mnt_fs_is_swaparea(fs)) + continue; + ul_buffer_append_string(&buf, root ? root : "/"); +- if (i + 1 < n) +- ul_buffer_append_data(&buf, "\0", 1); ++ ul_buffer_append_data(&buf, "\0", 1); + } + str = ul_buffer_get_data(&buf, datasiz, NULL); + break; +@@ -1276,7 +1274,7 @@ static void device_fill_scols_cell(struct lsblk_device *dev, + ce = scols_line_get_cell(ln, colnum); + if (!ce) + return; +- rc = datasiz ? scols_cell_refer_memory(ce, data, datasiz + 1) ++ rc = datasiz ? scols_cell_refer_memory(ce, data, datasiz) + : scols_cell_refer_data(ce, data); + if (rc) + err(EXIT_FAILURE, _("failed to add output data")); diff --git a/debian/patches/upstream/lslocks-don-t-abort-gathering-per-process-information-eve.patch b/debian/patches/upstream/lslocks-don-t-abort-gathering-per-process-information-eve.patch new file mode 100644 index 0000000..59abf34 --- /dev/null +++ b/debian/patches/upstream/lslocks-don-t-abort-gathering-per-process-information-eve.patch @@ -0,0 +1,77 @@ +From: Masatake YAMATO <yamato@redhat.com> +Date: Sat, 13 Apr 2024 03:59:39 +0900 +Subject: lslocks: don't abort gathering per-process information even if + opening a /proc/[0-9]* fails + +If a process ($pid) taking a lock is gone while running lslocks, +gathering per-process information for the process may fail in opening +/proc/$pid. Though lslocks should work with incomplete information, +the original code stopped gathering per-process information for the +other processes. + +As a result of the original behavior, tests/ts/lslocks/lslocks really +failed in an environment where multiple test cases ran simultaneously. + +Close #2624 again. +See also #2633. + +Signed-off-by: Masatake YAMATO <yamato@redhat.com> +(cherry picked from commit 20df923cc3d2da12a5296223c3ff0de7484cc587) +--- + misc-utils/lslocks.c | 6 ++---- + tests/ts/lslocks/lslocks | 11 ----------- + 2 files changed, 2 insertions(+), 15 deletions(-) + +diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c +index 3d70b04..60f6595 100644 +--- a/misc-utils/lslocks.c ++++ b/misc-utils/lslocks.c +@@ -513,10 +513,8 @@ static int get_pids_locks(void *locks, void (*add_lock)(void *, struct lock *)) + if (procfs_dirent_get_pid(d, &pid) != 0) + continue; + +- if (procfs_process_init_path(pc, pid) != 0) { +- rc = -1; +- break; +- } ++ if (procfs_process_init_path(pc, pid) != 0) ++ continue; + + if (procfs_process_get_cmdname(pc, buf, sizeof(buf)) <= 0) + continue; +diff --git a/tests/ts/lslocks/lslocks b/tests/ts/lslocks/lslocks +index 912fac8..a9ef69a 100755 +--- a/tests/ts/lslocks/lslocks ++++ b/tests/ts/lslocks/lslocks +@@ -53,14 +53,6 @@ OFD_METHODS=( + lease-w + ) + +-SLEEP() +-{ +- # It appears that there is a time lag between locking and its +- # visibility in /proc/locks. See the unstbale results of errors I +- # observed in https://github.com/util-linux/util-linux/pull/2629. +- sleep 1 +-} +- + DFD=18 + COLS_WITH_HOLDERS=COMMAND,TYPE,SIZE,MODE,START,END,HOLDERS + run_lslocks() +@@ -71,8 +63,6 @@ run_lslocks() + rm -f "${FILE}" + coproc MKFDS { "$TS_HELPER_MKFDS" make-regular-file $FD file="$FILE" lock=$m; } + if read -r -u "${MKFDS[0]}" PID; then +- SLEEP +- + "$TS_CMD_LSLOCKS" ${OPTS} --pid "${PID}" -o "${COLS}" + echo "# $m + ${COLS} + ${OPTS}": $? + "$TS_CMD_LSLOCKS" ${OPTS} --pid "${PID}" -o PATH | sed -e 's#.*\('"$FILE0"'\)--[0-9]\+ *$#\1#' +@@ -91,7 +81,6 @@ run_lslocks_with_co_holders() + { + rm -f "${FILE}" + coproc MKFDS { "$TS_HELPER_MKFDS" make-regular-file $FD file="$FILE" lock=$m dupfd=$DFD; } +- SLEEP + if read -r -u "${MKFDS[0]}" PID; then + "$TS_CMD_LSLOCKS" ${OPTS} --pid "${PID}" -o "${COLS_WITH_HOLDERS}" | sed -e "s/${PID},/1,/g" + echo "# $m + ${COLS_WITH_HOLDERS} + ${OPTS}": ${PIPESTATUS[0]} diff --git a/debian/patches/upstream/lslocks-remove-a-unused-local-variable.patch b/debian/patches/upstream/lslocks-remove-a-unused-local-variable.patch new file mode 100644 index 0000000..b1547cc --- /dev/null +++ b/debian/patches/upstream/lslocks-remove-a-unused-local-variable.patch @@ -0,0 +1,37 @@ +From: Masatake YAMATO <yamato@redhat.com> +Date: Sat, 13 Apr 2024 04:13:03 +0900 +Subject: lslocks: remove a unused local variable + +Signed-off-by: Masatake YAMATO <yamato@redhat.com> +(cherry picked from commit c8c85e8e54aa201766f2420e2a7c86ccfa8d5df0) +--- + misc-utils/lslocks.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c +index 60f6595..176173f 100644 +--- a/misc-utils/lslocks.c ++++ b/misc-utils/lslocks.c +@@ -490,12 +490,11 @@ static int get_pid_locks(void *locks, void (*add_lock)(void *, struct lock *), s + return rc; + } + +-static int get_pids_locks(void *locks, void (*add_lock)(void *, struct lock *)) ++static void get_pids_locks(void *locks, void (*add_lock)(void *, struct lock *)) + { + DIR *dir; + struct dirent *d; + struct path_cxt *pc = NULL; +- int rc = 0; + + pc = ul_new_path(NULL); + if (!pc) +@@ -526,7 +525,7 @@ static int get_pids_locks(void *locks, void (*add_lock)(void *, struct lock *)) + closedir(dir); + ul_unref_path(pc); + +- return rc; ++ return; + } + + static int get_proc_locks(void *locks, void (*add_lock)(void *, struct lock *), void *fallback) diff --git a/debian/patches/upstream/lsns-fix-netns-use.patch b/debian/patches/upstream/lsns-fix-netns-use.patch new file mode 100644 index 0000000..1d1c8b6 --- /dev/null +++ b/debian/patches/upstream/lsns-fix-netns-use.patch @@ -0,0 +1,33 @@ +From: Karel Zak <kzak@redhat.com> +Date: Mon, 22 Apr 2024 14:28:52 +0200 +Subject: lsns: fix netns use + + # ip netns add vpn + # lsns -T -t net + Segmentation fault (core dumped) + +The function interpolate_missing_namespaces() reads data from /proc. +However, in the case of a persistent namespace, there is no procfs +entry for the namespace. Therefore, this function should ignore it. + +Fixes: https://github.com/util-linux/util-linux/issues/2982 +Signed-off-by: Karel Zak <kzak@redhat.com> +(cherry picked from commit 42880f54894c1d7fd113552ff8474566a2595a0d) +--- + sys-utils/lsns.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c +index 4ea01d2..6c87c47 100644 +--- a/sys-utils/lsns.c ++++ b/sys-utils/lsns.c +@@ -793,6 +793,9 @@ static void interpolate_missing_namespaces(struct lsns *ls, struct lsns_namespac + int fd_orphan, fd_missing; + struct stat st; + ++ if (!orphan->proc) ++ return; ++ + orphan->related_ns[rela] = get_namespace(ls, orphan->related_id[rela]); + if (orphan->related_ns[rela]) + return; diff --git a/debian/patches/upstream/lsns-report-with-warnx-if-a-namespace-related-ioctl-fails.patch b/debian/patches/upstream/lsns-report-with-warnx-if-a-namespace-related-ioctl-fails.patch new file mode 100644 index 0000000..fd57faf --- /dev/null +++ b/debian/patches/upstream/lsns-report-with-warnx-if-a-namespace-related-ioctl-fails.patch @@ -0,0 +1,27 @@ +From: Masatake YAMATO <yamato@redhat.com> +Date: Mon, 15 Apr 2024 01:44:38 +0900 +Subject: lsns: report with warnx if a namespace related ioctl fails with + ENOSYS + +Qemu userspace emulation reports ENOSYS if it doesn't support a given +ioctl command. + +Signed-off-by: Masatake YAMATO <yamato@redhat.com> +(cherry picked from commit 0a7a8fbc7a82dfbd9e925d1b4d4936bf4e011bc1) +--- + sys-utils/lsns.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c +index e68bdbe..1f3574f 100644 +--- a/sys-utils/lsns.c ++++ b/sys-utils/lsns.c +@@ -68,7 +68,7 @@ UL_DEBUG_DEFINE_MASKNAMES(lsns) = UL_DEBUG_EMPTY_MASKNAMES; + + #define lsns_ioctl(fildes, request, ...) __extension__ ({ \ + int ret = ioctl(fildes, request, ##__VA_ARGS__); \ +- if (ret == -1 && errno == ENOTTY) \ ++ if (ret == -1 && (errno == ENOTTY || errno == ENOSYS)) \ + warnx("Unsupported ioctl %s", #request); \ + ret; }) + diff --git a/debian/patches/upstream/lsns-tolerate-lsns_ioctl-fd-NS_GET_-PARENT-USERNS-failing.patch b/debian/patches/upstream/lsns-tolerate-lsns_ioctl-fd-NS_GET_-PARENT-USERNS-failing.patch new file mode 100644 index 0000000..ff17dc2 --- /dev/null +++ b/debian/patches/upstream/lsns-tolerate-lsns_ioctl-fd-NS_GET_-PARENT-USERNS-failing.patch @@ -0,0 +1,49 @@ +From: Masatake YAMATO <yamato@redhat.com> +Date: Sun, 14 Apr 2024 01:40:14 +0900 +Subject: lsns: tolerate lsns_ioctl(fd, + NS_GET_{PARENT,USERNS}) failing with ENOSYS + +With the original code, "lsns/filedesc" test case failed on +"build (qemu-user, s390x)" and "build (qemu-user, riscv64)". + +On the platforms, lsns_ioctl(fd, NS_GET_{PARENT,USERNS}) failed +with ENOSYS. The error stoped the iteration for gathering +information from /proc/[0-9]+. As a result, lsns printed +nothing. We don't expect this behavior. + +Signed-off-by: Masatake YAMATO <yamato@redhat.com> +(cherry picked from commit f2a8b20d9c63f771d1fddd639ea1ec3fe034dc6d) +--- + sys-utils/lsns.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c +index 1f3574f..4ea01d2 100644 +--- a/sys-utils/lsns.c ++++ b/sys-utils/lsns.c +@@ -308,7 +308,11 @@ static int get_ns_ino(int dir, const char *nsname, ino_t *ino, ino_t *pino, ino_ + return -errno; + if (strcmp(nsname, "pid") == 0 || strcmp(nsname, "user") == 0) { + if ((pfd = lsns_ioctl(fd, NS_GET_PARENT)) < 0) { +- if (errno == EPERM) ++ if (errno == EPERM ++ /* On the test platforms, "build (qemu-user, s390x)" and ++ * "build (qemu-user, riscv64)", the ioctl reported ENOSYS. ++ */ ++ || errno == ENOSYS) + goto user; + close(fd); + return -errno; +@@ -323,7 +327,11 @@ static int get_ns_ino(int dir, const char *nsname, ino_t *ino, ino_t *pino, ino_ + } + user: + if ((ofd = lsns_ioctl(fd, NS_GET_USERNS)) < 0) { +- if (errno == EPERM) ++ if (errno == EPERM ++ /* On the test platforms, "build (qemu-user, s390x)" and ++ * "build (qemu-user, riscv64)", the ioctl reported ENOSYS. ++ */ ++ || errno == ENOSYS) + goto out; + close(fd); + return -errno; diff --git a/debian/patches/upstream/pam_lastlog2-link-against-liblastlog.patch b/debian/patches/upstream/pam_lastlog2-link-against-liblastlog.patch new file mode 100644 index 0000000..6d299b2 --- /dev/null +++ b/debian/patches/upstream/pam_lastlog2-link-against-liblastlog.patch @@ -0,0 +1,32 @@ +From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= <thomas@t-8ch.de> +Date: Mon, 1 Apr 2024 22:53:32 +0200 +Subject: pam_lastlog2: link against liblastlog +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +While at it also drop the duplicated include path. + +Fixes #2897 +Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de> +(cherry picked from commit 2722b40012740372daf3585b7c071fcbede13359) +--- + pam_lastlog2/src/Makemodule.am | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/pam_lastlog2/src/Makemodule.am b/pam_lastlog2/src/Makemodule.am +index 9884416..f9a9b6b 100644 +--- a/pam_lastlog2/src/Makemodule.am ++++ b/pam_lastlog2/src/Makemodule.am +@@ -10,8 +10,9 @@ EXTRA_pam_lastlog2_la_DEPENDENCIES = \ + pam_lastlog2_la_CFLAGS = \ + $(AM_CFLAGS) \ + $(SOLIB_CFLAGS) \ +- -I$(ul_liblastlog2_incdir) \ +- -Iliblastlog2/src ++ -I$(ul_liblastlog2_incdir) ++ ++pam_lastlog2_la_LIBADD = liblastlog2.la + + pam_lastlog2_la_LDFLAGS = $(SOLIB_LDFLAGS) -module -avoid-version -shared + if HAVE_VSCRIPT diff --git a/debian/util-linux-extra.lintian-overrides b/debian/util-linux-extra.lintian-overrides new file mode 100644 index 0000000..d970402 --- /dev/null +++ b/debian/util-linux-extra.lintian-overrides @@ -0,0 +1,2 @@ +# DEP17 P1 mitigation +diversion-for-unknown-file sbin/* [preinst:*] diff --git a/debian/util-linux-extra.postinst b/debian/util-linux-extra.postinst deleted file mode 100755 index 82923bd..0000000 --- a/debian/util-linux-extra.postinst +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -set -e - -# begin-remove-after: released:trixie -if test "$1" = upgrade || test "$1" = install; then - dpkg-divert --no-rename --package util-linux-extra --divert /sbin/fsck.cramfs.usr-is-merged --add /sbin/fsck.cramfs - dpkg-divert --no-rename --package util-linux-extra --divert /sbin/fsck.minix.usr-is-merged --add /sbin/fsck.minix - dpkg-divert --no-rename --package util-linux-extra --divert /sbin/mkfs.bfs.usr-is-merged --add /sbin/mkfs.bfs - dpkg-divert --no-rename --package util-linux-extra --divert /sbin/mkfs.cramfs.usr-is-merged --add /sbin/mkfs.cramfs - dpkg-divert --no-rename --package util-linux-extra --divert /sbin/mkfs.minix.usr-is-merged --add /sbin/mkfs.minix -fi -# end-remove-after - -#DEBHELPER# diff --git a/debian/util-linux-extra.postrm b/debian/util-linux-extra.postrm new file mode 100644 index 0000000..3e01a3a --- /dev/null +++ b/debian/util-linux-extra.postrm @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +if test "$1" = remove || test "$1" = disappear; then + dpkg-divert --no-rename --package util-linux-extra --divert /sbin/fsck.cramfs.usr-is-merged --remove /sbin/fsck.cramfs + dpkg-divert --no-rename --package util-linux-extra --divert /sbin/fsck.minix.usr-is-merged --remove /sbin/fsck.minix + dpkg-divert --no-rename --package util-linux-extra --divert /sbin/mkfs.bfs.usr-is-merged --remove /sbin/mkfs.bfs + dpkg-divert --no-rename --package util-linux-extra --divert /sbin/mkfs.cramfs.usr-is-merged --remove /sbin/mkfs.cramfs + dpkg-divert --no-rename --package util-linux-extra --divert /sbin/mkfs.minix.usr-is-merged --remove /sbin/mkfs.minix +fi + +#DEBHELPER# + diff --git a/debian/util-linux-extra.preinst b/debian/util-linux-extra.preinst index edd6522..0d9e13a 100755 --- a/debian/util-linux-extra.preinst +++ b/debian/util-linux-extra.preinst @@ -2,15 +2,12 @@ set -e -# begin-remove-after: released:trixie -if test "$1" = configure; then - dpkg-divert --no-rename --package util-linux-extra --divert /sbin/fsck.cramfs.usr-is-merged --remove /sbin/fsck.cramfs - dpkg-divert --no-rename --package util-linux-extra --divert /sbin/fsck.minix.usr-is-merged --remove /sbin/fsck.minix - dpkg-divert --no-rename --package util-linux-extra --divert /sbin/mkfs.bfs.usr-is-merged --remove /sbin/mkfs.bfs - dpkg-divert --no-rename --package util-linux-extra --divert /sbin/mkfs.cramfs.usr-is-merged --remove /sbin/mkfs.cramfs - dpkg-divert --no-rename --package util-linux-extra --divert /sbin/mkfs.minix.usr-is-merged --remove /sbin/mkfs.minix +if test "$1" = upgrade || test "$1" = install; then + dpkg-divert --no-rename --package util-linux-extra --divert /sbin/fsck.cramfs.usr-is-merged --add /sbin/fsck.cramfs + dpkg-divert --no-rename --package util-linux-extra --divert /sbin/fsck.minix.usr-is-merged --add /sbin/fsck.minix + dpkg-divert --no-rename --package util-linux-extra --divert /sbin/mkfs.bfs.usr-is-merged --add /sbin/mkfs.bfs + dpkg-divert --no-rename --package util-linux-extra --divert /sbin/mkfs.cramfs.usr-is-merged --add /sbin/mkfs.cramfs + dpkg-divert --no-rename --package util-linux-extra --divert /sbin/mkfs.minix.usr-is-merged --add /sbin/mkfs.minix fi -# end-remove-after #DEBHELPER# - |