]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Merge branch 'libblkid/topology-diskseq' of https://github.com/t-8ch/util-linux
authorKarel Zak <kzak@redhat.com>
Mon, 2 Jan 2023 12:32:58 +0000 (13:32 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 2 Jan 2023 12:32:58 +0000 (13:32 +0100)
* 'libblkid/topology-diskseq' of https://github.com/t-8ch/util-linux:
  libblkid: topology: probe diskseq
  libblkid: topology: allow setting of 64bit values
  lib/sysfs: allow parent redirect even for non-queue files
  blockdev: add support for ioctl BLKGETDISKSEQ
  libblkid: topology: add test
  tests: functions: allow partitions on loopdevs

48 files changed:
.packit.yaml [new file with mode: 0644]
AUTHORS
bash-completion/umount
disk-utils/meson.build
include/pathnames.h
include/sysfs.h
lib/meson.build
lib/procfs.c
lib/sysfs.c
libblkid/src/partitions/bsd.c
libblkid/src/partitions/gpt.c
libblkid/src/partitions/sgi.c
libblkid/src/partitions/sun.c
libblkid/src/superblocks/lvm.c
libblkid/src/superblocks/zfs.c
libblkid/src/topology/dm.c
libblkid/src/topology/ioctl.c
libblkid/src/topology/lvm.c
libblkid/src/topology/sysfs.c
libmount/meson.build
login-utils/meson.build
meson.build
meson_options.txt
misc-utils/fadvise.c
misc-utils/lsblk-properties.c
misc-utils/lsblk.8.adoc
misc-utils/lsblk.c
misc-utils/lsblk.h
misc-utils/meson.build
misc-utils/rename.1.adoc
sys-utils/Makemodule.am
sys-utils/hwclock.c
sys-utils/setarch.c
tests/commands.sh
tests/expected/lib/procfs-one-process [new file with mode: 0644]
tests/expected/lib/procfs-stat-nth [new file with mode: 0644]
tests/expected/lib/procfs-stat-nth.err [new file with mode: 0644]
tests/ts/lib/procfs [new file with mode: 0755]
tests/ts/lib/procfs-data/proc/1/cmdline [new file with mode: 0644]
tests/ts/lib/procfs-data/proc/1/comm [new file with mode: 0644]
tests/ts/lib/procfs-data/proc/1/stat [new file with mode: 0644]
tests/ts/lib/procfs-data/proc/2/cmdline [new file with mode: 0644]
tests/ts/lib/procfs-data/proc/2/comm [new file with mode: 0644]
tests/ts/lib/procfs-data/proc/2/stat [new file with mode: 0644]
tests/ts/lib/procfs-data/proc/3/cmdline [new file with mode: 0644]
tests/ts/lib/procfs-data/proc/3/comm [new file with mode: 0644]
tests/ts/lib/procfs-data/proc/3/stat [new file with mode: 0644]
tests/ts/lsns/ioctl_ns

diff --git a/.packit.yaml b/.packit.yaml
new file mode 100644 (file)
index 0000000..7fbbe31
--- /dev/null
@@ -0,0 +1,52 @@
+---
+# vi:ts=2 sw=2 et:
+#
+# Docs: https://packit.dev/docs/
+
+specfile_path: .packit_rpm/util-linux.spec
+files_to_sync:
+  - .packit.yaml
+  - src: .packit_rpm/util-linux.spec
+    dest: util-linux.spec
+upstream_package_name: util-linux
+downstream_package_name: util-linux
+# `git describe` returns in util-linux's case 'v2.37.2-xxx' which breaks RPM version
+# # detection (that expects 2.37.2-xxx'). Let's tweak the version string accordingly
+upstream_tag_template: "v{version}"
+srpm_build_deps: []
+
+actions:
+  post-upstream-clone:
+    # Use a spec file from Fedora Rawhide
+    - "git clone https://src.fedoraproject.org/rpms/util-linux.git .packit_rpm --depth=1"
+    # Drop the "sources" file so rebase-helper doesn't think we're a dist-git
+    - "rm -fv .packit_rpm/sources"
+    # Drop all patches, since they're already included in the tarball
+    - "sed -ri '/^Patch[0-9]+:/d' .packit_rpm/util-linux.spec"
+    # Install additional dependencies we need for the build/tests
+    - "sed -i '/^### Dependencies/aBuildRequires: autoconf automake bc bison iproute libtool procps-ng socat' .packit_rpm/util-linux.spec"
+    # We need to call autogen, since we use a custom tarball
+    - "sed -i '/^unset LINGUAS/a./autogen.sh' .packit_rpm/util-linux.spec"
+    # Enable tests after build
+    - "sed -i '/^### Macros/a%define _with_check 1' .packit_rpm/util-linux.spec"
+    # Ignore unpackaged files
+    - "sed -i '1 i%define _unpackaged_files_terminate_build 0' .packit_rpm/util-linux.spec"
+  create-archive:
+    # We need to override the default create-archive action, since we need to tweak
+    # the resulting tarball and add a .tarball-version file to it, otherwise
+    # util-linux fails to detect its version during build
+    - "bash -c 'echo $PACKIT_PROJECT_VERSION >.tarball-version'"
+    - "bash -c 'git archive --prefix ${PACKIT_PROJECT_NAME_VERSION}/ --add-file .tarball-version --output .packit_rpm/${PACKIT_PROJECT_NAME_VERSION}.tar.gz HEAD'"
+    - "bash -c 'echo .packit_rpm/${PACKIT_PROJECT_NAME_VERSION}.tar.gz'"
+
+# Available targets can be listed via `copr-cli list-chroots`
+jobs:
+  # Build test
+  - job: copr_build
+    trigger: pull_request
+    targets:
+      - fedora-rawhide-aarch64
+      - fedora-rawhide-i386
+      - fedora-rawhide-ppc64le
+      - fedora-rawhide-s390x
+      - fedora-rawhide-x86_64
diff --git a/AUTHORS b/AUTHORS
index f0e88af190e9cf390165fb87d51102ba564b928e..228a7c69cfb4cf47a85e93282ffe2639507bbe4c 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -41,7 +41,7 @@ AUTHORS (merged projects & commands):
       libmount:        Karel Zak <kzak@redhat.com>
       libuuid:         Theodore Ts'o <tytso@mit.edu>
       lscpu:           Cai Qian <qcai@redhat.com>
-      lsblk:           Milan Broz <mbroz@redhat.com>
+      lsblk:           Milan Broz <gmazyland@gmail.com>
                        Karel Zak <kzak@redhat.com>
       lsfd:            Masatake YAMATO <yamato@redhat.com>
       lsipc:           Ondrej Oprala <ooprala@redhat.com>
@@ -612,7 +612,7 @@ CONTRIBUTORS:
       Miklos Szeredi <mszeredi@suse.cz>
       Mikulas Patocka <mpatocka@redhat.com>
       Milan Bouchet-Valat <nalimilan@club.fr>
-      Milan Broz <mbroz@redhat.com>
+      Milan Broz <gmazyland@gmail.com>
       Ming Lei <tom.leiming@gmail.com>
       Miquel van Smoorenburg <miquels@maestro.htsa.aha.nl>
       Mister Me <gdg@localhost.localdomain>
index 2988c42f394ee4977b76dd5940213783cc269f55..7650358ddd1032d7fa3a55be09228e5551a283ea 100644 (file)
@@ -3,16 +3,26 @@ _umount_points_list()
        # List of characters to escape shamelessly stolen from "scp" completion
        local escape_chars='[][(){}<>\",:;^&!$=?`|\\'\'' \t\f\n\r\v]'
 
