import util-linux-2.32.1-11.el8

This commit is contained in:
CentOS Sources 2019-08-01 20:15:31 -04:00 committed by Stepan Oksanichenko
commit 9246cb92b9
35 changed files with 5098 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/util-linux-2.32.1.tar.xz

1
.util-linux.metadata Normal file
View File

@ -0,0 +1 @@
de9271fb93fb651d21c027e2efb0cf0ac80f2e9a SOURCES/util-linux-2.32.1.tar.xz

View File

@ -0,0 +1,26 @@
From 2d57cb2d64ba4757dcfd9d0e7ed4873cae8a6fcd Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 20 Jun 2016 11:09:02 +0200
Subject: [PATCH 0/6] login: create /var/log/lastlog
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=151635
---
login-utils/login.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/login-utils/login.c b/login-utils/login.c
index 09ee8f8ea..8c9e43292 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -506,7 +506,7 @@ static void log_lastlog(struct login_context *cxt)
sa.sa_handler = SIG_IGN;
sigaction(SIGXFSZ, &sa, &oldsa_xfsz);
- fd = open(_PATH_LASTLOG, O_RDWR, 0);
+ fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0);
if (fd < 0)
goto done;
--
2.14.4

View File

@ -0,0 +1,123 @@
From 768b91ef6f68661462494bed800505064eb97bc8 Mon Sep 17 00:00:00 2001
From: Milan Broz <gmazyland@gmail.com>
Date: Wed, 11 Jul 2018 12:34:39 +0200
Subject: [PATCH 1/6] libblkid: Check for a secondary LUKS2 header.
This patch adds search for a secondary LUKS2 header,
if the primary one is corrupted.
This patch is primarily needed for wipefs that should wipe
both signatures (otherwise LUKS2 header recovery can use
secondary header and revert wipefs action).
Signed-off-by: Milan Broz <gmazyland@gmail.com>
Upstream: http://github.com/karelzak/util-linux/commit/8bee1a220db8effbe5a75ba9bc68840e019ea89a
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1595882
---
libblkid/src/superblocks/luks.c | 60 ++++++++++++++++++++++++++++++++---------
1 file changed, 47 insertions(+), 13 deletions(-)
diff --git a/libblkid/src/superblocks/luks.c b/libblkid/src/superblocks/luks.c
index bc3d7f558..67d7cfcc5 100644
--- a/libblkid/src/superblocks/luks.c
+++ b/libblkid/src/superblocks/luks.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2008 Karel Zak <kzak@redhat.com>
+ * Copyright (C) 2018 Milan Broz <gmazyland@gmail.com>
*
* Inspired by libvolume_id by
* Kay Sievers <kay.sievers@vrfy.org>
@@ -29,6 +30,15 @@
#define LUKS2_CHECKSUM_ALG_L 32
#define LUKS2_CHECKSUM_L 64
+#define LUKS_MAGIC "LUKS\xba\xbe"
+#define LUKS_MAGIC_2 "SKUL\xba\xbe"
+
+/* Offsets for secondary header (for scan if primary header is corrupted). */
+#define LUKS2_HDR2_OFFSETS { 0x04000, 0x008000, 0x010000, 0x020000, \
+ 0x40000, 0x080000, 0x100000, 0x200000, 0x400000 }
+
+static const uint64_t secondary_offsets[] = LUKS2_HDR2_OFFSETS;
+
struct luks_phdr {
uint8_t magic[LUKS_MAGIC_L];
uint16_t version;
@@ -59,18 +69,16 @@ struct luks2_phdr {
/* Padding to 4k, then JSON area */
} __attribute__ ((packed));
-static int probe_luks(blkid_probe pr, const struct blkid_idmag *mag)
+static int luks_attributes(blkid_probe pr, struct luks2_phdr *header, uint64_t offset)
{
- struct luks_phdr *header_v1;
- struct luks2_phdr *header;
int version;
+ struct luks_phdr *header_v1;
- header = blkid_probe_get_sb(pr, mag, struct luks2_phdr);
- if (header == NULL)
- return errno ? -errno : 1;
+ if (blkid_probe_set_magic(pr, offset, LUKS_MAGIC_L, (unsigned char *) &header->magic))
+ return BLKID_PROBE_NONE;
version = be16_to_cpu(header->version);
- blkid_probe_sprintf_version(pr, "%u", be16_to_cpu(header->version));
+ blkid_probe_sprintf_version(pr, "%u", version);
if (version == 1) {
header_v1 = (struct luks_phdr *)header;
@@ -84,7 +92,37 @@ static int probe_luks(blkid_probe pr, const struct blkid_idmag *mag)
blkid_probe_set_id_label(pr, "SUBSYSTEM",
(unsigned char *) header->subsystem, LUKS2_LABEL_L);
}
- return 0;
+
+ return BLKID_PROBE_OK;
+}
+
+static int probe_luks(blkid_probe pr, const struct blkid_idmag *mag __attribute__((__unused__)))
+{
+ struct luks2_phdr *header;
+ size_t i;
+
+ header = (struct luks2_phdr *) blkid_probe_get_buffer(pr, 0, sizeof(struct luks2_phdr));
+ if (!header)
+ return errno ? -errno : BLKID_PROBE_NONE;
+
+ if (!memcmp(header->magic, LUKS_MAGIC, LUKS_MAGIC_L)) {
+ /* LUKS primary header was found. */
+ return luks_attributes(pr, header, 0);
+ } else {
+ /* No primary header, scan for known offsets of LUKS2 secondary header. */
+ for (i = 0; i < ARRAY_SIZE(secondary_offsets); i++) {
+ header = (struct luks2_phdr *) blkid_probe_get_buffer(pr,
+ secondary_offsets[i], sizeof(struct luks2_phdr));
+
+ if (!header)
+ return errno ? -errno : BLKID_PROBE_NONE;
+
+ if (!memcmp(header->magic, LUKS_MAGIC_2, LUKS_MAGIC_L))
+ return luks_attributes(pr, header, secondary_offsets[i]);
+ }
+ }
+
+ return BLKID_PROBE_NONE;
}
const struct blkid_idinfo luks_idinfo =
@@ -92,9 +130,5 @@ const struct blkid_idinfo luks_idinfo =
.name = "crypto_LUKS",
.usage = BLKID_USAGE_CRYPTO,
.probefunc = probe_luks,
- .magics =
- {
- { .magic = "LUKS\xba\xbe", .len = 6 },
- { NULL }
- }
+ .magics = BLKID_NONE_MAGIC
};
--
2.14.4

View File

@ -0,0 +1,40 @@
From 315960fa9a89248e9d56682c1915567d38fef431 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 7 Jun 2018 12:05:08 +0200
Subject: [PATCH 2/6] losetup: keep -f and <devname> mutually exclusive
losetup tries to blindly use specified device as well as search for
the first free device, the result is:
# losetup /dev/loop1 -f /tmp/tfile_loop1
losetup: /dev/loop1: failed to set up loop device: Invalid argument
fixed version:
# losetup /dev/loop10 -f img
losetup: unexpected arguments
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1614364
Upstream: http://github.com/karelzak/util-linux/commit/c3f5a0f1d47dbc47f6d21da232d4eb1cfb7905db
Signed-off-by: Karel Zak <kzak@redhat.com>
---
sys-utils/losetup.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
index 9c479c02d..e80ceacce 100644
--- a/sys-utils/losetup.c
+++ b/sys-utils/losetup.c
@@ -749,6 +749,9 @@ int main(int argc, char **argv)
*/
act = A_CREATE;
file = argv[optind++];
+
+ if (optind < argc)
+ errx(EXIT_FAILURE, _("unexpected arguments"));
}
if (list && !act && optind == argc)
--
2.14.4

View File