-       findmnt -lno TARGET | awk '{
-               if ($0 ~ "^"ENVIRON["HOME"]) {
+       findmnt -lno TARGET | awk '
+
+       function literal_ere(s) {
+               gsub(/[][^$.*?+{}\\()|]/, "\\\\&", s)
+               return s
+       }
+
+       {
+               home_ere = literal_ere(ENVIRON["HOME"])
+               print home_ere
+               if ($0 ~ "^"home_ere) {
                        homeless = $0
-                       sub("^"ENVIRON["HOME"], "~", homeless)
+                       sub("^"home_ere, "~", homeless)
                        gsub("'"$escape_chars"'", "\\\\&", homeless)
                        print homeless " "
                }
-               if ($0 ~ "^"ENVIRON["PWD"]) {
+               pwd_ere = literal_ere(ENVIRON["PWD"])
+               if ($0 ~ "^"pwd_ere) {
                        reldir = $0
-                       sub("^"ENVIRON["PWD"]"/?", "", reldir)
+                       sub("^"pwd_ere"/?", "", reldir)
                        gsub("'"$escape_chars"'", "\\\\&", reldir)
                        print "./" reldir " "
                        print reldir " "
index c1419e66dc393d5931ead39fe6403e4bfdc5b822..2bf3558346ab38509092c9f9b0cfd2bb0f745b8e 100644 (file)
@@ -14,6 +14,9 @@ mkswap_sources = files(
   'mkswap.c',
 ) + \
   ismounted_c
+if lib_selinux.found()
+  mkswap_sources += selinux_utils_c
+endif
 
 swaplabel_sources = files(
   'swaplabel.c',
index afb6af56e881139b4d957b97f38b120e83ebb480..56f64c3870e9ebac06a2d64d960534fa0db347a2 100644 (file)
 #define _PATH_SYS_CLASS                "/sys/class"
 #define _PATH_SYS_SCSI         "/sys/bus/scsi"
 #define _PATH_SYS_CPU_BYTEORDER        "/sys/kernel/cpu_byteorder"
+#define _PATH_SYS_ADDRESS_BITS "/sys/kernel/address_bits"
 
 #define _PATH_SYS_SELINUX      "/sys/fs/selinux"
 #define _PATH_SYS_APPARMOR     "/sys/kernel/security/apparmor"
index 56e125b71f7d1e8bd4de68a5d2d7925bbc87dcef..c538f33a7250352347f228792f6448d9c6a663bf 100644 (file)
@@ -117,5 +117,6 @@ enum sysfs_byteorder {
 };
 
 extern enum sysfs_byteorder sysfs_get_byteorder(struct path_cxt *pc);
+extern int sysfs_get_address_bits(struct path_cxt *pc);
 
 #endif /* UTIL_LINUX_SYSFS_H */
index 6d08dfe4ab6ef2a48b51d9f3f4f1a54544fb79b5..57833aa7480e5a08689af13178ec63ebb15b771f 100644 (file)
@@ -57,6 +57,7 @@ logindefs_c = static_library('logindefs',
   include_directories : dir_include,
   dependencies : lib_econf,
 )
+selinux_utils_c = files('selinux-utils.c')
 
 if LINUX
   lib_common_sources += '''
index 1072a9a2ce90cdd20b1b0107f3457aa8d1266a5f..20fa514a0cb359b27c36a5256dc19409048db76c 100644 (file)
@@ -141,7 +141,7 @@ static ssize_t read_procfs_file(int fd, char *buf, size_t bufsz)
        return sz;
 }
 
-static ssize_t procfs_process_get_line_for(struct path_cxt *pc, char *buf, size_t bufsz,
+static ssize_t procfs_process_get_data_for(struct path_cxt *pc, char *buf, size_t bufsz,
                                            const char *fname)
 {
        int fd = ul_path_open(pc, O_RDONLY|O_CLOEXEC, fname);
@@ -156,17 +156,17 @@ static ssize_t procfs_process_get_line_for(struct path_cxt *pc, char *buf, size_
 
 ssize_t procfs_process_get_cmdline(struct path_cxt *pc, char *buf, size_t bufsz)
 {
-       return procfs_process_get_line_for(pc, buf, bufsz, "cmdline");
+       return procfs_process_get_data_for(pc, buf, bufsz, "cmdline");
 }
 
 ssize_t procfs_process_get_cmdname(struct path_cxt *pc, char *buf, size_t bufsz)
 {
-       return procfs_process_get_line_for(pc, buf, bufsz, "comm");
+       return procfs_process_get_data_for(pc, buf, bufsz, "comm");
 }
 
 ssize_t procfs_process_get_stat(struct path_cxt *pc, char *buf, size_t bufsz)
 {
-       return procfs_process_get_line_for(pc, buf, bufsz, "stat");
+       return procfs_process_get_data_for(pc, buf, bufsz, "stat");
 }
 
 int procfs_process_get_stat_nth(struct path_cxt *pc, int n, uintmax_t *re)
@@ -179,7 +179,7 @@ int procfs_process_get_stat_nth(struct path_cxt *pc, int n, uintmax_t *re)
        if (n == 2 || n == 3)           /* process name and status (strings) */
                return -EINVAL;
 
-       rc = procfs_process_get_line_for(pc, buf, sizeof(buf), "stat");
+       rc = procfs_process_get_data_for(pc, buf, sizeof(buf), "stat");
        if (rc < 0)
                return rc;
 
@@ -191,7 +191,7 @@ int procfs_process_get_stat_nth(struct path_cxt *pc, int n, uintmax_t *re)
                        return ul_strtou64(tok, re, 10);
 
                /* skip rest of the process name */
-               if (i == 2 && (p = strchr(key, ')')))
+               if (i == 2 && (p = strrchr(key, ')')))
                        key = p + 2;
        }
 
@@ -446,7 +446,7 @@ char *pid_get_cmdline(pid_t pid)
 
 #ifdef TEST_PROGRAM_PROCFS
 
-static int test_tasks(int argc, char *argv[])
+static int test_tasks(int argc, char *argv[], const char *prefix)
 {
        DIR *sub = NULL;
        struct path_cxt *pc;
@@ -458,7 +458,7 @@ static int test_tasks(int argc, char *argv[])
        pid = strtol(argv[1], (char **) NULL, 10);
        printf("PID=%d, TIDs:", pid);
 
-       pc = ul_new_procfs_path(pid, NULL);
+       pc = ul_new_procfs_path(pid, prefix);
        if (!pc)
                err(EXIT_FAILURE, "alloc procfs handler failed");
 
@@ -470,7 +470,7 @@ static int test_tasks(int argc, char *argv[])
        return EXIT_SUCCESS;
 }
 
-static int test_fds(int argc, char *argv[])
+static int test_fds(int argc, char *argv[], const char *prefix)
 {
        DIR *sub = NULL;
        struct path_cxt *pc;
@@ -483,7 +483,7 @@ static int test_fds(int argc, char *argv[])
        pid = strtol(argv[1], (char **) NULL, 10);
        printf("PID=%d, FDs:", pid);
 
-       pc = ul_new_procfs_path(pid, NULL);
+       pc = ul_new_procfs_path(pid, prefix);
        if (!pc)
                err(EXIT_FAILURE, "alloc procfs handler failed");
 
@@ -530,7 +530,7 @@ static int test_processes(int argc, char *argv[])
        return EXIT_SUCCESS;
 }
 
-static int test_one_process(int argc, char *argv[])
+static int test_one_process(int argc, char *argv[], const char *prefix)
 {
        pid_t pid;
        struct path_cxt *pc;
@@ -541,7 +541,7 @@ static int test_one_process(int argc, char *argv[])
                return EXIT_FAILURE;
        pid = strtol(argv[1], (char **) NULL, 10);
 
-       pc = ul_new_procfs_path(pid, NULL);
+       pc = ul_new_procfs_path(pid, prefix);
        if (!pc)
                err(EXIT_FAILURE, "cannot alloc procfs handler");
 
@@ -576,24 +576,25 @@ static int test_isprocfs(int argc, char *argv[])
        return is ? EXIT_SUCCESS : EXIT_FAILURE;
 }
 
-static int test_process_stat_nth(int argc, char *argv[])
+static int test_process_stat_nth(int argc, char *argv[], const char *prefix)
 {
        pid_t pid;
        struct path_cxt *pc;
        uintmax_t num = 0;
-       int n;
+       int n, ret;
 
        if (argc != 3)
                return EXIT_FAILURE;
        pid = strtol(argv[1], (char **) NULL, 10);
        n = strtol(argv[2], (char **) NULL, 10);
 
-       pc = ul_new_procfs_path(pid, NULL);
+       pc = ul_new_procfs_path(pid, prefix);
        if (!pc)
                err(EXIT_FAILURE, "cannot alloc procfs handler");
 
-       if (procfs_process_get_stat_nth(pc, n, &num) != 0)
-               err(EXIT_FAILURE, "read %dth number failed", n);
+       ret = procfs_process_get_stat_nth(pc, n, &num);
+       if (ret)
+               errx(EXIT_FAILURE, "read %dth number failed: %s", n, strerror(-ret));
 
        printf("%d: %dth %ju\n", (int) pid, n, num);
        ul_unref_path(pc);
@@ -602,29 +603,37 @@ static int test_process_stat_nth(int argc, char *argv[])
 
 int main(int argc, char *argv[])
 {
+       const char *prefix = NULL;
+
+       if (argc > 2 && strcmp(argv[1], "--prefix") == 0) {
+               prefix = argv[2];
+               argc -= 2;
+               argv += 2;
+       }
+
        if (argc < 2) {
-               fprintf(stderr, "usage: %1$s --tasks <pid>\n"
-                               "       %1$s --fds <pid>\n"
+               fprintf(stderr, "usage: %1$s [--prefix <prefix>] --tasks <pid>\n"
+                               "       %1$s [--prefix <prefix>] --fds <pid>\n"
                                "       %1$s --is-procfs [<dir>]\n"
-                               "       %1$s --processes [---name <name>] [--uid <uid>]\n"
-                               "       %1$s --one <pid>\n"
-                               "       %1$s --stat-nth <pid> <n>\n",
+                               "       %1$s --processes [--name <name>] [--uid <uid>]\n"
+                               "       %1$s [--prefix <prefix>] --one <pid>\n"
+                               "       %1$s [--prefix <prefix>] --stat-nth <pid> <n>\n",
                                program_invocation_short_name);
                return EXIT_FAILURE;
        }
 
        if (strcmp(argv[1], "--tasks") == 0)
-               return test_tasks(argc - 1, argv + 1);
+               return test_tasks(argc - 1, argv + 1, prefix);
        if (strcmp(argv[1], "--fds") == 0)
-               return test_fds(argc - 1, argv + 1);
+               return test_fds(argc - 1, argv + 1, prefix);
        if (strcmp(argv[1], "--processes") == 0)
                return test_processes(argc - 1, argv + 1);
        if (strcmp(argv[1], "--is-procfs") == 0)
                return test_isprocfs(argc - 1, argv + 1);
        if (strcmp(argv[1], "--one") == 0)
-               return test_one_process(argc - 1, argv + 1);
+               return test_one_process(argc - 1, argv + 1, prefix);
        if (strcmp(argv[1], "--stat-nth") == 0)
-               return test_process_stat_nth(argc - 1, argv + 1);
+               return test_process_stat_nth(argc - 1, argv + 1, prefix);
 
        return EXIT_FAILURE;
 }
index 4dfa54fa982f4d96879b1814040dc8364f35f22a..dd2637cdd3c901a344fd14a1e87a4628db19fdf2 100644 (file)
@@ -1103,6 +1103,19 @@ out:
        return ret;
 }
 
+int sysfs_get_address_bits(struct path_cxt *pc)
+{
+       int rc;
+       int address_bits;
+
+       rc = ul_path_scanf(pc, _PATH_SYS_ADDRESS_BITS, "%d", &address_bits);
+       if (rc < 0)
+               return rc;
+       if (address_bits < 0)
+               return -EINVAL;
+       return address_bits;
+}
+
 
 #ifdef TEST_PROGRAM_SYSFS
 #include <errno.h>
@@ -1187,7 +1200,7 @@ int main(int argc, char *argv[])
 
 
        chain = sysfs_blkdev_get_devchain(pc, path, sizeof(path));
-       printf(" SUBSUSTEMS:\n");
+       printf(" SUBSYSTEMS:\n");
 
        while (chain && sysfs_blkdev_next_subsystem(pc, chain, &sub) == 0) {
                printf("\t%s\n", sub);
index 7a0b23195e8e0b3387bcec48f699a4389185b785..ba120195ea08bc9a1aa988de02aa5fdeb797e7ce 100644 (file)
 #define BLKID_MAG_LASTOFFSET(_mag) \
                 (BLKID_MAG_OFFSET(_mag) - (BLKID_MAG_SECTOR(_mag) << 9))
 
+static uint16_t bsd_checksum(const struct bsd_disklabel *l)
+{
+       uint16_t v, csum = 0;
+       const char *end = (const char *) (l + 1);
+
+       for (const char *c = (const char *) l; c < end; c += sizeof(uint16_t)) {
+               memcpy(&v, c, sizeof(v));
+               csum ^= v;
+       }
+       return csum ^ le16_to_cpu(l->d_checksum);
+}
+
 static int probe_bsd_pt(blkid_probe pr, const struct blkid_idmag *mag)
 {
        struct bsd_disklabel *l;
@@ -52,6 +64,11 @@ static int probe_bsd_pt(blkid_probe pr, const struct blkid_idmag *mag)
 
        l = (struct bsd_disklabel *) (data + BLKID_MAG_LASTOFFSET(mag));
 
+       if (!blkid_probe_verify_csum(pr, bsd_checksum(l), le16_to_cpu(l->d_checksum))) {
+               rc = BLKID_PROBE_NONE;
+               goto nothing;
+       }
+
        ls = blkid_probe_get_partlist(pr);
        if (!ls)
                goto nothing;
index af6257ab7f8fb4f3e99e050156825228797fb4a8..89e7bb679b9d2245b6746df45f749a9186f57aa9 100644 (file)
@@ -241,7 +241,7 @@ static struct gpt_header *get_gpt_header(
                        offsetof(struct gpt_header, header_crc32),
                        sizeof(h->header_crc32));
 
-       if (crc != le32_to_cpu(h->header_crc32)) {
+       if (!blkid_probe_verify_csum(pr, crc, le32_to_cpu(h->header_crc32))) {
                DBG(LOWPROBE, ul_debug("GPT header corrupted"));
                return NULL;
        }
index 99c0bf1c73ea70035de5648eb259c7c51ecc7403..d4f81bbddf787fd0a75a3d349f5c50c4801a8d7c 100644 (file)
@@ -31,7 +31,7 @@ static int probe_sgi_pt(blkid_probe pr,
                goto nothing;
        }
 
-       if (sgi_pt_checksum(l)) {
+       if (!blkid_probe_verify_csum(pr, sgi_pt_checksum(l), 0)) {
                DBG(LOWPROBE, ul_debug(
                        "detected corrupted sgi disk label -- ignore"));
                goto nothing;
index 058a66372754e61b074f3148ebfedf66e8471138..ce24364f5144d5828106599ada29128369599239 100644 (file)
@@ -33,7 +33,7 @@ static int probe_sun_pt(blkid_probe pr,
                goto nothing;
        }
 
-       if (sun_pt_checksum(l)) {
+       if (!blkid_probe_verify_csum(pr, sun_pt_checksum(l), 0)) {
                DBG(LOWPROBE, ul_debug(
                        "detected corrupted sun disk label -- ignore"));
                goto nothing;
index b078aba3fc11dbff513a3041c84ec81cc148ea42..eea74d65763ad5368643565b1ddf4aa124212c9e 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2001 by Andreas Dilger
  * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
  * Copyright (C) 2008 Karel Zak <kzak@redhat.com>
- * Copyright (C) 2012 Milan Broz <mbroz@redhat.com>
+ * Copyright (C) 2012 Milan Broz <gmazyland@gmail.com>
  *
  * This file may be redistributed under the terms of the
  * GNU Lesser General Public License.
index 3baf6e1e29e5985409ac8d50e4856ef0433f5b45..1fcc38409fc67a8312eb5f2a93452cef82de01f0 100644 (file)
@@ -85,7 +85,7 @@ static void zfs_process_value(blkid_probe pr, char *name, size_t namelen,
                    (uint64_t)nvs_strlen + sizeof(*nvs) > max_value_size)
                        return;
 
-               DBG(LOWPROBE, ul_debug("nvstring: type %u string %*s\n",
+               DBG(LOWPROBE, ul_debug("nvstring: type %u string %*s",
                                       nvs_type, nvs_strlen, nvs->nvs_string));
 
                blkid_probe_set_label(pr, nvs->nvs_string, nvs_strlen);
@@ -102,7 +102,7 @@ static void zfs_process_value(blkid_probe pr, char *name, size_t namelen,
                if (nvu_type != DATA_TYPE_UINT64)
                        return;
 
-               DBG(LOWPROBE, ul_debug("nvuint64: type %u value %"PRIu64"\n",
+               DBG(LOWPROBE, ul_debug("nvuint64: type %u value %"PRIu64,
                                       nvu_type, nvu_value));
 
                blkid_probe_sprintf_value(pr, "UUID_SUB",
@@ -120,7 +120,7 @@ static void zfs_process_value(blkid_probe pr, char *name, size_t namelen,
                if (nvu_type != DATA_TYPE_UINT64)
                        return;
 
-               DBG(LOWPROBE, ul_debug("nvuint64: type %u value %"PRIu64"\n",
+               DBG(LOWPROBE, ul_debug("nvuint64: type %u value %"PRIu64,
                                       nvu_type, nvu_value));
 
                blkid_probe_sprintf_uuid(pr, (unsigned char *) &nvu_value,
@@ -163,7 +163,7 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
        if (!p)
                return;
 
-       DBG(LOWPROBE, ul_debug("zfs_extract: nvlist offset %jd\n",
+       DBG(LOWPROBE, ul_debug("zfs_extract: nvlist offset %jd",
                               (intmax_t)offset));
 
        nvl = (struct nvlist *) p;
@@ -185,7 +185,7 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
                        goto cont;
                }
 
-               DBG(LOWPROBE, ul_debug("left %zd nvp_size %u\n",
+               DBG(LOWPROBE, ul_debug("left %zd nvp_size %u",
                                       left, nvp_size));
 
                /* nvpair fits in buffer and name fits in nvpair? */
@@ -193,7 +193,7 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
                        break;
 
                DBG(LOWPROBE,
-                   ul_debug("nvlist: size %u, namelen %u, name %*s\n",
+                   ul_debug("nvlist: size %u, namelen %u, name %*s",
                             nvp_size, nvp_namelen, nvp_namelen,
                             nvp->nvp_name));
 
@@ -235,14 +235,14 @@ static int find_uberblocks(const void *label, loff_t *ub_offset, int *swap_endia
                        *ub_offset = offset;
                        *swap_endian = 0;
                        found++;
-                       DBG(LOWPROBE, ul_debug("probe_zfs: found little-endian uberblock at %jd\n", (intmax_t)offset >> 10));
+                       DBG(LOWPROBE, ul_debug("probe_zfs: found little-endian uberblock at %jd", (intmax_t)offset >> 10));
                }
 
                if (ub->ub_magic == swab_magic) {
                        *ub_offset = offset;
                        *swap_endian = 1;
                        found++;
-                       DBG(LOWPROBE, ul_debug("probe_zfs: found big-endian uberblock at %jd\n", (intmax_t)offset >> 10));
+                       DBG(LOWPROBE, ul_debug("probe_zfs: found big-endian uberblock at %jd", (intmax_t)offset >> 10));
                }
        }
 
@@ -262,7 +262,7 @@ static int probe_zfs(blkid_probe pr,
        void *label;
        loff_t blk_align = (pr->size % (256 * 1024ULL));
 
-       DBG(PROBE, ul_debug("probe_zfs\n"));
+       DBG(PROBE, ul_debug("probe_zfs"));
        /* Look for at least 4 uberblocks to ensure a positive match */
        for (label_no = 0; label_no < 4; label_no++) {
                switch(label_no) {
index 77146e2e2cdb553cd87296dbbc63d1b1973ebb73..612b5df3369e2a544c8ee9af0ae5b37f1e41adfc 100644 (file)
@@ -29,7 +29,7 @@ static int is_dm_device(dev_t devno)
 static int probe_dm_tp(blkid_probe pr,
                const struct blkid_idmag *mag __attribute__((__unused__)))
 {
-       const char *paths[] = {
+       const char * const paths[] = {
                "/usr/local/sbin/dmsetup",
                "/usr/sbin/dmsetup",
                "/sbin/dmsetup"
index 0603eb912702ab8a84d615129fda20aa5e52acec..b8fce4129d240a64c730342d5628ca5ca20923ca 100644 (file)
@@ -21,7 +21,7 @@
 /*
  * ioctl topology values
  */
-static struct topology_val {
+static const struct topology_val {
 
        long  ioc;
 
@@ -44,7 +44,7 @@ static int probe_ioctl_tp(blkid_probe pr,
        size_t i;
 
        for (i = 0; i < ARRAY_SIZE(topology_vals); i++) {
-               struct topology_val *val = &topology_vals[i];
+               const struct topology_val *val = &topology_vals[i];
                int rc = 1;
                unsigned int data;
 
index 6ab7a5019e12218e9374909ec3f9cb53cf9b30af..af1a612998b5626af478f7c8e82ccc5fabd921ee 100644 (file)
@@ -35,7 +35,7 @@ static int is_lvm_device(dev_t devno)
 static int probe_lvm_tp(blkid_probe pr,
                const struct blkid_idmag *mag __attribute__((__unused__)))
 {
-       const char *paths[] = {
+       const char * const paths[] = {
                "/usr/local/sbin/lvdisplay",
                "/usr/sbin/lvdisplay",
                "/sbin/lvdisplay"
index fe13f940f12372b5a5271220b2412ccc265f6097..81ce3c250ead3ae9466bbce1045d2022767152e4 100644 (file)
@@ -23,7 +23,7 @@
 /*
  * Sysfs topology values (since 2.6.31, May 2009).
  */
-static struct topology_val {
+static const struct topology_val {
 
        /* /sys/dev/block/<maj>:<min>/<ATTR> */
        const char *attr;
@@ -59,7 +59,7 @@ static int probe_sysfs_tp(blkid_probe pr,
        rc = 1;         /* nothing (default) */
 
        for (i = 0; i < ARRAY_SIZE(topology_vals); i++) {
-               struct topology_val *val = &topology_vals[i];
+               const struct topology_val *val = &topology_vals[i];
                int ok = ul_path_access(pc, F_OK, val->attr) == 0;
 
                rc = 1; /* nothing */
index 6f2bba6aceef3df67bf46c7d36bde40c9f9d3c9a..d454e9f9a269ed9ed579385ff9f3e32fd42befc8 100644 (file)
@@ -72,6 +72,11 @@ lib_mount_static = static_library(
   dependencies : [realtime_libs],
   install : false)
 
+lib__mount_deps = [
+  lib_selinux,
+  get_option('cryptsetup-dlopen').enabled() ? lib_dl : lib_cryptsetup,
+  realtime_libs
+]
 lib_mount = library(
   'mount',
   link_whole : lib__mount,
@@ -83,9 +88,7 @@ lib_mount = library(
   link_args : ['-Wl,--version-script=@0@'.format(libmount_sym_path)],
   link_with : [lib_common,
                lib_blkid],
-  dependencies : [lib_selinux,
-                  get_option('cryptsetup-dlopen').enabled() ? lib_dl : lib_cryptsetup,
-                  realtime_libs],
+  dependencies : lib__mount_deps,
   install : build_libmount)
 mount_dep = declare_dependency(link_with: lib_mount, include_directories: '.')
 
@@ -124,7 +127,7 @@ foreach libmount_test: libmount_tests
     'src/' + libmount_test_src_override.get(libmount_test, libmount_test) + '.c',
     include_directories : [dir_include, dir_libblkid],
     link_with : [lib__mount, lib_common, lib_blkid_static],
-    dependencies : [lib_cryptsetup],
+    dependencies : lib__mount_deps,
     c_args : ['-DTEST_PROGRAM'],
   )
   # the test-setup expects the helpers in the toplevel build-directory
index 647f568cd331383d9f92d05c89ec9be76002483f..14d7b39efec00ce20aede7bb1b0d097b9c2ced09 100644 (file)
@@ -31,10 +31,7 @@ else
 endif
 
 if lib_selinux.found()
-  chfn_chsh_sources += files(
-    'selinux_utils.c',
-    'selinux_utils.h',
-  )
+  chfn_chsh_sources += selinux_utils_c
   chfn_chsh_deps += [lib_selinux]
 endif
 
index 38e59bd9ae288ec7bcbf42caa9c315d17063dc78..24e75839f2e49d3c3901d6d761ded1f62b22924a 100644 (file)
@@ -23,6 +23,7 @@ docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux')
 mandir = join_paths(prefixdir, get_option('mandir'))
 runstatedir = '/run'
 execprefixdir = prefixdir
+sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
 usrbin_exec_dir = join_paths(execprefixdir, bindir)
 usrsbin_exec_dir = join_paths(execprefixdir, sbindir)
 bash_completion = dependency('bash-completion', required : get_option('build-bash-completion'))
@@ -57,6 +58,7 @@ conf.set_quoted('LIBBLKID_DATE', libblkid_date)
 conf.set('bindir', bindir)
 conf.set('sbindir', sbindir)
 conf.set('runstatedir', runstatedir)
+conf.set('sysconfdir', sysconfdir)
 conf.set('usrsbin_execdir', usrsbin_exec_dir)
 conf.set('docdir', docdir)
 conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir)
@@ -374,7 +376,7 @@ lib_econf = dependency(
 conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false)
 
 lib_audit = dependency(
-  'libaudit',
+  'audit',
   required : get_option('audit'))
 conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false)
 
@@ -751,6 +753,9 @@ if systemd.found()
   systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
 endif
 
+sysvinit = get_option('sysvinit').enabled()
+sysvinitrcdir = sysconfdir + '/init.d'
+
 chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found()
 conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false)
 
@@ -1439,6 +1444,7 @@ exe = executable(
   'setarch',
   setarch_sources,
   include_directories : includes,
+  link_with : [lib_common],
   install_dir : usrbin_exec_dir,
   install : true)
 exes += exe
@@ -2449,6 +2455,7 @@ exe = executable(
   'namei',
   namei_sources,
   include_directories : includes,
+  dependencies : [lib_selinux],
   install_dir : usrbin_exec_dir,
   install : true)
 exes += exe
index 339948b91394a0b833bd16fe8cc41d072ce924d7..0632c891dfb58fd5763b6626077b2fe3f1e0d4f3 100644 (file)
@@ -20,6 +20,8 @@ option('smack',       type : 'feature', value : 'disabled')
 option('magic',       type : 'feature')
 option('econf',       type : 'feature')
 option('systemd',     type : 'feature')
+option('sysvinit',    type : 'feature', value : 'disabled',
+       description : 'build and install sysvinit startup scripts')
 option('btrfs',       type : 'feature')
 option('widechar',    type : 'feature',
        description : 'compile with wide character support')
index 2590bb01961bcb171e851bef7b9bb67fc3aad2d9..54f23f63eca235701cd11aa074e7900fa89bd346 100644 (file)
@@ -93,7 +93,7 @@ int main(int argc, char ** argv)
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
 
-       while ((c = getopt_long (argc, argv, "a:d:hl:o:", longopts, NULL)) != -1) {
+       while ((c = getopt_long (argc, argv, "a:d:hl:o:V", longopts, NULL)) != -1) {
                switch (c) {
                case 'a':
                        break;
index 8acaad7a813f7b2cb81d543af8fff33b79834675..dc6f2896c968c378bb7cd18cced4cb10cedb099a 100644 (file)
@@ -38,6 +38,7 @@ void lsblk_device_free_properties(struct lsblk_devprop *p)
        free(p->model);
        free(p->partflags);
        free(p->idlink);
+       free(p->revision);
 
        free(p->mode);
        free(p->owner);
@@ -130,6 +131,9 @@ static struct lsblk_devprop *get_properties_by_udev(struct lsblk_device *ld)
                normalize_whitespace((unsigned char *) prop->serial);
        }
 
+       if ((data = udev_device_get_property_value(dev, "ID_REVISION")))
+               prop->revision = xstrdup(data);
+
        if ((data = udev_device_get_property_value(dev, "ID_MODEL_ENC"))) {
                prop->model = xstrdup(data);
                unhexmangle_string(prop->model);
@@ -254,6 +258,7 @@ static struct lsblk_devprop *get_properties_by_file(struct lsblk_device *ld)
                else if (lookup(buf, "ID_SCSI_SERIAL", &prop->serial)) ;
                else if (lookup(buf, "ID_SERIAL_SHORT", &prop->serial)) ;
                else if (lookup(buf, "ID_SERIAL", &prop->serial)) ;
+               else if (lookup(buf, "ID_REVISION", &prop->revision)) ;
 
                /* lsblk specific */
                else if (lookup(buf, "MODE", &prop->mode)) ;
index 6a9770ef22d32a50935665d469ab09fc754d87bf..87df92ff91ad92a91518bbead015eec4e47d8087 100644 (file)
@@ -168,7 +168,7 @@ The *lsblk* command needs to be able to look up each block device by major:minor
 
 == AUTHORS
 
-mailto:mbroz@redhat.com[Milan Broz],
+mailto:gmazyland@gmail.com[Milan Broz],
 mailto:kzak@redhat.com[Karel Zak]
 
 == SEE ALSO
index ea06afcd1092940e67b10ba29a708e053d94589b..cbe307a74b7e8d2287c9da73dbe65da903fa4c21 100644 (file)
@@ -2,7 +2,7 @@
  * lsblk(8) - list block devices
  *
  * Copyright (C) 2010-2018 Red Hat, Inc. All rights reserved.
- * Written by Milan Broz <mbroz@redhat.com>
+ * Written by Milan Broz <gmazyland@gmail.com>
  *            Karel Zak <kzak@redhat.com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -524,6 +524,8 @@ static const char *get_transport(struct lsblk_device *dev)
                trans = "nvme";
        } else if (strncmp(dev->name, "vd", 2) == 0)
                trans = "virtio";
+       else if (strncmp(dev->name, "mmcblk", 6) == 0)
+               trans = "mmc";
 
        return trans;
 }
@@ -1013,8 +1015,13 @@ static char *device_get_data(
                }
                break;
        case COL_REV:
-               if (!device_is_partition(dev) && dev->nslaves == 0)
-                       ul_path_read_string(dev->sysfs, &str, "device/rev");
+               if (!device_is_partition(dev) && dev->nslaves == 0) {
+                       prop = lsblk_device_get_properties(dev);
+                       if (prop && prop->revision)
+                               str = xstrdup(prop->revision);
+                       else
+                               ul_path_read_string(dev->sysfs, &str, "device/rev");
+               }
                break;
        case COL_VENDOR:
                if (!device_is_partition(dev) && dev->nslaves == 0)
@@ -2238,6 +2245,7 @@ int main(int argc, char *argv[])
                        add_uniq_column(COL_TYPE);
                        add_uniq_column(COL_MODEL);
                        add_uniq_column(COL_SERIAL);
+                       add_uniq_column(COL_REV);
                        add_uniq_column(COL_TRANSPORT);
                        add_uniq_column(COL_RQ_SIZE);
                        add_uniq_column(COL_MQ);
index c00723f1aecf47de555aa0747d70d4bd352ed48a..a437c0612ab768e3a449459c1325d39bd5dd478e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2010-2018 Red Hat, Inc. All rights reserved.
- * Written by Milan Broz <mbroz@redhat.com>
+ * Written by Milan Broz <gmazyland@gmail.com>
  *            Karel Zak <kzak@redhat.com>
  */
 #ifndef UTIL_LINUX_LSBLK_H
@@ -79,6 +79,7 @@ struct lsblk_devprop {
        char *serial;           /* disk serial number */
        char *model;            /* disk model */
        char *idlink;           /* /dev/disk/by-id/<name> */
+       char *revision;         /* firmware revision/version */
 
        /* lsblk specific (for --sysroot only)  */
        char *owner;            /* user name */
index d7dfe7372c8aa0522a1017084f463db224409643..b6009704970aa1b7446e40379a368f9b7da3572f 100644 (file)
@@ -92,6 +92,16 @@ if build_uuidd and systemd.found()
     uuidd_socket,
     install_dir : systemdsystemunitdir)
 endif
+if build_uuidd and sysvinit
+  uuidd_rc = configure_file(
+    input : 'uuidd.rc.in',
+    output : 'uuidd.rc',
+    configuration : conf)
+  install_data(
+    uuidd_rc,
+    install_mode : 'rwxr-xr-x',
+    install_dir : sysvinitrcdir)
+endif
 
 blkid_sources = files(
   'blkid.c',
index 5eb1959573ccfcdf8208acd83926eb8f3c18fccb..11518e94cf9af6ab58b9007c63cc2e0be884272e 100644 (file)
@@ -23,7 +23,7 @@ rename - rename files
 == OPTIONS
 
 *-s*, *--symlink*::
-Do not rename a symlink but its target.
+Do not rename a symlink but change where it points.
 
 *-v*, *--verbose*::
 Show which files were renamed, if any.
@@ -49,6 +49,12 @@ include::man-common/help-version.adoc[]
 
 The renaming has no safeguards by default or without any one of the options *--no-overwrite*, *--interactive* or *--no-act*. If the user has permission to rewrite file names, the command will perform the action without any questions. For example, the result can be quite drastic when the command is run as root in the _/lib_ directory. Always make a backup before running the command, unless you truly know what you are doing.
 
+== EDGE CASES
+
+If the _expression_ is empty, then by default _replacement_ will be added to the start of the filename. With *--all*, _replacement_ will be inserted in between every two characters of the filename, as well as at the start and end.
+
+Normally, only the final path component of a filename is updated. But if either _expression_ or _replacement_ contains a _/_, the full path is updated. This can cause a file to be moved between folders. Creating folders, and moving files between filesystems, is not supported. With *--symlink*, the update is always applied to the link's full path.
+
 == INTERACTIVE MODE
 
 As most standard utilities rename can be used with a terminal device (tty in short) in canonical mode, where the line is buffered by the tty and you press ENTER to validate the user input. If you put your tty in cbreak mode however, rename requires only a single key press to answer the prompt. To set cbreak mode, run for example:
index 22047d9bd47cba92a573b49404c6fc9ded30a8a5..a0bf6cb7b037d1224e239d52d325e5b08701c808 100644 (file)
@@ -231,6 +231,7 @@ usrbin_exec_PROGRAMS += setarch
 MANPAGES += sys-utils/setarch.8
 dist_noinst_DATA += sys-utils/setarch.8.adoc
 setarch_SOURCES = sys-utils/setarch.c
+setarch_LDADD = $(LDADD) libcommon.la
 
 SETARCH_LINKS = uname26 linux32 linux64
 
index 1bd371a0b3d6b4bb1ffded1604a56a4753d86f7c..ad1eb688e49600e497a385b52f9d26576e2d2e4a 100644 (file)
@@ -1169,6 +1169,7 @@ manipulate_rtc_param(const struct hwclock_control *ctl)
 
                printf(_("The RTC parameter 0x%jx is set to 0x%jx.\n"),
                       (uintmax_t) id, (uintmax_t) value);
+               return 0;
 
        } else if (ctl->param_set_option) {
                if (ctl->testing)
index b86be1e29da1d3d8c4d1302fd68f53690acd01e5..d6789d05e86f555853d4b4d5fc842ac58377d6a7 100644 (file)
@@ -35,6 +35,7 @@
 #include "nls.h"
 #include "c.h"
 #include "closestream.h"
+#include "sysfs.h"
 
 #ifndef HAVE_PERSONALITY
 # include <syscall.h>
@@ -232,7 +233,9 @@ static struct arch_domain *init_arch_domains(void)
                if (!strcmp(un.machine, transitions[i].target_arch))
                        break;
        if (transitions[i].perval < 0) {
-               unsigned long wrdsz = CHAR_BIT * sizeof(void *);
+               int wrdsz = sysfs_get_address_bits(NULL);
+               if (wrdsz < 0)
+                       wrdsz = CHAR_BIT * sizeof(void *);
                if (wrdsz == 32 || wrdsz == 64) {
                        /* fill up the place holder */
                        transitions[i].perval = wrdsz == 32 ? PER_LINUX32 : PER_LINUX;
index 377cc2492b63e472a3c85b38cb7352b2acc368cf..ef9e74d238197f17954b2510f8bc66578b2d6fa7 100644 (file)
@@ -46,6 +46,7 @@ TS_HELPER_CAL="${ts_helpersdir}test_cal"
 TS_HELPER_LAST_FUZZ="${ts_helpersdir}test_last_fuzz"
 TS_HELPER_MKFDS="${ts_helpersdir}test_mkfds"
 TS_HELPER_BLKID_FUZZ="${ts_helpersdir}test_blkid_fuzz"
+TS_HELPER_PROCFS="${ts_helpersdir}test_procfs"
 
 # paths to commands
 TS_CMD_ADDPART=${TS_CMD_ADDPART:-"${ts_commandsdir}addpart"}
diff --git a/tests/expected/lib/procfs-one-process b/tests/expected/lib/procfs-one-process
new file mode 100644 (file)
index 0000000..db953c0
--- /dev/null
@@ -0,0 +1,14 @@
+1
+   UID: [redacted]
+   CMDLINE: './test'
+   COMM: 'test'
+2
+   UID: [redacted]
+   CMDLINE: './foo
+bar'
+   COMM: 'foo
+bar'
+3
+   UID: [redacted]
+   CMDLINE: './foo )bar'
+   COMM: 'foo )bar'
diff --git a/tests/expected/lib/procfs-stat-nth b/tests/expected/lib/procfs-stat-nth
new file mode 100644 (file)
index 0000000..7ed534a
--- /dev/null
@@ -0,0 +1,6 @@
+1: 1th 373850
+1: 4th 373752
+2: 1th 1583
+2: 4th 1165
+3: 1th 4102
+3: 4th 1165
diff --git a/tests/expected/lib/procfs-stat-nth.err b/tests/expected/lib/procfs-stat-nth.err
new file mode 100644 (file)
index 0000000..aff7b24
--- /dev/null
@@ -0,0 +1,2 @@
+test_procfs: read 2th number failed: Invalid argument
+test_procfs: read 3th number failed: Invalid argument
diff --git a/tests/ts/lib/procfs b/tests/ts/lib/procfs
new file mode 100755 (executable)
index 0000000..998aa39
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/bash
+#
+# Copyright (C) 2022 Thomas Weißschuh <thomas@t-8ch.de>
+#
+# 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="procfs library"
+
+. "$TS_TOPDIR"/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_HELPER_PROCFS"
+
+test_data="$TS_SELF/procfs-data"
+test_cmd() {
+       "$TS_HELPER_PROCFS" --prefix "$test_data" "$@" \
+               2>> "$TS_ERRLOG" \
+               | sed -e 's/   UID: .*/   UID: [redacted]/' \
+               >> "$TS_OUTPUT"
+}
+
+ts_init_subtest "one-process"
+
+test_cmd --one 1
+test_cmd --one 2
+test_cmd --one 3
+
+ts_finalize_subtest
+
+
+ts_init_subtest "stat-nth"
+
+test_cmd --stat-nth 1 1
+test_cmd --stat-nth 1 2
+test_cmd --stat-nth 1 3
+test_cmd --stat-nth 1 4
+
+test_cmd --stat-nth 2 1
+test_cmd --stat-nth 2 4
+
+test_cmd --stat-nth 3 1
+test_cmd --stat-nth 3 4
+
+ts_finalize_subtest
+
+ts_finalize
diff --git a/tests/ts/lib/procfs-data/proc/1/cmdline b/tests/ts/lib/procfs-data/proc/1/cmdline
new file mode 100644 (file)
index 0000000..2baeb31
Binary files /dev/null and b/tests/ts/lib/procfs-data/proc/1/cmdline differ
diff --git a/tests/ts/lib/procfs-data/proc/1/comm b/tests/ts/lib/procfs-data/proc/1/comm
new file mode 100644 (file)
index 0000000..9daeafb
--- /dev/null
@@ -0,0 +1 @@
+test
diff --git a/tests/ts/lib/procfs-data/proc/1/stat b/tests/ts/lib/procfs-data/proc/1/stat
new file mode 100644 (file)
index 0000000..35cb1bd
--- /dev/null
@@ -0,0 +1 @@
+373850 (test) S 373752 373850 373752 34835 373850 4194304 83 0 0 0 0 0 0 0 20 0 1 0 6164479 2543616 320 18446744073709551615 94138801930240 94138801930657 140720370008720 0 0 0 0 0 0 1 0 0 17 1 0 0 0 0 0 94138801941968 94138801942568 94138832138240 140720370011239 140720370011246 140720370011246 140720370012145 0
diff --git a/tests/ts/lib/procfs-data/proc/2/cmdline b/tests/ts/lib/procfs-data/proc/2/cmdline
new file mode 100644 (file)
index 0000000..5ca4218
Binary files /dev/null and b/tests/ts/lib/procfs-data/proc/2/cmdline differ
diff --git a/tests/ts/lib/procfs-data/proc/2/comm b/tests/ts/lib/procfs-data/proc/2/comm
new file mode 100644 (file)
index 0000000..3bd1f0e
--- /dev/null
@@ -0,0 +1,2 @@
+foo
+bar
diff --git a/tests/ts/lib/procfs-data/proc/2/stat b/tests/ts/lib/procfs-data/proc/2/stat
new file mode 100644 (file)
index 0000000..250e579
--- /dev/null
@@ -0,0 +1,2 @@
+1583 (foo
+bar) S 1165 1583 1165 34818 1583 4194304 82 0 0 0 0 0 0 0 20 0 1 0 17487 2543616 215 18446744073709551615 93858497511424 93858497511841 140729173273328 0 0 0 0 0 0 1 0 0 17 0 0 0 0 0 0 93858497523152 93858497523752 93858527924224 140729173281886 140729173281896 140729173281896 140729173282798 0
diff --git a/tests/ts/lib/procfs-data/proc/3/cmdline b/tests/ts/lib/procfs-data/proc/3/cmdline
new file mode 100644 (file)
index 0000000..4840b32
Binary files /dev/null and b/tests/ts/lib/procfs-data/proc/3/cmdline differ
diff --git a/tests/ts/lib/procfs-data/proc/3/comm b/tests/ts/lib/procfs-data/proc/3/comm
new file mode 100644 (file)
index 0000000..57bf5bb
--- /dev/null
@@ -0,0 +1 @@
+foo )bar
diff --git a/tests/ts/lib/procfs-data/proc/3/stat b/tests/ts/lib/procfs-data/proc/3/stat
new file mode 100644 (file)
index 0000000..4b5f575
--- /dev/null
@@ -0,0 +1 @@
+4102 (foo )bar) S 1165 4102 1165 34818 4102 4194304 80 0 0 0 0 0 0 0 20 0 1 0 61909 2543616 215 18446744073709551615 94697631760384 94697631760801 140728832669632 0 0 0 0 0 0 1 0 0 17 0 0 0 0 0 0 94697631772112 94697631772712 94697662554112 140728832670811 140728832670822 140728832670822 140728832671725 0
index 7fc998bc067f7cf341f958fa2c291fc888b92190..6f306d5b39bdb473ec79ab3cefe4f386de120abf 100755 (executable)
@@ -39,15 +39,6 @@ if [ $? -eq 2 ]; then
        ts_skip "ioctl not supported"
 fi
 
-# 32bit userspace (NS ioctls) does not work as expected with 64bit kernel
-WORDSIZE=$($TS_HELPER_SYSINFO WORDSIZE)
-if [ $WORDSIZE -eq 32 ]; then
-       uname -m | grep -q 64
-       if [ $? -eq 0 ]; then
-               TS_KNOWN_FAIL="yes"
-       fi
-fi
-
 $TS_CMD_UNSHARE --user --pid --mount-proc --fork true &> /dev/null || ts_skip "no namespace support"
 
 ts_cd "$TS_OUTDIR"