@ -0,0 +1,55 @@
From 4859f218a3be0ae90908fc0ddbef498a784e9b24 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Fri, 10 Aug 2018 16:27:41 +0200
Subject: [PATCH 3/6] mount: add ext4 to some places to the man page
Upstream: http://github.com/karelzak/util-linux/commit/d901e4275f7c1899518bab3b34424c90af8dc35e
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1614852
---
sys-utils/mount.8 | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/sys-utils/mount.8 b/sys-utils/mount.8
index 562ecb187..1cc792979 100644
--- a/sys-utils/mount.8
+++ b/sys-utils/mount.8
@@ -880,7 +880,7 @@ output for extN filesystems).
The following options apply to any filesystem that is being
mounted (but not every filesystem actually honors them \(en e.g.\&, the
.B sync
-option today has an effect only for ext2, ext3, fat, vfat and ufs):
+option today has an effect only for ext2, ext3, ext4, fat, vfat and ufs):
.TP
.B async
@@ -916,7 +916,8 @@ The
.B context=
option is useful when mounting filesystems that do not support
extended attributes, such as a floppy or hard disk formatted with VFAT, or
-systems that are not normally running under SELinux, such as an ext3 formatted
+systems that are not normally running under SELinux, such as an ext3 or ext4 formatted
+
disk from a non-SELinux workstation. You can also use
.B context=
on filesystems you do not trust, such as a floppy. It also helps in compatibility with
@@ -2314,7 +2315,7 @@ not specified or the filesystem is known for libblkid, for example:
.sp
.B "mount /tmp/disk.img /mnt"
.sp
-.B "mount \-t ext3 /tmp/disk.img /mnt"
+.B "mount \-t ext4 /tmp/disk.img /mnt"
.sp
.RE
This type of mount knows about three options, namely
@@ -2462,7 +2463,7 @@ It is possible for a corrupted filesystem to cause a crash.
.PP
Some Linux filesystems don't support
.BR "\-o sync " nor " \-o dirsync"
-(the ext2, ext3, fat and vfat filesystems
+(the ext2, ext3, ext4, fat and vfat filesystems
.I do
support synchronous updates (a la BSD) when mounted with the
.B sync
--
2.14.4

View File

@ -0,0 +1,29 @@
From 56b9e31e6b9864bba07a25d2244ca0006eed5bb5 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Fri, 10 Aug 2018 16:55:14 +0200
Subject: [PATCH 4/6] logger: add -S to the man page
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1614843
Upstream: http://github.com/karelzak/util-linux/commit/1f6583930b1061c5e79e09a9f2e80caaf9eeb405
Reported-by: Radka Skvarilova <rskvaril@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
---
misc-utils/logger.1 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc-utils/logger.1 b/misc-utils/logger.1
index f121c4dc9..f9655978d 100644
--- a/misc-utils/logger.1
+++ b/misc-utils/logger.1
@@ -224,7 +224,7 @@ produces:
.fi
.IP
.TP
-.BR \-\-size " \fIsize
+.BR \-S , " -\-size " \fIsize
Sets the maximum permitted message size to \fIsize\fR. The default
is 1KiB characters, which is the limit traditionally used and specified
in RFC 3164. With RFC 5424, this limit has become flexible. A good assumption
--
2.14.4

View File

@ -0,0 +1,76 @@
From e73085fe74356df96b0e694c906f22f9c71a56c7 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 13 Aug 2018 13:49:26 +0200
Subject: [PATCH 5/6] lslogins: add info about single-user output mode
The supported command line synopsis is also
lslogins foo
and it provides different output than
lslogins -l foo
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1614967
Signed-off-by: Karel Zak <kzak@redhat.com>
---
login-utils/lslogins.1 | 11 ++++++++++-
login-utils/lslogins.c | 2 +-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/login-utils/lslogins.1 b/login-utils/lslogins.1
index bd6955f82..effd42790 100644
--- a/login-utils/lslogins.1
+++ b/login-utils/lslogins.1
@@ -9,10 +9,17 @@ lslogins \- display information about known users in the system
.RB [ \-s | \-u [ =\fIUID ]]
.RB [ \-g " \fIgroups\fR]"
.RB [ \-l " \fIlogins\fR]"
+.RB [\fIusername\fR]
.SH DESCRIPTION
.PP
Examine the wtmp and btmp logs, /etc/shadow (if necessary) and /etc/passwd
and output the desired data.
+
+The optional argument \fIusername\fR forces
+.BR lslogins
+to print all available details about the specified user only. In this case the
+output format is different than in case of \fB\-l\fR or \fB\-g\fR.
+
.PP
The default action is to list info about all the users in the system.
.SH OPTIONS
@@ -39,7 +46,8 @@ Show information about supplementary groups.
.TP
\fB\-g\fR, \fB\-\-groups\fR=\fIgroups\fR
Only show data of users belonging to \fIgroups\fR. More than one group
-may be specified; the list has to be comma-separated.
+may be specified; the list has to be comma-separated. The unknown group
+names are ignored.
Note that relation between user and group may be invisible for primary group if
the user is not explicitly specify as group member (e.g. in /etc/group). If the
@@ -55,6 +63,7 @@ Display data containing information about the users' last login sessions.
\fB\-l\fR, \fB\-\-logins\fR=\fIlogins\fR
Only show data of users with a login specified in \fIlogins\fR (user names or user
IDS). More than one login may be specified; the list has to be comma-separated.
+The unknown login names are ignored.
.TP
\fB\-n\fR, \fB\-\-newline\fR
Display each piece of information on a separate line.
diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c
index 169962b72..501778e54 100644
--- a/login-utils/lslogins.c
+++ b/login-utils/lslogins.c
@@ -1293,7 +1293,7 @@ static void __attribute__((__noreturn__)) usage(void)
size_t i;
fputs(USAGE_HEADER, out);
- fprintf(out, _(" %s [options]\n"), program_invocation_short_name);
+ fprintf(out, _(" %s [options] [<username>]\n"), program_invocation_short_name);
fputs(USAGE_SEPARATOR, out);
fputs(_("Display information about known users in the system.\n"), out);
--
2.14.4

View File

@ -0,0 +1,105 @@
From 0aa9097f9ecee3688b8659d7f7414f5fb26e147a Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 13 Aug 2018 14:16:28 +0200
Subject: [PATCH 6/6] lslogins: return 1 on "lslogins nonexisting"
The default behavior for -l and -g is to silently ignore unknown login
names, but this is very confusing when you explicitly specify just one
login name.
Note that the current implementation also prints empty "Last log" for
nonexisting user. It seems ugly.
# lslogins nonexisting
Last logs:
new version:
# lslogins nonexisting
lt-lslogins: cannot found 'nonexisting'
# echo $?
1
The -l and -g behaviour has not been changed.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1614967
Signed-off-by: Karel Zak <kzak@redhat.com>
---
login-utils/lslogins.1 | 3 ++-
login-utils/lslogins.c | 16 +++++++++++++---
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/login-utils/lslogins.1 b/login-utils/lslogins.1
index effd42790..c831739d9 100644
--- a/login-utils/lslogins.1
+++ b/login-utils/lslogins.1
@@ -18,7 +18,8 @@ and output the desired data.
The optional argument \fIusername\fR forces
.BR lslogins
to print all available details about the specified user only. In this case the
-output format is different than in case of \fB\-l\fR or \fB\-g\fR.
+output format is different than in case of \fB\-l\fR or \fB\-g\fR and unknown
+is \fIusername\fR reported as an error.
.PP
The default action is to list info about all the users in the system.
diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c
index 501778e54..6f804aa35 100644
--- a/login-utils/lslogins.c
+++ b/login-utils/lslogins.c
@@ -266,6 +266,7 @@ struct lslogins_control {
const char *journal_path;
unsigned int selinux_enabled : 1,
+ fail_on_unknown : 1, /* fail if user does not exist */
ulist_on : 1,
noheadings : 1,
notrunc : 1;
@@ -653,6 +654,7 @@ static struct lslogins_user *get_user_info(struct lslogins_control *ctl, const c
uid_t uid;
errno = 0;
+ errno = 0;
pwd = username ? getpwnam(username) : getpwent();
if (!pwd)
return NULL;
@@ -675,6 +677,7 @@ static struct lslogins_user *get_user_info(struct lslogins_control *ctl, const c
return NULL;
}
+ errno = 0;
grp = getgrgid(pwd->pw_gid);
if (!grp)
return NULL;
@@ -965,10 +968,16 @@ static int create_usertree(struct lslogins_control *ctl)
if (ctl->ulist_on) {
for (n = 0; n < ctl->ulsiz; n++) {
- if (get_user(ctl, &user, ctl->ulist[n]))
+ int rc = get_user(ctl, &user, ctl->ulist[n]);
+
+ if (ctl->fail_on_unknown && !user) {
+ warnx(_("cannot found '%s'"), ctl->ulist[n]);
+ return -1;
+ }
+ if (rc || !user)
continue;
- if (user) /* otherwise an invalid user name has probably been given */
- tsearch(user, &ctl->usertree, cmp_uid);
+
+ tsearch(user, &ctl->usertree, cmp_uid);
}
} else {
while ((user = get_next_user(ctl)))
@@ -1518,6 +1527,7 @@ int main(int argc, char *argv[])
errx(EXIT_FAILURE, _("Only one user may be specified. Use -l for multiple users."));
logins = argv[optind];
outmode = OUT_PRETTY;
+ ctl->fail_on_unknown = 1;
} else if (argc != optind)
errx(EXIT_FAILURE, _("Only one user may be specified. Use -l for multiple users."));
--
2.14.4

View File

@ -0,0 +1,115 @@
From f942ba2c4c14b6bf7720e8316afe1971231553bc Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Fri, 31 Aug 2018 12:27:32 +0200
Subject: [PATCH 7/8] 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.
Upstream: http://github.com/karelzak/util-linux/commit/d6ddf07d31dfdc894eb8e7e6842aa856342c526e
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1624877
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 a374e75c9..27c135db5 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);
}
-
--
2.14.4

View File

@ -0,0 +1,25 @@
From 2f75c4cdf6992af034bf02de55ad2ea90608e1c0 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Fri, 31 Aug 2018 12:48:46 +0200
Subject: [PATCH 8/8] test: update UUID v5 tests
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1624877
Upstream: http://github.com/karelzak/util-linux/commit/7edaf221d610309874e866670dceb4e2f3a04070
Signed-off-by: Karel Zak <kzak@redhat.com>
---
tests/expected/uuid/oids | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/expected/uuid/oids b/tests/expected/uuid/oids
index 4644848e8..c121cbeee 100644
--- a/tests/expected/uuid/oids
+++ b/tests/expected/uuid/oids
@@ -1,4 +1,4 @@
3d813cbb-47fb-32ba-91df-831e1593ac29
5df41881-3aed-3515-88a7-2f4a814cf09e
2ed6657d-e927-568b-95e1-2665a8aea6a2
-fcdc2122-78d2-59f7-91ed-041a561ef652
+fcdc2122-78d2-59f7-b1ed-041a561ef652
--
2.14.4

View File

@ -0,0 +1,30 @@
From a0753a5452e293da56e1e8579d17b4eb19a7d6a2 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Fri, 30 Nov 2018 12:22:48 +0100
Subject: [PATCH 09/14] tests: enlarge backing file for fstab-btrfs
It seems the new limit for Btrfs is 47MiB.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1656437
Upstream: http://github.com/karelzak/util-linux/commit/7174b93dfda08f87228bb7aec6274fe60af581bd
Signed-off-by: Karel Zak <kzak@redhat.com>
---
tests/ts/mount/fstab-btrfs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/ts/mount/fstab-btrfs b/tests/ts/mount/fstab-btrfs
index 090f52304..54c6bb8ba 100755
--- a/tests/ts/mount/fstab-btrfs
+++ b/tests/ts/mount/fstab-btrfs
@@ -42,7 +42,7 @@ TS_MOUNTPOINT_SUBVOL="$TS_MOUNTPOINT-subvol"
TS_MOUNTPOINT_SUBVOLID="$TS_MOUNTPOINT-subvolid"
TS_MOUNTPOINT_BIND="$TS_MOUNTPOINT-bind"
-ts_device_init 42
+ts_device_init 50
DEVICE=$TS_LODEV
[ -d "$TS_MOUNTPOINT_CREATE" ] || mkdir -p "$TS_MOUNTPOINT_CREATE"
[ -d "$TS_MOUNTPOINT_DEFAULT" ] || mkdir -p "$TS_MOUNTPOINT_DEFAULT"
--
2.17.2

View File

@ -0,0 +1,81 @@
From b48e972b3aa32710ed0495c35b2184f5d3ec9eb0 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Fri, 30 Nov 2018 12:24:15 +0100
Subject: [PATCH 10/14] tests: make lsns-netnsid portable
It seems ip(8) link-show command does not provide link-netnsid in all
cases (versions ?). Let's try to use "ip netns list-id" as fallback.
This commit also add possibility to debug the script by $LOG variable.
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1656437
Upstream: http://github.com/karelzak/util-linux/commit/0d79f5805ff2d7651ec70b06753e908cc782857a
Signed-off-by: Karel Zak <kzak@redhat.com>
---
tests/ts/lsns/netnsid | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/tests/ts/lsns/netnsid b/tests/ts/lsns/netnsid
index 72c14de6c..9d04f28f0 100755
--- a/tests/ts/lsns/netnsid
+++ b/tests/ts/lsns/netnsid
@@ -36,6 +36,7 @@ vethb=lsns-vethb
NS=LSNS-TEST-NETNSID-NS
FIFO=$TS_OUTDIR/FIFO-NETNSID
NULL=/dev/null
+LOG=/dev/null #/root/foo.log
function cleanup {
ip link delete $vetha 2> $NULL || :
@@ -43,24 +44,47 @@ function cleanup {
rm -f $FIFO
}
+echo "==Cleanup" >> $LOG
cleanup
+
+echo "==Create FIFO" >> $LOG
mkfifo $FIFO
+echo "==Netns ADD" >> $LOG
if ip netns add $NS &&
ip link add name $vetha type veth peer name $vethb &&
ip link set $vethb netns $NS; then
+ echo "===Netns EXEC" >> $LOG
ip netns exec $NS dd if=$FIFO bs=1 count=2 of=$NULL 2> $NULL &
PID=$!
+ echo "====PID=$PID" >> $LOG
else
cleanup
ts_skip "failed to initialize"
fi
{
+ echo "==Write to FIFO" >> $LOG
dd if=/dev/zero bs=1 count=1 2> $NULL
{
- ip -o link show dev $vetha > $NULL
+ echo "===IP output" >> $LOG
+ ip -o link show dev $vetha >> $LOG
+
IP_ID=$(ip -o link show dev $vetha | sed -ne 's/.* *link-netnsid *\([0-9]*\)/\1/p')
+ echo "====ip show: IP_ID=$IP_ID" >> $LOG
+
+ if [ "x$IP_ID" = "x" ]; then
+ echo "===IP output list id" >> $LOG
+ ip netns list-id >> $LOG
+
+ IP_ID=$(ip netns list-id | awk "/name: $NS/ { print \$2 }")
+ echo "====ip list-id: IP_ID=$IP_ID" >> $LOG
+ fi
+
+ echo "===LSNS output" >> $LOG
+ $TS_CMD_LSNS -o+NETNSID,NSFS --type net >> $LOG
+
LSNS_ID=$($TS_CMD_LSNS -n -o NETNSID --type net --task $PID | { read VAL; echo $VAL; } )
+ echo "===LSNS_ID=$LSNS_ID" >> $LOG
}
dd if=/dev/zero bs=1 count=1 2> $NULL
} > $FIFO
--
2.17.2

View File

@ -0,0 +1,111 @@
From c2b650ebe33a001b3bf19912b136dbbff5495600 Mon Sep 17 00:00:00 2001
From: Frank Schaefer <kelledin@gmail.com>
Date: Tue, 10 Jul 2018 20:21:02 -0500
Subject: [PATCH 11/14] tests: break up large strings for PySys_WriteStdout()
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1656437
Upstream: http://github.com/karelzak/util-linux/commit/8a12ab57755afc36546834f175ef0b9e9376ba59
Signed-off-by: Karel Zak <kzak@redhat.com>
---
libmount/python/fs.c | 56 ++++++++++++++++++++++++++++++++++----------
1 file changed, 43 insertions(+), 13 deletions(-)
diff --git a/libmount/python/fs.c b/libmount/python/fs.c
index d6490d248..634a914ef 100644
--- a/libmount/python/fs.c
+++ b/libmount/python/fs.c
@@ -63,32 +63,62 @@ static PyObject *Fs_get_devno(FsObject *self)
return PyObjectResultInt(mnt_fs_get_devno(self->fs));
}
+static void _dump_debug_string(const char *lead, const char *s, char quote)
+{
+ /* PySys_WriteStdout() will automatically truncate any '%s' token
+ * longer than a certain length (documented as 1000 bytes, but we
+ * give ourselves some margin here just in case). The only way I
+ * know to get around this is to print such strings in bite-sized
+ * chunks.
+ */
+ static const unsigned int _PY_MAX_LEN = 900;
+ static const char *_PY_MAX_LEN_FMT = "%.900s";
+ unsigned int len;
+
+ if (lead != NULL)
+ PySys_WriteStdout("%s", lead);
+
+ if (quote != 0)
+ PySys_WriteStdout("%c", quote);
+
+ for (len = strlen(s); len > _PY_MAX_LEN; len -= _PY_MAX_LEN, s += _PY_MAX_LEN)
+ PySys_WriteStdout(_PY_MAX_LEN_FMT, s);
+
+ if (len > 0)
+ PySys_WriteStdout(_PY_MAX_LEN_FMT, s);
+
+ if (quote != 0)
+ PySys_WriteStdout("%c\n", quote);
+ else
+ PySys_WriteStdout("\n");
+}
+
#define Fs_print_debug_HELP "print_debug()\n\n"
static PyObject *Fs_print_debug(FsObject *self)
{
PySys_WriteStdout("------ fs: %p\n", self->fs);
- PySys_WriteStdout("source: %s\n", mnt_fs_get_source(self->fs));
- PySys_WriteStdout("target: %s\n", mnt_fs_get_target(self->fs));
- PySys_WriteStdout("fstype: %s\n", mnt_fs_get_fstype(self->fs));
+ _dump_debug_string("source: ", mnt_fs_get_source(self->fs), 0);
+ _dump_debug_string("target: ", mnt_fs_get_target(self->fs), 0);
+ _dump_debug_string("fstype: ", mnt_fs_get_fstype(self->fs), 0);
if (mnt_fs_get_options(self->fs))
- PySys_WriteStdout("optstr: %s\n", mnt_fs_get_options(self->fs));
+ _dump_debug_string("optstr: ", mnt_fs_get_options(self->fs), 0);
if (mnt_fs_get_vfs_options(self->fs))
- PySys_WriteStdout("VFS-optstr: %s\n", mnt_fs_get_vfs_options(self->fs));
+ _dump_debug_string("VFS-optstr: ", mnt_fs_get_vfs_options(self->fs), 0);
if (mnt_fs_get_fs_options(self->fs))
- PySys_WriteStdout("FS-opstr: %s\n", mnt_fs_get_fs_options(self->fs));
+ _dump_debug_string("FS-opstr: ", mnt_fs_get_fs_options(self->fs), 0);
if (mnt_fs_get_user_options(self->fs))
- PySys_WriteStdout("user-optstr: %s\n", mnt_fs_get_user_options(self->fs));
+ _dump_debug_string("user-optstr: ", mnt_fs_get_user_options(self->fs), 0);
if (mnt_fs_get_optional_fields(self->fs))
- PySys_WriteStdout("optional-fields: '%s'\n", mnt_fs_get_optional_fields(self->fs));
+ _dump_debug_string("optional-fields: ", mnt_fs_get_optional_fields(self->fs), '\'');
if (mnt_fs_get_attributes(self->fs))
- PySys_WriteStdout("attributes: %s\n", mnt_fs_get_attributes(self->fs));
+ _dump_debug_string("attributes: ", mnt_fs_get_attributes(self->fs), 0);
if (mnt_fs_get_root(self->fs))
- PySys_WriteStdout("root: %s\n", mnt_fs_get_root(self->fs));
+ _dump_debug_string("root: ", mnt_fs_get_root(self->fs), 0);
if (mnt_fs_get_swaptype(self->fs))
- PySys_WriteStdout("swaptype: %s\n", mnt_fs_get_swaptype(self->fs));
+ _dump_debug_string("swaptype: ", mnt_fs_get_swaptype(self->fs), 0);
if (mnt_fs_get_size(self->fs))
PySys_WriteStdout("size: %jd\n", mnt_fs_get_size(self->fs));
if (mnt_fs_get_usedsize(self->fs))
@@ -97,7 +127,7 @@ static PyObject *Fs_print_debug(FsObject *self)
PySys_WriteStdout("priority: %d\n", mnt_fs_get_priority(self->fs));
if (mnt_fs_get_bindsrc(self->fs))
- PySys_WriteStdout("bindsrc: %s\n", mnt_fs_get_bindsrc(self->fs));
+ _dump_debug_string("bindsrc: ", mnt_fs_get_bindsrc(self->fs), 0);
if (mnt_fs_get_freq(self->fs))
PySys_WriteStdout("freq: %d\n", mnt_fs_get_freq(self->fs));
if (mnt_fs_get_passno(self->fs))
@@ -112,7 +142,7 @@ static PyObject *Fs_print_debug(FsObject *self)
if (mnt_fs_get_tid(self->fs))
PySys_WriteStdout("tid: %d\n", mnt_fs_get_tid(self->fs));
if (mnt_fs_get_comment(self->fs))
- PySys_WriteStdout("comment: '%s'\n", mnt_fs_get_comment(self->fs));
+ _dump_debug_string("comment: ", mnt_fs_get_comment(self->fs), '\'');
return UL_IncRef(self);
}
/*
--
2.17.2

View File

@ -0,0 +1,33 @@
From 0afd0613fc738659fb0ff490e4e069366dee4a94 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 10 Dec 2018 16:25:08 +0100
Subject: [PATCH 12/14] libmount: (umount) make mnt_stat_mountpoin() usable for
relative paths
# mount -o loop devicefile /mnt/test
# umount devicefile
umount: devicefile: not mounted.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1653781
Upstream: http://github.com/karelzak/util-linux/commit/2859592ecb7b48d47d2e34d589ea35f76e329416
Signed-off-by: Karel Zak <kzak@redhat.com>
---
libmount/src/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmount/src/utils.c b/libmount/src/utils.c
index fd98d0529..c36187c07 100644
--- a/libmount/src/utils.c
+++ b/libmount/src/utils.c
@@ -121,7 +121,7 @@ static int fstype_cmp(const void *v1, const void *v2)
int mnt_stat_mountpoint(const char *target, struct stat *st)
{
#ifdef AT_NO_AUTOMOUNT
- return fstatat(-1, target, st, AT_NO_AUTOMOUNT);
+ return fstatat(AT_FDCWD, target, st, AT_NO_AUTOMOUNT);
#else
return stat(target, st);
#endif
--
2.17.2

View File

@ -0,0 +1,65 @@
From 5aea6937edf77a753e0d504bb637214e116aaed2 Mon Sep 17 00:00:00 2001
From: KyleMahlkuch <Kyle.Mahlkuch@ibm.com>
Date: Mon, 25 Jun 2018 14:52:01 -0500
Subject: [PATCH 13/14] 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.
Upstream: http://github.com/karelzak/util-linux/commit/73775189767195f1d9f5b6b6f6a54e51f61c4356
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1655650
Signed-off-by: Karel Zak <kzak@redhat.com>
---
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 5ba9e0466..54e28b2fa 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)
--
2.17.2

View File

@ -0,0 +1,136 @@
From 64473a830dc93e7fcd246a64bb8389d66f0034b8 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 29 Nov 2018 13:21:36 +0100
Subject: [PATCH 14/14] blkid: make PART_ENTRY_* tags optional (add
--no-part-details)
blkid(8) returns information from partition table also for empty
partitions. This is necessary for example for udev, but it could be
confusing if you care about on-device content only.
Default:
# blkid -p /dev/md0p1; echo $?
/dev/md0p1: PART_ENTRY_SCHEME="dos" PART_ENTRY_UUID="6d8796b1-01" PART_ENTRY_TYPE="0x83" PART_ENTRY_NUMBER="1" PART_ENTRY_OFFSET="2048" PART_ENTRY_SIZE="204800" PART_ENTRY_DISK="9:0"
0
With --no-part-details:
# blkid -p /dev/md0p1 --no-part-details; echo $?
2
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1653413
Upstream: http://github.com/karelzak/util-linux/commit/5e91d5dd716ebc6144bcb0cabb0ec847a678be9e
Signed-off-by: Karel Zak <kzak@redhat.com>
---
misc-utils/blkid.8 | 6 +++++-
misc-utils/blkid.c | 15 +++++++++++----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/misc-utils/blkid.8 b/misc-utils/blkid.8
index 13b5edb4d..d1cec1dea 100644
--- a/misc-utils/blkid.8
+++ b/misc-utils/blkid.8
@@ -35,6 +35,7 @@ blkid \- locate/print block device attributes
.IR list ]
.RB [ \-\-usages
.IR list ]
+.RB [ \-\-no\-part\-details ]
.IR device " ..."
.IP \fBblkid\fR
@@ -114,6 +115,9 @@ Don't encode non-printing characters. The non-printing characters are encoded
by ^ and M- notation by default. Note that the \fB\-\-output udev\fR output format uses
a different encoding which cannot be disabled.
.TP
+\fB\-D\fR, \fB\-\-no\-part\-details\fR
+Don't print information (PART_ENTRY_* tags) from partition table in low-level probing mode.
+.TP
\fB\-g\fR, \fB\-\-garbage\-collect\fR
Perform a garbage collection pass on the blkid cache to remove
devices which no longer exist.
@@ -224,7 +228,7 @@ Note that low-level probing also returns information about partition table type
(PTTYPE tag) and partitions (PART_ENTRY_* tags). The tag names produced by
low-level probing are based on names used internally by libblkid and it may be
different than when executed without \fB\-\-probe\fR (for example PART_ENTRY_UUID= vs
-PARTUUID=).
+PARTUUID=). See also \fB\-\-no\-part\-details\fR.
.TP
\fB\-s\fR, \fB\-\-match\-tag\fR \fItag\fR
For each (specified) device, show only the tags that match
diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c
index 4cd85317f..61a6994c2 100644
--- a/misc-utils/blkid.c
+++ b/misc-utils/blkid.c
@@ -58,6 +58,7 @@ struct blkid_control {
lowprobe:1,
lowprobe_superblocks:1,
lowprobe_topology:1,
+ no_part_details:1,
raw_chars:1;
};
@@ -101,6 +102,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_( " -O, --offset <offset> probe at the given offset\n"), out);
fputs(_( " -u, --usages <list> filter by \"usage\" (e.g. -u filesystem,raid)\n"), out);
fputs(_( " -n, --match-types <list> filter by filesystem type (e.g. -n vfat,ext3)\n"), out);
+ fputs(_( " -D, --no-part-details don't print info from partition table\n"), out);
fputs(USAGE_SEPARATOR, out);
printf(USAGE_HELP_OPTIONS(28));
@@ -444,7 +446,7 @@ done:
return rc;
}
-static int lowprobe_superblocks(blkid_probe pr)
+static int lowprobe_superblocks(blkid_probe pr, struct blkid_control *ctl)
{
struct stat st;
int rc, fd = blkid_probe_get_fd(pr);
@@ -470,7 +472,8 @@ static int lowprobe_superblocks(blkid_probe pr)
return 0; /* partition table detected */
}
- blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS);
+ if (!ctl->no_part_details)
+ blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS);
blkid_probe_enable_superblocks(pr, 1);
return blkid_do_safeprobe(pr);
@@ -509,7 +512,7 @@ static int lowprobe_device(blkid_probe pr, const char *devname,
if (ctl->lowprobe_topology)
rc = lowprobe_topology(pr);
if (rc >= 0 && ctl->lowprobe_superblocks)
- rc = lowprobe_superblocks(pr);
+ rc = lowprobe_superblocks(pr, ctl);
if (rc < 0)
goto done;
@@ -661,6 +664,7 @@ int main(int argc, char **argv)
static const struct option longopts[] = {
{ "cache-file", required_argument, NULL, 'c' },
{ "no-encoding", no_argument, NULL, 'd' },
+ { "no-part-details", no_argument, NULL, 'D' },
{ "garbage-collect", no_argument, NULL, 'g' },
{ "output", required_argument, NULL, 'o' },
{ "list-filesystems", no_argument, NULL, 'k' },
@@ -694,7 +698,7 @@ int main(int argc, char **argv)
strutils_set_exitcode(BLKID_EXIT_OTHER);
while ((c = getopt_long (argc, argv,
- "c:dghilL:n:ko:O:ps:S:t:u:U:w:Vv", longopts, NULL)) != -1) {
+ "c:DdghilL:n:ko:O:ps:S:t:u:U:w:Vv", longopts, NULL)) != -1) {
err_exclusive_options(c, NULL, excl, excl_st);
@@ -705,6 +709,9 @@ int main(int argc, char **argv)
case 'd':
ctl.raw_chars = 1;
break;
+ case 'D':
+ ctl.no_part_details = 1;
+ break;
case 'L':
ctl.eval = 1;
search_value = xstrdup(optarg);
--
2.17.2

View File

@ -0,0 +1,132 @@
From 9bccbbf06a91f4e7bf5c0cddadf18265dc2e9e4b Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 4 Mar 2019 16:42:30 +0100
Subject: [PATCH 15/19] tests: add missing ts_check_test_command calls
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1681062
Upstream: http://github.com/karelzak/util-linux/commit/19e00ec9e9e9c36305cf2dd163d0333e2d72c671
Signed-off-by: Karel Zak <kzak@redhat.com>
---
tests/ts/fsck/ismounted | 2 ++
tests/ts/hexdump/format-strings | 1 +
tests/ts/hexdump/highlighting | 1 +
tests/ts/ipcs/limits | 1 +
tests/ts/ipcs/limits2 | 1 +
tests/ts/ipcs/mk-rm-msg | 1 +
tests/ts/ipcs/mk-rm-sem | 1 +
tests/ts/ipcs/mk-rm-shm | 1 +
tests/ts/misc/swaplabel | 1 +
9 files changed, 10 insertions(+)
diff --git a/tests/ts/fsck/ismounted b/tests/ts/fsck/ismounted
index 2a55907a7..7d1fe6273 100755
--- a/tests/ts/fsck/ismounted
+++ b/tests/ts/fsck/ismounted
@@ -22,6 +22,8 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_FDISK"
ts_check_test_command "$TS_CMD_MOUNT"
+ts_check_test_command "$TS_CMD_UMOUNT"
+ts_check_test_command "$TS_HELPER_ISMOUNTED"
ts_skip_nonroot
ts_check_losetup
diff --git a/tests/ts/hexdump/format-strings b/tests/ts/hexdump/format-strings
index e6f9229a5..f2dc6a89b 100755
--- a/tests/ts/hexdump/format-strings
+++ b/tests/ts/hexdump/format-strings
@@ -23,6 +23,7 @@ FILES="$TS_TOPDIR/ts/hexdump/files"
ts_init "$*"
ts_check_test_command "$TS_CMD_HEXDUMP"
+ts_check_test_command "$TS_HELPER_SYSINFO"
# on big endian systems some of the subtests have different expected output
BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order)
diff --git a/tests/ts/hexdump/highlighting b/tests/ts/hexdump/highlighting
index cf78f7b96..e57757978 100755
--- a/tests/ts/hexdump/highlighting
+++ b/tests/ts/hexdump/highlighting
@@ -25,6 +25,7 @@ ADDRFMT='-e "%07.7_Ax\n"'
ts_init "$*"
ts_check_test_command "$TS_CMD_HEXDUMP"
+ts_check_test_command "$TS_HELPER_SYSINFO"
# on big endian systems some of the subtests have different expected output
BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order)
diff --git a/tests/ts/ipcs/limits b/tests/ts/ipcs/limits
index 7b64b3c17..671f23c77 100755
--- a/tests/ts/ipcs/limits
+++ b/tests/ts/ipcs/limits
@@ -23,6 +23,7 @@ TS_DESC="limits overflow"
ts_init "$*"
ts_check_test_command "$TS_CMD_IPCS"
+ts_check_test_command "$TS_HELPER_SYSINFO"
ts_skip_nonroot
ts_check_prog "bc"
diff --git a/tests/ts/ipcs/limits2 b/tests/ts/ipcs/limits2
index d23c41a35..77ad70f9b 100755
--- a/tests/ts/ipcs/limits2
+++ b/tests/ts/ipcs/limits2
@@ -23,6 +23,7 @@ TS_DESC="basic limits"
ts_init "$*"
ts_check_test_command "$TS_CMD_IPCS"
+ts_check_test_command "$TS_HELPER_SYSINFO"
ts_check_prog "bc"
. $TS_SELF/functions.sh
diff --git a/tests/ts/ipcs/mk-rm-msg b/tests/ts/ipcs/mk-rm-msg
index 25460e25d..de3682e87 100755
--- a/tests/ts/ipcs/mk-rm-msg
+++ b/tests/ts/ipcs/mk-rm-msg
@@ -21,6 +21,7 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_IPCS"
ts_check_test_command "$TS_CMD_IPCMK"
ts_check_test_command "$TS_CMD_IPCRM"
+ts_check_test_command "$TS_HELPER_SYSINFO"
. $TS_SELF/functions.sh
diff --git a/tests/ts/ipcs/mk-rm-sem b/tests/ts/ipcs/mk-rm-sem
index 61e0cfdef..d7b505f7c 100755
--- a/tests/ts/ipcs/mk-rm-sem
+++ b/tests/ts/ipcs/mk-rm-sem
@@ -21,6 +21,7 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_IPCS"
ts_check_test_command "$TS_CMD_IPCMK"
ts_check_test_command "$TS_CMD_IPCRM"
+ts_check_test_command "$TS_HELPER_SYSINFO"
. $TS_SELF/functions.sh
diff --git a/tests/ts/ipcs/mk-rm-shm b/tests/ts/ipcs/mk-rm-shm
index 838fb3f21..c21547b82 100755
--- a/tests/ts/ipcs/mk-rm-shm
+++ b/tests/ts/ipcs/mk-rm-shm
@@ -21,6 +21,7 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_IPCS"
ts_check_test_command "$TS_CMD_IPCMK"
ts_check_test_command "$TS_CMD_IPCRM"
+ts_check_test_command "$TS_HELPER_SYSINFO"
. $TS_SELF/functions.sh
diff --git a/tests/ts/misc/swaplabel b/tests/ts/misc/swaplabel
index 646304508..22858b0ac 100755
--- a/tests/ts/misc/swaplabel
+++ b/tests/ts/misc/swaplabel
@@ -20,6 +20,7 @@ ts_init "$*"
ts_check_test_command "$TS_CMD_MKSWAP"
ts_check_test_command "$TS_CMD_SWAPLABEL"
+ts_check_test_command "$TS_HELPER_SYSINFO"
# fallocate does not work on most file systems
function fallocate_or_skip()
--
2.20.1

View File

@ -0,0 +1,357 @@
From 748fbfa9b1bb3b64b3fbc6b1e51d260d8376c791 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 4 Mar 2019 17:10:04 +0100
Subject: [PATCH 16/19] tests: add --use-system-commands
This change allows to use commands from $PATH rather than from
$top_builddir. There two basic use cases:
* check differences between installed and git version
run.sh --use-system-command --show-diff
* check system binaries by upstream tests (for example tests from
src.rpm package)
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1681062
Upstream: http://github.com/karelzak/util-linux/commit/43b4a4d3c720a4e65fe9de884cd73e0b1b94fbe
Signed-off-by: Karel Zak <kzak@redhat.com>
---
tests/commands.sh | 194 ++++++++++++++++++++++-----------------------
tests/functions.sh | 34 ++++++--
tests/run.sh | 33 +++++---
3 files changed, 146 insertions(+), 115 deletions(-)
diff --git a/tests/commands.sh b/tests/commands.sh
index 1be2d25b4..93100caf6 100644
--- a/tests/commands.sh
+++ b/tests/commands.sh
@@ -2,105 +2,105 @@
TS_TESTUSER=${TS_TESTUSER:-"nobody"}
# helpers
-TS_HELPER_BYTESWAP="$top_builddir/test_byteswap"
-TS_HELPER_CPUSET="$top_builddir/test_cpuset"
-TS_HELPER_DMESG="$top_builddir/test_dmesg"
-TS_HELPER_ISLOCAL="$top_builddir/test_islocal"
-TS_HELPER_ISMOUNTED="$top_builddir/test_ismounted"
-TS_HELPER_LIBFDISK_GPT="$top_builddir/test_fdisk_gpt"
-TS_HELPER_LIBFDISK_MKPART="$top_builddir/sample-fdisk-mkpart"
-TS_HELPER_LIBMOUNT_CONTEXT="$top_builddir/test_mount_context"
-TS_HELPER_LIBFDISK_MKPART_FULLSPEC="$top_builddir/sample-fdisk-mkpart-fullspec"
-TS_HELPER_LIBMOUNT_LOCK="$top_builddir/test_mount_lock"
-TS_HELPER_LIBMOUNT_OPTSTR="$top_builddir/test_mount_optstr"
-TS_HELPER_LIBMOUNT_TABDIFF="$top_builddir/test_mount_tab_diff"
-TS_HELPER_LIBMOUNT_TAB="$top_builddir/test_mount_tab"
-TS_HELPER_LIBMOUNT_UPDATE="$top_builddir/test_mount_tab_update"
-TS_HELPER_LIBMOUNT_UTILS="$top_builddir/test_mount_utils"
-TS_HELPER_LIBMOUNT_DEBUG="$top_builddir/test_mount_debug"
-TS_HELPER_LIBSMARTCOLS_FROMFILE="$top_builddir/sample-scols-fromfile"
-TS_HELPER_LIBSMARTCOLS_TITLE="$top_builddir/sample-scols-title"
+TS_HELPER_BYTESWAP="${ts_helpersdir}test_byteswap"
+TS_HELPER_CPUSET="${ts_helpersdir}test_cpuset"
+TS_HELPER_DMESG="${ts_helpersdir}test_dmesg"
+TS_HELPER_ISLOCAL="${ts_helpersdir}test_islocal"
+TS_HELPER_ISMOUNTED="${ts_helpersdir}test_ismounted"
+TS_HELPER_LIBFDISK_GPT="${ts_helpersdir}test_fdisk_gpt"
+TS_HELPER_LIBFDISK_MKPART="${ts_helpersdir}sample-fdisk-mkpart"
+TS_HELPER_LIBMOUNT_CONTEXT="${ts_helpersdir}test_mount_context"
+TS_HELPER_LIBFDISK_MKPART_FULLSPEC="${ts_helpersdir}sample-fdisk-mkpart-fullspec"
+TS_HELPER_LIBMOUNT_LOCK="${ts_helpersdir}test_mount_lock"
+TS_HELPER_LIBMOUNT_OPTSTR="${ts_helpersdir}test_mount_optstr"
+TS_HELPER_LIBMOUNT_TABDIFF="${ts_helpersdir}test_mount_tab_diff"
+TS_HELPER_LIBMOUNT_TAB="${ts_helpersdir}test_mount_tab"
+TS_HELPER_LIBMOUNT_UPDATE="${ts_helpersdir}test_mount_tab_update"
+TS_HELPER_LIBMOUNT_UTILS="${ts_helpersdir}test_mount_utils"
+TS_HELPER_LIBMOUNT_DEBUG="${ts_helpersdir}test_mount_debug"
+TS_HELPER_LIBSMARTCOLS_FROMFILE="${ts_helpersdir}sample-scols-fromfile"
+TS_HELPER_LIBSMARTCOLS_TITLE="${ts_helpersdir}sample-scols-title"
TS_HELPER_PYLIBMOUNT_CONTEXT="$top_srcdir/libmount/python/test_mount_context.py"
TS_HELPER_PYLIBMOUNT_TAB="$top_srcdir/libmount/python/test_mount_tab.py"
TS_HELPER_PYLIBMOUNT_UPDATE="$top_srcdir/libmount/python/test_mount_tab_update.py"
-TS_HELPER_LOGGER="$top_builddir/test_logger"
-TS_HELPER_LOGINDEFS="$top_builddir/test_logindefs"
-TS_HELPER_MD5="$top_builddir/test_md5"
-TS_HELPER_SHA1="$top_builddir/test_sha1"
-TS_HELPER_MKFS_MINIX="$top_builddir/test_mkfs_minix"
-TS_HELPER_MORE=${TS_HELPER_MORE-"$top_builddir/test_more"}
-TS_HELPER_PARTITIONS="$top_builddir/sample-partitions"
-TS_HELPER_PATHS="$top_builddir/test_pathnames"
-TS_HELPER_SCRIPT="$top_builddir/test_script"
-TS_HELPER_SIGRECEIVE="$top_builddir/test_sigreceive"
-TS_HELPER_STRUTILS="$top_builddir/test_strutils"
-TS_HELPER_SYSINFO="$top_builddir/test_sysinfo"
-TS_HELPER_TIOCSTI="$top_builddir/test_tiocsti"
-TS_HELPER_UUID_PARSER="$top_builddir/test_uuid_parser"
-TS_HELPER_UUID_NAMESPACE="$top_builddir/test_uuid_namespace"
-TS_HELPER_MBSENCODE="$top_builddir/test_mbsencode"
-TS_HELPER_CAL="$top_builddir/test_cal"
+TS_HELPER_LOGGER="${ts_helpersdir}test_logger"
+TS_HELPER_LOGINDEFS="${ts_helpersdir}test_logindefs"
+TS_HELPER_MD5="${ts_helpersdir}test_md5"
+TS_HELPER_SHA1="${ts_helpersdir}test_sha1"
+TS_HELPER_MKFS_MINIX="${ts_helpersdir}test_mkfs_minix"
+TS_HELPER_MORE=${TS_HELPER_MORE-"${ts_helpersdir}test_more"}
+TS_HELPER_PARTITIONS="${ts_helpersdir}sample-partitions"
+TS_HELPER_PATHS="${ts_helpersdir}test_pathnames"
+TS_HELPER_SCRIPT="${ts_helpersdir}test_script"
+TS_HELPER_SIGRECEIVE="${ts_helpersdir}test_sigreceive"
+TS_HELPER_STRUTILS="${ts_helpersdir}test_strutils"
+TS_HELPER_SYSINFO="${ts_helpersdir}test_sysinfo"
+TS_HELPER_TIOCSTI="${ts_helpersdir}test_tiocsti"
+TS_HELPER_UUID_PARSER="${ts_helpersdir}test_uuid_parser"
+TS_HELPER_UUID_NAMESPACE="${ts_helpersdir}test_uuid_namespace"
+TS_HELPER_MBSENCODE="${ts_helpersdir}test_mbsencode"
+TS_HELPER_CAL="${ts_helpersdir}test_cal"
# paths to commands
-TS_CMD_ADDPART=${TS_CMD_ADDPART:-"$top_builddir/addpart"}
-TS_CMD_DELPART=${TS_CMD_DELPART:-"$top_builddir/delpart"}
-TS_CMD_BLKDISCARD=${TS_CMD_BLKID-"$top_builddir/blkdiscard"}
-TS_CMD_BLKID=${TS_CMD_BLKID-"$top_builddir/blkid"}
-TS_CMD_CAL=${TS_CMD_CAL-"$top_builddir/cal"}
-TS_CMD_COLCRT=${TS_CMD_COLCRT:-"$top_builddir/colcrt"}
-TS_CMD_COLRM=${TS_CMD_COLRM:-"$top_builddir/colrm"}
-TS_CMD_COL=${TS_CMD_COL:-"$top_builddir/col"}
-TS_CMD_COLUMN=${TS_CMD_COLUMN:-"$top_builddir/column"}
-TS_CMD_EJECT=${TS_CMD_EJECT-"$top_builddir/eject"}
-TS_CMD_FALLOCATE=${TS_CMD_FALLOCATE-"$top_builddir/fallocate"}
-TS_CMD_FDISK=${TS_CMD_FDISK-"$top_builddir/fdisk"}
-TS_CMD_FLOCK=${TS_CMD_FLOCK-"$top_builddir/flock"}
-TS_CMD_SFDISK=${TS_CMD_SFDISK-"$top_builddir/sfdisk"}
-TS_CMD_FINCORE=${TS_CMD_FINCORE-"$top_builddir/fincore"}
-TS_CMD_FINDMNT=${TS_CMD_FINDMNT-"$top_builddir/findmnt"}
-TS_CMD_FSCKCRAMFS=${TS_CMD_FSCKCRAMFS:-"$top_builddir/fsck.cramfs"}
-TS_CMD_FSCKMINIX=${TS_CMD_FSCKMINIX:-"$top_builddir/fsck.minix"}
-TS_CMD_GETOPT=${TS_CMD_GETOPT-"$top_builddir/getopt"}
-TS_CMD_HEXDUMP=${TS_CMD_HEXDUMP-"$top_builddir/hexdump"}
-TS_CMD_HWCLOCK=${TS_CMD_HWCLOCK-"$top_builddir/hwclock"}
-TS_CMD_IONICE=${TS_CMD_IONICE-"$top_builddir/ionice"}
-TS_CMD_IPCMK=${TS_CMD_IPCMK-"$top_builddir/ipcmk"}
-TS_CMD_IPCRM=${TS_CMD_IPCRM-"$top_builddir/ipcrm"}
-TS_CMD_IPCS=${TS_CMD_IPCS:-"$top_builddir/ipcs"}
-TS_CMD_ISOSIZE=${TS_CMD_ISOSIZE-"$top_builddir/isosize"}
-TS_CMD_KILL=${TS_CMD_KILL-"$top_builddir/kill"}
-TS_CMD_LAST=${TS_CMD_LAST-"$top_builddir/last"}
-TS_CMD_LINE=${TS_CMD_LINE-"$top_builddir/line"}
-TS_CMD_LOOK=${TS_CMD_LOOK-"$top_builddir/look"}
-TS_CMD_LOSETUP=${TS_CMD_LOSETUP:-"$top_builddir/losetup"}
-TS_CMD_LSBLK=${TS_CMD_LSBLK-"$top_builddir/lsblk"}
-TS_CMD_LSCPU=${TS_CMD_LSCPU-"$top_builddir/lscpu"}
-TS_CMD_LSMEM=${TS_CMD_LSMEM-"$top_builddir/lsmem"}
-TS_CMD_LSNS=${TS_CMD_LSNS-"$top_builddir/lsns"}
-TS_CMD_MCOOKIE=${TS_CMD_MCOOKIE-"$top_builddir/mcookie"}
-TS_CMD_MKCRAMFS=${TS_CMD_MKCRAMFS:-"$top_builddir/mkfs.cramfs"}
-TS_CMD_MKMINIX=${TS_CMD_MKMINIX:-"$top_builddir/mkfs.minix"}
-TS_CMD_MKSWAP=${TS_CMD_MKSWAP:-"$top_builddir/mkswap"}
-TS_CMD_MOUNT=${TS_CMD_MOUNT:-"$top_builddir/mount"}
-TS_CMD_MOUNTPOINT=${TS_CMD_MOUNTPOINT:-"$top_builddir/mountpoint"}
-TS_CMD_NAMEI=${TS_CMD_NAMEI-"$top_builddir/namei"}
-TS_CMD_PARTX=${TS_CMD_PARTX-"$top_builddir/partx"}
-TS_CMD_RENAME=${TS_CMD_RENAME-"$top_builddir/rename"}
-TS_CMD_RUNUSER=${TS_CMD_RUNUSER-"$top_builddir/runuser"}
-TS_CMD_REV=${TS_CMD_REV:-"$top_builddir/rev"}
-TS_CMD_SCRIPT=${TS_CMD_SCRIPT-"$top_builddir/script"}
-TS_CMD_SCRIPTREPLAY=${TS_CMD_SCRIPTREPLAY-"$top_builddir/scriptreplay"}
-TS_CMD_SETARCH=${TS_CMD_SETARCH-"$top_builddir/setarch"}
-TS_CMD_SETSID=${TS_CMD_SETSID-"$top_builddir/setsid"}
-TS_CMD_SWAPLABEL=${TS_CMD_SWAPLABEL:-"$top_builddir/swaplabel"}
-TS_CMD_SWAPOFF=${TS_CMD_SWAPOFF:-"$top_builddir/swapoff"}
-TS_CMD_SWAPON=${TS_CMD_SWAPON:-"$top_builddir/swapon"}
-TS_CMD_UL=${TS_CMD_UL-"$top_builddir/ul"}
-TS_CMD_UMOUNT=${TS_CMD_UMOUNT:-"$top_builddir/umount"}
-TS_CMD_UTMPDUMP=${TS_CMD_UTMPDUMP-"$top_builddir/utmpdump"}
-TS_CMD_UUIDD=${TS_CMD_UUIDD-"$top_builddir/uuidd"}
-TS_CMD_UUIDGEN=${TS_CMD_UUIDGEN-"$top_builddir/uuidgen"}
-TS_CMD_UUIDPARSE=${TS_CMD_UUIDPARSE-"$top_builddir/uuidparse"}
-TS_CMD_WHEREIS=${TS_CMD_WHEREIS-"$top_builddir/whereis"}
-TS_CMD_WIPEFS=${TS_CMD_WIPEFS-"$top_builddir/wipefs"}
-TS_CMD_CHRT=${TS_CMD_CHRT-"$top_builddir/chrt"}
+TS_CMD_ADDPART=${TS_CMD_ADDPART:-"${ts_commandsdir}addpart"}
+TS_CMD_DELPART=${TS_CMD_DELPART:-"${ts_commandsdir}delpart"}
+TS_CMD_BLKDISCARD=${TS_CMD_BLKID-"${ts_commandsdir}blkdiscard"}
+TS_CMD_BLKID=${TS_CMD_BLKID-"${ts_commandsdir}blkid"}
+TS_CMD_CAL=${TS_CMD_CAL-"${ts_commandsdir}cal"}
+TS_CMD_COLCRT=${TS_CMD_COLCRT:-"${ts_commandsdir}colcrt"}
+TS_CMD_COLRM=${TS_CMD_COLRM:-"${ts_commandsdir}colrm"}
+TS_CMD_COL=${TS_CMD_COL:-"${ts_commandsdir}col"}
+TS_CMD_COLUMN=${TS_CMD_COLUMN:-"${ts_commandsdir}column"}
+TS_CMD_EJECT=${TS_CMD_EJECT-"${ts_commandsdir}eject"}
+TS_CMD_FALLOCATE=${TS_CMD_FALLOCATE-"${ts_commandsdir}fallocate"}
+TS_CMD_FDISK=${TS_CMD_FDISK-"${ts_commandsdir}fdisk"}
+TS_CMD_FLOCK=${TS_CMD_FLOCK-"${ts_commandsdir}flock"}
+TS_CMD_SFDISK=${TS_CMD_SFDISK-"${ts_commandsdir}sfdisk"}
+TS_CMD_FINCORE=${TS_CMD_FINCORE-"${ts_commandsdir}fincore"}
+TS_CMD_FINDMNT=${TS_CMD_FINDMNT-"${ts_commandsdir}findmnt"}
+TS_CMD_FSCKCRAMFS=${TS_CMD_FSCKCRAMFS:-"${ts_commandsdir}fsck.cramfs"}
+TS_CMD_FSCKMINIX=${TS_CMD_FSCKMINIX:-"${ts_commandsdir}fsck.minix"}
+TS_CMD_GETOPT=${TS_CMD_GETOPT-"${ts_commandsdir}getopt"}
+TS_CMD_HEXDUMP=${TS_CMD_HEXDUMP-"${ts_commandsdir}hexdump"}
+TS_CMD_HWCLOCK=${TS_CMD_HWCLOCK-"${ts_commandsdir}hwclock"}
+TS_CMD_IONICE=${TS_CMD_IONICE-"${ts_commandsdir}ionice"}
+TS_CMD_IPCMK=${TS_CMD_IPCMK-"${ts_commandsdir}ipcmk"}
+TS_CMD_IPCRM=${TS_CMD_IPCRM-"${ts_commandsdir}ipcrm"}
+TS_CMD_IPCS=${TS_CMD_IPCS:-"${ts_commandsdir}ipcs"}
+TS_CMD_ISOSIZE=${TS_CMD_ISOSIZE-"${ts_commandsdir}isosize"}
+TS_CMD_KILL=${TS_CMD_KILL-"${ts_commandsdir}kill"}
+TS_CMD_LAST=${TS_CMD_LAST-"${ts_commandsdir}last"}
+TS_CMD_LINE=${TS_CMD_LINE-"${ts_commandsdir}line"}
+TS_CMD_LOOK=${TS_CMD_LOOK-"${ts_commandsdir}look"}
+TS_CMD_LOSETUP=${TS_CMD_LOSETUP:-"${ts_commandsdir}losetup"}
+TS_CMD_LSBLK=${TS_CMD_LSBLK-"${ts_commandsdir}lsblk"}
+TS_CMD_LSCPU=${TS_CMD_LSCPU-"${ts_commandsdir}lscpu"}
+TS_CMD_LSMEM=${TS_CMD_LSMEM-"${ts_commandsdir}lsmem"}
+TS_CMD_LSNS=${TS_CMD_LSNS-"${ts_commandsdir}lsns"}
+TS_CMD_MCOOKIE=${TS_CMD_MCOOKIE-"${ts_commandsdir}mcookie"}
+TS_CMD_MKCRAMFS=${TS_CMD_MKCRAMFS:-"${ts_commandsdir}mkfs.cramfs"}
+TS_CMD_MKMINIX=${TS_CMD_MKMINIX:-"${ts_commandsdir}mkfs.minix"}
+TS_CMD_MKSWAP=${TS_CMD_MKSWAP:-"${ts_commandsdir}mkswap"}
+TS_CMD_MOUNT=${TS_CMD_MOUNT:-"${ts_commandsdir}mount"}
+TS_CMD_MOUNTPOINT=${TS_CMD_MOUNTPOINT:-"${ts_commandsdir}mountpoint"}
+TS_CMD_NAMEI=${TS_CMD_NAMEI-"${ts_commandsdir}namei"}
+TS_CMD_PARTX=${TS_CMD_PARTX-"${ts_commandsdir}partx"}
+TS_CMD_RENAME=${TS_CMD_RENAME-"${ts_commandsdir}rename"}
+TS_CMD_RUNUSER=${TS_CMD_RUNUSER-"${ts_commandsdir}runuser"}
+TS_CMD_REV=${TS_CMD_REV:-"${ts_commandsdir}rev"}
+TS_CMD_SCRIPT=${TS_CMD_SCRIPT-"${ts_commandsdir}script"}
+TS_CMD_SCRIPTREPLAY=${TS_CMD_SCRIPTREPLAY-"${ts_commandsdir}scriptreplay"}
+TS_CMD_SETARCH=${TS_CMD_SETARCH-"${ts_commandsdir}setarch"}
+TS_CMD_SETSID=${TS_CMD_SETSID-"${ts_commandsdir}setsid"}
+TS_CMD_SWAPLABEL=${TS_CMD_SWAPLABEL:-"${ts_commandsdir}swaplabel"}
+TS_CMD_SWAPOFF=${TS_CMD_SWAPOFF:-"${ts_commandsdir}swapoff"}
+TS_CMD_SWAPON=${TS_CMD_SWAPON:-"${ts_commandsdir}swapon"}
+TS_CMD_UL=${TS_CMD_UL-"${ts_commandsdir}ul"}
+TS_CMD_UMOUNT=${TS_CMD_UMOUNT:-"${ts_commandsdir}umount"}
+TS_CMD_UTMPDUMP=${TS_CMD_UTMPDUMP-"${ts_commandsdir}utmpdump"}
+TS_CMD_UUIDD=${TS_CMD_UUIDD-"${ts_commandsdir}uuidd"}
+TS_CMD_UUIDGEN=${TS_CMD_UUIDGEN-"${ts_commandsdir}uuidgen"}
+TS_CMD_UUIDPARSE=${TS_CMD_UUIDPARSE-"${ts_commandsdir}uuidparse"}
+TS_CMD_WHEREIS=${TS_CMD_WHEREIS-"${ts_commandsdir}whereis"}
+TS_CMD_WIPEFS=${TS_CMD_WIPEFS-"${ts_commandsdir}wipefs"}
+TS_CMD_CHRT=${TS_CMD_CHRT-"${ts_commandsdir}chrt"}
diff --git a/tests/functions.sh b/tests/functions.sh
index 2fb0ddb5f..ab607c4ce 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -75,9 +75,19 @@ function ts_report {
}
function ts_check_test_command {
- if [ ! -x "$1" ]; then
- ts_skip "${1##*/} not found"
- fi
+ case "$1" in
+ */*)
+ # paths
+ if [ ! -x "$1" ]; then
+ ts_skip "${1##*/} not found"
+ fi
+ ;;
+ *)
+ # just command names (e.g. --use-system-commands)
+ local cmd=$1
+ type "$cmd" >/dev/null 2>&1 || ts_skip "missing in PATH: $cmd"
+ ;;
+ esac
}
function ts_check_prog {
@@ -254,8 +264,20 @@ function ts_init_env {
top_srcdir=$(ts_abspath $top_srcdir)
top_builddir=$(ts_abspath $top_builddir)
- # some ul commands search other ul commands in $PATH
- export PATH="$top_builddir:$PATH"
+ # We use helpser always from build tree
+ ts_helpersdir="${top_builddir}/"
+
+ TS_USE_SYSTEM_COMMANDS=$(ts_has_option "use-system-commands" "$*")
+ if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
+ # Don't define anything, just follow current PATH
+ ts_commandsdir=""
+ else
+ # The default is to use commands from build tree
+ ts_commandsdir="${top_builddir}/"
+
+ # some ul commands search other ul commands in $PATH
+ export PATH="$ts_commandsdir:$PATH"
+ fi
TS_SCRIPT="$mydir/$(basename $0)"
TS_SUBDIR=$(dirname $TS_SCRIPT)
@@ -319,6 +341,8 @@ function ts_init_env {
if [ "$TS_VERBOSE" == "yes" ]; then
echo
echo " script: $TS_SCRIPT"
+ echo " commands: $ts_commandsdir"
+ echo " helpers: $ts_helpersdir"
echo " sub dir: $TS_SUBDIR"
echo " top dir: $TS_TOPDIR"
echo " self: $TS_SELF"
diff --git a/tests/run.sh b/tests/run.sh
index f40c9f801..28f8ee25a 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -20,6 +20,7 @@ TS_TOPDIR=$(cd ${0%/*} && pwd)
SUBTESTS=
EXCLUDETESTS=
OPTS=
+SYSCOMMANDS=
top_srcdir=
top_builddir=
@@ -68,6 +69,11 @@ while [ -n "$1" ]; do
# these options are simply forwarded to the test scripts
OPTS="$OPTS $1"
;;
+ --use-system-commands)
+ OPTS="$OPTS $1"
+ SYSCOMMANDS="yes"
+ ;;
+
--nonroot)
if [ $(id -ru) -eq 0 ]; then
echo "Ignore util-linux test suite [non-root UID expected]."
@@ -98,18 +104,19 @@ while [ -n "$1" ]; do
echo "Usage: "
echo " $(basename $0) [options] [<component> ...]"
echo "Options:"
- echo " --force execute demanding tests"
- echo " --fake do not run, setup tests only"
- echo " --memcheck-valgrind run with valgrind"
- echo " --memcheck-asan enable ASAN (requires ./configure --enable-asan)"
- echo " --nolocks don't use flock to lock resources"
- echo " --verbose verbose mode"
- echo " --show-diff show diff from failed tests"
- echo " --nonroot ignore test suite if user is root"
- echo " --srcdir=<path> autotools top source directory"
- echo " --builddir=<path> autotools top build directory"
- echo " --parallel=<num> number of parallel test jobs, default: num cpus"
- echo " --exclude=<list> exclude tests by list '<utilname>/<testname> ..'"
+ echo " --force execute demanding tests"
+ echo " --fake do not run, setup tests only"
+ echo " --memcheck-valgrind run with valgrind"
+ echo " --memcheck-asan enable ASAN (requires ./configure --enable-asan)"
+ echo " --nolocks don't use flock to lock resources"
+ echo " --verbose verbose mode"
+ echo " --show-diff show diff from failed tests"
+ echo " --nonroot ignore test suite if user is root"
+ echo " --use-system-commands use PATH rather than builddir"
+ echo " --srcdir=<path> autotools top source directory"
+ echo " --builddir=<path> autotools top build directory"
+ echo " --parallel=<num> number of parallel test jobs, default: num cpus"
+ echo " --exclude=<list> exclude tests by list '<utilname>/<testname> ..'"
echo
exit 1
;;
@@ -148,7 +155,7 @@ if [ -n "$SUBTESTS" ]; then
fi
done
else
- if [ ! -f "$top_builddir/test_ttyutils" ]; then
+ if [ -z "$SYSCOMMANDS" -a ! -f "$top_builddir/test_ttyutils" ]; then
echo "Tests not compiled! Run 'make check' to fix the problem."
exit 1
fi
--
2.20.1

View File

@ -0,0 +1,99 @@
From 47b0f3480a88be94ef73973e73ad9f7fb8258cad Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 4 Mar 2019 17:28:15 +0100
Subject: [PATCH 17/19] tests: (kill) do not use shell build-in
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1681062
Upstream: http://github.com/karelzak/util-linux/commit/2fadcded53add5b5b0ca7071f310a0f37c711c51
Signed-off-by: Karel Zak <kzak@redhat.com>
---
tests/ts/kill/all_processes | 5 +++++
tests/ts/kill/name_to_number | 5 +++++
tests/ts/kill/options | 5 +++++
tests/ts/kill/print_pid | 5 +++++
tests/ts/kill/queue | 5 +++++
5 files changed, 25 insertions(+)
diff --git a/tests/ts/kill/all_processes b/tests/ts/kill/all_processes
index 2596ef02b..7a0c95931 100755
--- a/tests/ts/kill/all_processes
+++ b/tests/ts/kill/all_processes
@@ -20,6 +20,11 @@ ts_init "$*"
ts_skip_nonroot
+# make sure we do not use shell built-in command
+if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
+ TS_CMD_KILL="/bin/kill"
+fi
+
ts_check_test_command "$TS_CMD_KILL"
ts_check_test_command "$TS_HELPER_SIGRECEIVE"
diff --git a/tests/ts/kill/name_to_number b/tests/ts/kill/name_to_number
index cde55c9ed..fd2aaafe0 100755
--- a/tests/ts/kill/name_to_number
+++ b/tests/ts/kill/name_to_number
@@ -18,6 +18,11 @@ TS_DESC="name_to_number"
. "$TS_TOPDIR/functions.sh"
ts_init "$*"
+# make sure we do not use shell built-in command
+if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
+ TS_CMD_KILL="/bin/kill"
+fi
+
ts_check_test_command "$TS_CMD_KILL"
ts_check_test_command "$TS_HELPER_SIGRECEIVE"
diff --git a/tests/ts/kill/options b/tests/ts/kill/options
index 2c82bbccc..ee9e52f47 100755
--- a/tests/ts/kill/options
+++ b/tests/ts/kill/options
@@ -18,6 +18,11 @@ TS_DESC="options"
. "$TS_TOPDIR/functions.sh"
ts_init "$*"
+# make sure we do not use shell built-in command
+if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
+ TS_CMD_KILL="/bin/kill"
+fi
+
ts_check_test_command "$TS_CMD_KILL"
ts_check_test_command "$TS_HELPER_SIGRECEIVE"
diff --git a/tests/ts/kill/print_pid b/tests/ts/kill/print_pid
index c6187f192..2a2a838ee 100755
--- a/tests/ts/kill/print_pid
+++ b/tests/ts/kill/print_pid
@@ -18,6 +18,11 @@ TS_DESC="print_pid"
. "$TS_TOPDIR/functions.sh"
ts_init "$*"
+# make sure we do not use shell built-in command
+if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
+ TS_CMD_KILL="/bin/kill"
+fi
+
ts_check_test_command "$TS_CMD_KILL"
ts_check_test_command "$TS_HELPER_SIGRECEIVE"
diff --git a/tests/ts/kill/queue b/tests/ts/kill/queue
index 992acf7a6..4727cbfc4 100755
--- a/tests/ts/kill/queue
+++ b/tests/ts/kill/queue
@@ -18,6 +18,11 @@ TS_DESC="queue"
. "$TS_TOPDIR/functions.sh"
ts_init "$*"
+# make sure we do not use shell built-in command
+if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
+ TS_CMD_KILL="/bin/kill"
+fi
+
ts_check_test_command "$TS_CMD_KILL"
ts_check_test_command "$TS_HELPER_SIGRECEIVE"
--
2.20.1

View File

@ -0,0 +1,27 @@
From aa983f0eea49638f04de0fbafcd156c1472726ee Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 4 Mar 2019 17:32:03 +0100
Subject: [PATCH 18/19] tests: add missing TS_CMD_UMOUNT check
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1681062
Upstream: http://github.com/karelzak/util-linux/commit/bb872a239ce9faae7ac672a9137945dd8e4ee964
Signed-off-by: Karel Zak <kzak@redhat.com>
---
tests/ts/libmount/loop | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/ts/libmount/loop b/tests/ts/libmount/loop
index b52b7476a..090b79fa4 100755
--- a/tests/ts/libmount/loop
+++ b/tests/ts/libmount/loop
@@ -23,6 +23,7 @@ TS_DESC="losetup-loop"
ts_init "$*"
ts_check_test_command "$TS_CMD_MOUNT"
+ts_check_test_command "$TS_CMD_UMOUNT"
ts_check_test_command "$TS_CMD_FINDMNT"
ts_check_test_command "$TS_CMD_LOSETUP"
--
2.20.1

View File

@ -0,0 +1,66 @@
From 9e92f2ff939a885b70d3a5d20e8c94f6e41e821b Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 5 Mar 2019 11:06:41 +0100
Subject: [PATCH 19/19] tests: add --noskip-commands
The default is SKIP missing commands on --use-system-commands, but
with --noskip-commands the test will FAIL.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1681062
Upstream: http://github.com/karelzak/util-linux/commit/7c90efa384cbb2ace873e2b90e8cc396a1719535
Signed-off-by: Karel Zak <kzak@redhat.com>
---
tests/functions.sh | 9 ++++++++-
tests/run.sh | 2 ++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/tests/functions.sh b/tests/functions.sh
index ab607c4ce..0605a1320 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -85,7 +85,13 @@ function ts_check_test_command {
*)
# just command names (e.g. --use-system-commands)
local cmd=$1
- type "$cmd" >/dev/null 2>&1 || ts_skip "missing in PATH: $cmd"
+ type "$cmd" >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ if [ "$TS_NOSKIP_COMMANDS" = "yes" ]; then
+ ts_failed "missing in PATH: $cmd"
+ fi
+ ts_skip "missing in PATH: $cmd"
+ fi
;;
esac
}
@@ -301,6 +307,7 @@ function ts_init_env {
ts_init_core_env
+ TS_NOSKIP_COMMANDS=$(ts_has_option "noskip-commands" "$*")
TS_VERBOSE=$(ts_has_option "verbose" "$*")
TS_SHOWDIFF=$(ts_has_option "show-diff" "$*")
TS_PARALLEL=$(ts_has_option "parallel" "$*")
diff --git a/tests/run.sh b/tests/run.sh
index 28f8ee25a..e8328cc5d 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -65,6 +65,7 @@ while [ -n "$1" ]; do
--show-diff |\
--verbose |\
--skip-loopdevs |\
+ --noskip-commands |\
--parsable)
# these options are simply forwarded to the test scripts
OPTS="$OPTS $1"
@@ -113,6 +114,7 @@ while [ -n "$1" ]; do
echo " --show-diff show diff from failed tests"
echo " --nonroot ignore test suite if user is root"
echo " --use-system-commands use PATH rather than builddir"
+ echo " --noskip-commands fail on missing commands"
echo " --srcdir=<path> autotools top source directory"
echo " --builddir=<path> autotools top build directory"
echo " --parallel=<num> number of parallel test jobs, default: num cpus"
--
2.20.1

View File

@ -0,0 +1,83 @@
From 68ab6d9691e667f89f72bc7eb39a5300b2f6cbaf Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 5 Mar 2019 13:56:45 +0100
Subject: [PATCH] tests: add missing program checks
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1681062
Signed-off-by: Karel Zak <kzak@redhat.com>
---
tests/ts/cal/bigyear | 2 +-
tests/ts/cal/month | 2 +-
tests/ts/cal/sep1752 | 2 +-
tests/ts/misc/mbsencode | 2 ++
tests/ts/misc/strtosize | 2 ++
5 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/tests/ts/cal/bigyear b/tests/ts/cal/bigyear
index d205c3afd..34139fd27 100755
--- a/tests/ts/cal/bigyear
+++ b/tests/ts/cal/bigyear
@@ -18,7 +18,7 @@ TS_DESC="Year 2147483646"
. $TS_TOPDIR/functions.sh
ts_init "$*"
-ts_check_test_command "$TS_CMD_CAL"
+ts_check_test_command "$TS_HELPER_CAL"
export TERM=linux
diff --git a/tests/ts/cal/month b/tests/ts/cal/month
index 9794e90c0..37996acae 100755
--- a/tests/ts/cal/month
+++ b/tests/ts/cal/month
@@ -22,7 +22,7 @@ TS_DESC="month"
. $TS_TOPDIR/functions.sh
ts_init "$*"
-ts_check_test_command "$TS_CMD_CAL"
+ts_check_test_command "$TS_HELPER_CAL"
export TERM=linux
diff --git a/tests/ts/cal/sep1752 b/tests/ts/cal/sep1752
index 3128261cd..41c30d40e 100755
--- a/tests/ts/cal/sep1752
+++ b/tests/ts/cal/sep1752
@@ -18,7 +18,7 @@ TS_DESC="September 1752"
. $TS_TOPDIR/functions.sh
ts_init "$*"
-ts_check_test_command "$TS_CMD_CAL"
+ts_check_test_command "$TS_HELPER_CAL"
export TERM=linux
diff --git a/tests/ts/misc/mbsencode b/tests/ts/misc/mbsencode
index 405d34c56..139148259 100755
--- a/tests/ts/misc/mbsencode
+++ b/tests/ts/misc/mbsencode
@@ -22,6 +22,8 @@ TS_DESC="mbsencode"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_HELPER_MBSENCODE"
+
# These test may fail on some machines (locales, other libc...)
TS_KNOWN_FAIL="yes"
diff --git a/tests/ts/misc/strtosize b/tests/ts/misc/strtosize
index 68b3b8bab..a5914a939 100755
--- a/tests/ts/misc/strtosize
+++ b/tests/ts/misc/strtosize
@@ -21,6 +21,8 @@ TS_DESC="strtosize"
. $TS_TOPDIR/functions.sh
ts_init "$*"
+ts_check_test_command "$TS_HELPER_STRUTILS"
+
$TS_HELPER_STRUTILS --size -1 >> $TS_OUTPUT 2>&1
$TS_HELPER_STRUTILS --size 0 >> $TS_OUTPUT 2>&1
$TS_HELPER_STRUTILS --size 1 >> $TS_OUTPUT 2>&1
--
2.20.1

View File

@ -0,0 +1,42 @@
From 0c57e5fedce0e627debda3258e2203842b427572 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 11 Dec 2018 11:44:48 +0100
Subject: [PATCH] tests: check for tar and {b,g}zip
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1681062
Upstream: http://github.com/karelzak/util-linux/commit/9e07672bb9989c88f6a7d8b8ab23158701fb4eec
Signed-off-by: Karel Zak <kzak@redhat.com>
---
tests/ts/lscpu/lscpu | 2 ++
tests/ts/lsmem/lsmem | 2 ++
2 files changed, 4 insertions(+)
diff --git a/tests/ts/lscpu/lscpu b/tests/ts/lscpu/lscpu
index 70fbce9f3..ccf271149 100755
--- a/tests/ts/lscpu/lscpu
+++ b/tests/ts/lscpu/lscpu
@@ -22,6 +22,8 @@ TS_TOPDIR="${0%/*}/../.."
ts_init "$*"
+ts_check_prog "tar"
+ts_check_prog "gzip"
ts_check_test_command "$TS_CMD_LSCPU"
for dump in $(ls $TS_SELF/dumps/*.tar.gz | sort); do
diff --git a/tests/ts/lsmem/lsmem b/tests/ts/lsmem/lsmem
index f1a643f85..bedf4143f 100755
--- a/tests/ts/lsmem/lsmem
+++ b/tests/ts/lsmem/lsmem
@@ -21,6 +21,8 @@ TS_TOPDIR="${0%/*}/../.."
ts_init "$*"
ts_check_test_command "$TS_CMD_LSMEM"
+ts_check_prog "tar"
+ts_check_prog "bzip2"
LSCOLUMNS="RANGE,SIZE,STATE,REMOVABLE,BLOCK,NODE"
--
2.20.1

View File

@ -0,0 +1,93 @@
From 8822103e30121d95fa58b5e8b7ce8ce91d4e778e Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 3 Jun 2019 22:29:51 +0200
Subject: [PATCH] tests: make mount -oloop use more robust
The command creates loop device, so udevd is in the game and it seems
better to wait for him.
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1681062
Signed-off-by: Karel Zak <kzak@redhat.com>
---
tests/ts/libmount/loop | 4 ++++
tests/ts/libmount/loop-overlay | 11 +++++++++++
2 files changed, 15 insertions(+)
diff --git a/tests/ts/libmount/loop b/tests/ts/libmount/loop
index 090b79fa4..50764781c 100755
--- a/tests/ts/libmount/loop
+++ b/tests/ts/libmount/loop
@@ -65,6 +65,7 @@ ts_finalize_subtest
ts_init_subtest "file-o-loop"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
$TS_CMD_MOUNT -oloop "$BACKFILE" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>&1
+udevadm settle
$TS_CMD_UMOUNT "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>&1
udevadm settle
ts_log "Success"
@@ -89,6 +90,7 @@ else
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
LODEV=$( $TS_CMD_LOSETUP --find 2>> $TS_OUTPUT )
$TS_CMD_MOUNT -oloop=$LODEV "$BACKFILE" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>&1
+ udevadm settle
verify_mount_dev "$LODEV" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>&1
$TS_CMD_UMOUNT "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>&1
udevadm settle
@@ -122,6 +124,7 @@ ts_init_subtest "o-loop-val-initialized"
LODEV=$( $TS_CMD_LOSETUP --show -f "$BACKFILE" 2>>$TS_OUTPUT)
$TS_CMD_MOUNT -oloop=$LODEV "$BACKFILE" "$TS_MOUNTPOINT" 2>&1 \
| sed 's/:.*:/: <target>/; s/for .*/for <source>/' > $TS_OUTPUT
+udevadm settle
$TS_CMD_LOSETUP --detach $LODEV >> $TS_OUTPUT 2>&1
udevadm settle
ts_log "Success"
@@ -133,6 +136,7 @@ cp "$BACKFILE" "$BACKFILE"-2
LODEV=$( $TS_CMD_LOSETUP --show -f "$BACKFILE"-2 2>> $TS_OUTPUT)
$TS_CMD_MOUNT -oloop=$LODEV "$BACKFILE" "$TS_MOUNTPOINT" 2>&1 \
| sed 's/:.*:/: <target>/; s/for .*/for <source>/' > $TS_OUTPUT
+udevadm settle
$TS_CMD_LOSETUP --detach $LODEV >> $TS_OUTPUT 2>&1
rm "$BACKFILE"-2
udevadm settle
diff --git a/tests/ts/libmount/loop-overlay b/tests/ts/libmount/loop-overlay
index fffb823c0..1ba6eb06e 100755
--- a/tests/ts/libmount/loop-overlay
+++ b/tests/ts/libmount/loop-overlay
@@ -43,23 +43,34 @@ dd if="$IMG" of="$IMG" oflag=append bs=1024k count=5 conv=notrunc &>/dev/null
echo "second should fail" >>$TS_OUTPUT
$TS_CMD_MOUNT -oloop "$IMG" "$TS_MOUNTPOINT-1" >> $TS_OUTPUT 2>&1
+udevadm settle
$TS_CMD_MOUNT -oloop,offset=$OFFSET "$IMG" "$TS_MOUNTPOINT-2" 2>&1 \
| sed 's/:.*:/: <target>/; s/for .*/for <source>/' >> $TS_OUTPUT
+udevadm settle
$TS_CMD_UMOUNT "$TS_MOUNTPOINT-1" >> $TS_OUTPUT 2>&1
+udevadm settle
echo "should succeed" >>$TS_OUTPUT
$TS_CMD_MOUNT -oloop,sizelimit=$OFFSET "$IMG" "$TS_MOUNTPOINT-1" >> $TS_OUTPUT 2>&1
+udevadm settle
$TS_CMD_MOUNT -oloop,offset=$OFFSET "$IMG" "$TS_MOUNTPOINT-2" >> $TS_OUTPUT 2>&1
+udevadm settle
$TS_CMD_UMOUNT "$TS_MOUNTPOINT-1" >> $TS_OUTPUT 2>&1
+udevadm settle
$TS_CMD_UMOUNT "$TS_MOUNTPOINT-2" >> $TS_OUTPUT 2>&1
+udevadm settle
echo "both should fail" >>$TS_OUTPUT
LOOPDEV=$($TS_CMD_LOSETUP --show -f --offset 1 --sizelimit $OFFSET "$IMG")
+udevadm settle
$TS_CMD_MOUNT -oloop,sizelimit=$OFFSET "$IMG" "$TS_MOUNTPOINT-1" 2>&1 \
| sed 's/:.*:/: <target>/; s/for .*/for <source>/' >> $TS_OUTPUT
+udevadm settle
$TS_CMD_MOUNT -oloop,offset=$OFFSET "$IMG" "$TS_MOUNTPOINT-2" 2>&1 \
| sed 's/:.*:/: <target>/; s/for .*/for <source>/' >> $TS_OUTPUT
+udevadm settle
$TS_CMD_LOSETUP --detach $LOOPDEV
+udevadm settle
ts_log "Success"
ts_finalize
--
2.21.0

2
SOURCES/adjtime Normal file
View File

@ -0,0 +1,2 @@
0.0 0 0.0
0

View File

@ -0,0 +1,8 @@
#
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/usr/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/usr/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.

View File

@ -0,0 +1,6 @@
#%PAM-1.0
auth sufficient pam_rootok.so
auth include system-auth
account include system-auth
password include system-auth
session include system-auth

View File

@ -0,0 +1,17 @@
#%PAM-1.0
auth substack system-auth
auth include postlogin
account required pam_nologin.so
account include system-auth
password include system-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
session optional pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open
session required pam_namespace.so
session optional pam_keyinit.so force revoke
session include system-auth
session include postlogin
-session optional pam_ck_connector.so

View File

@ -0,0 +1,15 @@
#%PAM-1.0
auth substack password-auth
auth include postlogin
account required pam_nologin.so
account include password-auth
password include password-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open
session required pam_namespace.so
session optional pam_keyinit.so force revoke
session include password-auth
session include postlogin

View File

@ -0,0 +1,5 @@
#%PAM-1.0
auth include runuser
session optional pam_keyinit.so force revoke
-session optional pam_systemd.so
session include runuser

View File

@ -0,0 +1,5 @@
#%PAM-1.0
auth sufficient pam_rootok.so
session optional pam_keyinit.so revoke
session required pam_limits.so
session required pam_unix.so

View File

@ -0,0 +1,6 @@
#%PAM-1.0
auth include su
account include su
password include su
session optional pam_keyinit.so force revoke
session include su

View File

@ -0,0 +1,15 @@
#%PAM-1.0
auth required pam_env.so
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
#auth required pam_wheel.so use_uid
auth substack system-auth
auth include postlogin
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth
password include system-auth
session include system-auth
session include postlogin
session optional pam_xauth.so

3068
SPECS/util-linux.spec Normal file

File diff suppressed because it is too large Load Diff