* [PATCH] AUTHORS: update Zhenwei Pi email
From: zhenwei pi @ 2025-05-26 9:37 UTC (permalink / raw)
To: util-linux; +Cc: kzak, zhenwei pi
I will be leaving ByteDance so updating my email in AUTHORS to my
personal email.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
AUTHORS | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index ad9ae703b..df9a88567 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -15,7 +15,7 @@ PAST MAINTAINERS:
AUTHORS (merged projects & commands):
blkdiscard: Lukas Czerner <lczerner@redhat.com>
- blkpr: zhenwei pi <pizhenwei@bytedance.com>
+ blkpr: zhenwei pi <zhenwei.pi@linux.dev>
blkzone: Shaun Tancheff <shaun@tancheff.com>
Damien Le Moal <damien.lemoal@wdc.com>
enosys: Thomas Weißschuh <thomas@t-8ch.de>
@@ -33,7 +33,7 @@ AUTHORS (merged projects & commands):
hardlink: Jakub Jelinek <jakub@redhat.com>
hwclock: Bryan Henderson <bryanh@giraffe-data.com>
ipcmk: Hayden James <hayden.james@gmail.com>
- irqtop/lsirq: Zhenwei Pi <pizhenwei@bytedance.com>
+ irqtop/lsirq: Zhenwei Pi <zhenwei.pi@linux.dev>
Sami Kerola <kerolasa@iki.fi>
last/lastb: [merged from sysvinit]
Miquel van Smoorenburg <miquels@cistron.nl>
--
2.43.0
^ permalink raw reply related
* [PATCH 3/4] hardlink: (usage) improve the descriptions of three options
From: Benno Schulenberg @ 2025-05-23 12:04 UTC (permalink / raw)
To: util-linux
In-Reply-To: <20250523120407.75188-1-bensberg@telfort.nl>
The first description was too wordy for a --help text, the second
was vague and seemed to imply that it should be combined with the
preceding option, and the third failed to mention that it doesn't
actually link anything.
(Note: the choice for -m for --maximize and -M for --minimize is
unfortunate, as most people would guess the opposite, especially
since -s is used for --minimum-size and -S for --maximum-size.)
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
---
misc-utils/hardlink.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/misc-utils/hardlink.c b/misc-utils/hardlink.c
index 7f2ff8046..5365e5370 100644
--- a/misc-utils/hardlink.c
+++ b/misc-utils/hardlink.c
@@ -1195,11 +1195,10 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" -d, --respect-dir directory names have to be identical\n"), out);
fputs(_(" -f, --respect-name filenames have to be identical\n"), out);
fputs(_(" -i, --include <regex> regular expression to include files/dirs\n"), out);
- fputs(_(" -m, --maximize maximize the hardlink count, remove the file with\n"
- " lowest hardlink count\n"), out);
- fputs(_(" -M, --minimize reverse the meaning of -m\n"), out);
+ fputs(_(" -m, --maximize keep the file with the most links\n"), out);
+ fputs(_(" -M, --minimize keep the file with the fewest links\n"), out);
fputs(_(" -n, --dry-run don't actually link anything\n"), out);
- fputs(_(" -l, --list-duplicates print every group of duplicate files\n"), out);
+ fputs(_(" -l, --list-duplicates just list paths of duplicates, don't link them\n"), out);
fputs(_(" -z, --zero delimit output with NULs instead of newlines\n"), out);
fputs(_(" -o, --ignore-owner ignore owner changes\n"), out);
fputs(_(" -F, --prioritize-trees files found in the earliest specified top-level\n"
--
2.48.1
^ permalink raw reply related
* [PATCH 1/4] hexdump: (man) put a list item on a single line, to avoid a warning
From: Benno Schulenberg @ 2025-05-23 12:04 UTC (permalink / raw)
To: util-linux
Asciidoctor annoyingly warned for every translation that
unindented content was added to a list item. Avoid this
by not breaking the list item into two lines.
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
---
text-utils/hexdump.1.adoc | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/text-utils/hexdump.1.adoc b/text-utils/hexdump.1.adoc
index c92733a51..33f889258 100644
--- a/text-utils/hexdump.1.adoc
+++ b/text-utils/hexdump.1.adoc
@@ -118,8 +118,7 @@ The format is required and must be surrounded by double quote (" ") marks. It is
. An asterisk (*) may not be used as a field width or precision.
-. A byte count or field precision _is_ required for each *s* conversion character
-(unlike the *fprintf*(3) default which prints the entire string if the precision is unspecified).
+. A byte count or field precision _is_ required for each *s* conversion character (unlike the *fprintf*(3) default which prints the entire string if the precision is unspecified).
. The conversion characters *h*, *l*, *n*, *p*, and *q* are not supported.
--
2.48.1
^ permalink raw reply related
* [PATCH 4/4] hardlink: (man,usage) sort the options mostly alphabetically
From: Benno Schulenberg @ 2025-05-23 12:04 UTC (permalink / raw)
To: util-linux
In-Reply-To: <20250523120407.75188-1-bensberg@telfort.nl>
Also, improve some markup and wording and grammar.
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
---
misc-utils/hardlink.1.adoc | 55 +++++++++++++++++++-------------------
misc-utils/hardlink.c | 22 +++++++--------
2 files changed, 39 insertions(+), 38 deletions(-)
diff --git a/misc-utils/hardlink.1.adoc b/misc-utils/hardlink.1.adoc
index e09572f6c..5788014d2 100644
--- a/misc-utils/hardlink.1.adoc
+++ b/misc-utils/hardlink.1.adoc
@@ -65,21 +65,21 @@ For example, *hardlink foo/ bar/* will link files in bar/ to equal files in the
*-i*, *--include* _regex_::
A regular expression to include files. If the option *--exclude* has been given, this option re-includes files which would otherwise be excluded. If the option is used without *--exclude*, only files matched by the pattern are included.
+*-l*, *--list-duplicates*::
+Don't link anything, but list the absolute path of every duplicate file, one per line, preceded by a unique 16-byte discriminator and a tab.
+
*-m*, *--maximize*::
Among equal files, keep the file with the highest link count.
*-M*, *--minimize*::
Among equal files, keep the file with the lowest link count.
+*--mount*::
+Do not traverse directories on different filesystems (remain within the same filesystem).
+
*-n*, *--dry-run*::
Do not act, just print what would happen.
-*-l*, *--list-duplicates*::
-Don't link anything, but list the absolute path of every duplicate file, one per line, preceded by a unique 16-byte discriminator and a tab.
-
-*-z*, *--zero*::
-Separate lines with a NUL instead of a newline in *-l* mode.
-
*-o*, *--ignore-owner*::
Link and compare files even if their owner information (user and group) differs. Results may be unpredictable.
@@ -98,6 +98,22 @@ file content block (see *--io-size*), these checksums are cached for the next co
size is important for large files or a large sets of files of the same size. The default is
10MiB.
+*--reflink*[**=**_when_]::
+Create copy-on-write clones (aka reflinks) rather than hardlinks. The reflinked files
+share only on-disk data, but the file mode and owner can be different. It's recommended
+to use this option together with the *--ignore-owner* and *--ignore-mode* options.
+This option implies *--skip-reflinks* to ignore already cloned files.
++
+The optional argument _when_ can be *never*, *always*, or *auto*. If the _when_ argument
+is omitted, it defaults to *auto*, which means that *hardlink* checks the filesystem type
+and uses reflinks on BTRFS and XFS only, and falls back to hardlinks when creating a
+reflink is impossible.
+The argument *always* disables filesystem-type detection and the fallback to hardlinks,
+which means that only reflinks are allowed.
+
+*--skip-reflinks*::
+Ignore already cloned files. This option may be used without *--reflink* when creating classic hardlinks.
+
*-s*, *--minimum-size* _size_::
The minimum size to consider. By default this is 1, so empty files will not be linked. The _size_ argument may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same meaning as "KiB").
@@ -116,33 +132,18 @@ A regular expression that excludes files from being compared and linked. This op
*--exclude-subtree* _regex_::
A regular expression that excludes entire directories from being compared and linked. This option can also be used multiple times.
-*--mount*::
-Do not traverse directories on different filesystems (remain within the same filesystem).
-
*-X*, *--respect-xattrs*::
Only try to link files with the same extended attributes.
*-y*, *--method* _name_::
Set the file content comparison method. The currently supported methods are
-sha256, sha1, crc32c and memcmp. The default is sha256, or memcmp if Linux
-Crypto API is not available. The methods based on checksums are implemented in
-zero-copy way, in this case file contents are not copied to the userspace and all
-calculation is done in kernel.
+*sha256*, *sha1*, *crc32c*, and *memcmp*. The default is *sha256*, or *memcmp* if the
+Linux Crypto API is not available. The methods based on checksums are implemented in
+a zero-copy way, which means that file contents are not copied to userspace and all
+calculation is done in the kernel.
-*--reflink*[**=**_when_]::
-Create copy-on-write clones (aka reflinks) rather than hardlinks. The reflinked files
-share only on-disk data, but the file mode and owner can be different. It's recommended
-to use it with *--ignore-owner* and *--ignore-mode* options. This option implies
-*--skip-reflinks* to ignore already cloned files.
-+
-The optional argument _when_ can be *never*, *always*, or *auto*. If the _when_ argument
-is omitted, it defaults to *auto*, in this case, *hardlink* checks filesystem type and
-uses reflinks on BTRFS and XFS only, and fallback to hardlinks when creating reflink is impossible.
-The argument *always* disables filesystem type detection and fallback to hardlinks, in this case,
-only reflinks are allowed.
-
-*--skip-reflinks*::
-Ignore already cloned files. This option may be used without *--reflink* when creating classic hardlinks.
+*-z*, *--zero*::
+Separate lines with a NUL byte instead of a newline (for *-l*).
include::man-common/help-version.adoc[]
diff --git a/misc-utils/hardlink.c b/misc-utils/hardlink.c
index 5365e5370..cd28fe018 100644
--- a/misc-utils/hardlink.c
+++ b/misc-utils/hardlink.c
@@ -1191,24 +1191,28 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(USAGE_OPTIONS, out);
fputs(_(" -c, --content compare only file contents, same as -pot\n"), out);
fputs(_(" -b, --io-size <size> I/O buffer size for file reading\n"
- " (speedup, using more RAM)\n"), out);
+ " (speedup, using more RAM)\n"), out);
fputs(_(" -d, --respect-dir directory names have to be identical\n"), out);
fputs(_(" -f, --respect-name filenames have to be identical\n"), out);
+ fputs(_(" -F, --prioritize-trees files found in the earliest specified top-level\n"
+ " directory have higher priority (but this has\n"
+ " lower precedence than --maximize/--minimize)\n"), out);
fputs(_(" -i, --include <regex> regular expression to include files/dirs\n"), out);
+ fputs(_(" -l, --list-duplicates just list paths of duplicates, don't link them\n"), out);
fputs(_(" -m, --maximize keep the file with the most links\n"), out);
fputs(_(" -M, --minimize keep the file with the fewest links\n"), out);
+ fputs(_(" --mount stay within the same filesystem\n"), out);
fputs(_(" -n, --dry-run don't actually link anything\n"), out);
- fputs(_(" -l, --list-duplicates just list paths of duplicates, don't link them\n"), out);
- fputs(_(" -z, --zero delimit output with NULs instead of newlines\n"), out);
fputs(_(" -o, --ignore-owner ignore owner changes\n"), out);
- fputs(_(" -F, --prioritize-trees files found in the earliest specified top-level\n"
- " directory have higher priority (lower precedence\n"
- " than minimize/maximize)\n"), out);
fputs(_(" -O, --keep-oldest keep the oldest file of multiple equal files\n"
" (lower precedence than minimize/maximize)\n"), out);
fputs(_(" -p, --ignore-mode ignore changes of file mode\n"), out);
fputs(_(" -q, --quiet quiet mode - don't print anything\n"), out);
fputs(_(" -r, --cache-size <size> memory limit for cached file content data\n"), out);
+#ifdef USE_REFLINK
+ fputs(_(" --reflink[=<when>] create clone/CoW copies (auto, always, never)\n"), out);
+ fputs(_(" --skip-reflinks skip already cloned files (enabled on --reflink)\n"), out);
+#endif
fputs(_(" -s, --minimum-size <size> minimum size for files\n"), out);
fputs(_(" -S, --maximum-size <size> maximum size for files\n"), out);
fputs(_(" -t, --ignore-time ignore timestamps (when testing for equality)\n"), out);
@@ -1217,16 +1221,12 @@ static void __attribute__((__noreturn__)) usage(void)
#ifdef USE_SKIP_SUBTREE
fputs(_(" --exclude-subtree <regex> regular expression to exclude directories\n"), out);
#endif
- fputs(_(" --mount stay within the same filesystem\n"), out);
#ifdef USE_XATTR
fputs(_(" -X, --respect-xattrs respect extended attributes\n"), out);
#endif
fputs(_(" -y, --method <name> file content comparison method\n"), out);
+ fputs(_(" -z, --zero delimit output with NULs instead of newlines\n"), out);
-#ifdef USE_REFLINK
- fputs(_(" --reflink[=<when>] create clone/CoW copies (auto, always, never)\n"), out);
- fputs(_(" --skip-reflinks skip already cloned files (enabled on --reflink)\n"), out);
-#endif
fputs(USAGE_SEPARATOR, out);
fprintf(out, USAGE_HELP_OPTIONS(28));
fprintf(out, USAGE_MAN_TAIL("hardlink(1)"));
--
2.48.1
^ permalink raw reply related
* [PATCH 2/4] hardlink: (usage) remove mistaken period from two option descriptions
From: Benno Schulenberg @ 2025-05-23 12:04 UTC (permalink / raw)
To: util-linux
In-Reply-To: <20250523120407.75188-1-bensberg@telfort.nl>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
---
misc-utils/hardlink.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/misc-utils/hardlink.c b/misc-utils/hardlink.c
index 85d25ca22..7f2ff8046 100644
--- a/misc-utils/hardlink.c
+++ b/misc-utils/hardlink.c
@@ -1210,8 +1210,8 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" -p, --ignore-mode ignore changes of file mode\n"), out);
fputs(_(" -q, --quiet quiet mode - don't print anything\n"), out);
fputs(_(" -r, --cache-size <size> memory limit for cached file content data\n"), out);
- fputs(_(" -s, --minimum-size <size> minimum size for files.\n"), out);
- fputs(_(" -S, --maximum-size <size> maximum size for files.\n"), out);
+ fputs(_(" -s, --minimum-size <size> minimum size for files\n"), out);
+ fputs(_(" -S, --maximum-size <size> maximum size for files\n"), out);
fputs(_(" -t, --ignore-time ignore timestamps (when testing for equality)\n"), out);
fputs(_(" -v, --verbose verbose output (repeat for more verbosity)\n"), out);
fputs(_(" -x, --exclude <regex> regular expression to exclude files\n"), out);
--
2.48.1
^ permalink raw reply related
* Re: [PATCH] libblkid: Fix crash while parsing config with libeconf
From: Karel Zak @ 2025-05-21 7:58 UTC (permalink / raw)
To: Stanislav Brabec; +Cc: util-linux, Stefan Schubert
In-Reply-To: <3p3ennukohxmst4qpalg6t43udyyyijwj6ddbmrpb72yeehxw4@qvj3bdyj3h7h>
On Wed, May 21, 2025 at 08:55:37AM +0200, Karel Zak wrote:
> On Tue, May 20, 2025 at 04:24:07PM +0200, Stanislav Brabec wrote:
> > Stanislav Brabec wrote:
> > > As the whhole econf_file structure is freed by econf_free(file) at the end
> >
> > > of blkid_read_config, econf_file structure cannot be defined as static and
> > > initialized only once. The econf_free() is not robust enough and keeps a
> > > pointer to the garbage after the first call. And if /etc/blkid.conf does
> > > not exist, it is called second time.
> >
> > However the patch is correct and fixes the crash, there are still open questions:
> >
> > - Why blkid_read_config() and econf_readConfig() are called twice with the same parameters? Is it intended behavior?
>
> This code pattern (e.g., libblkid/src/evaluate.c):
>
> conf = blkid_read_config(NULL);
> ...
>
> cachefile = blkid_get_cache_filename(conf);
> rc = blkid_get_cache(&c, cachefile);
>
> If blkid_get_cache_filename() returns NULL, then blkid_get_cache()
> reads the configuration again. Additionally, blkid_get_cache_filename() can read the
> configuration if 'conf' is NULL.
>
> Yes, it's not elegant.
Added to TODO:
https://github.com/util-linux/util-linux/issues/3580
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH] libblkid: Fix crash while parsing config with libeconf
From: Karel Zak @ 2025-05-21 6:55 UTC (permalink / raw)
To: Stanislav Brabec; +Cc: util-linux, Stefan Schubert
In-Reply-To: <da40323d-e642-4535-9a9a-ce9054de0241@suse.cz>
On Tue, May 20, 2025 at 04:24:07PM +0200, Stanislav Brabec wrote:
> Stanislav Brabec wrote:
> > As the whhole econf_file structure is freed by econf_free(file) at the end
>
> > of blkid_read_config, econf_file structure cannot be defined as static and
> > initialized only once. The econf_free() is not robust enough and keeps a
> > pointer to the garbage after the first call. And if /etc/blkid.conf does
> > not exist, it is called second time.
>
> However the patch is correct and fixes the crash, there are still open questions:
>
> - Why blkid_read_config() and econf_readConfig() are called twice with the same parameters? Is it intended behavior?
This code pattern (e.g., libblkid/src/evaluate.c):
conf = blkid_read_config(NULL);
...
cachefile = blkid_get_cache_filename(conf);
rc = blkid_get_cache(&c, cachefile);
If blkid_get_cache_filename() returns NULL, then blkid_get_cache()
reads the configuration again. Additionally, blkid_get_cache_filename() can read the
configuration if 'conf' is NULL.
Yes, it's not elegant.
> - And finally, is a similar code in logindefs.c vulnerable to a similar type of crash?
The `logindefs` uses a global `list` variable, which should be filled only once.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH] libblkid: Fix crash while parsing config with libeconf
From: Stanislav Brabec @ 2025-05-20 14:24 UTC (permalink / raw)
To: util-linux; +Cc: Stefan Schubert
In-Reply-To: <20250516013111.1099053-1-sbrabec@suse.cz>
Stanislav Brabec wrote:
>As the whhole econf_file structure is freed by econf_free(file) at the end
> of blkid_read_config, econf_file structure cannot be defined as static and
> initialized only once. The econf_free() is not robust enough and keeps a
> pointer to the garbage after the first call. And if /etc/blkid.conf does
> not exist, it is called second time.
However the patch is correct and fixes the crash, there are still open questions:
- Why blkid_read_config() and econf_readConfig() are called twice with the same parameters? Is it intended behavior?
- If yes, why we don't recycle the configuration and call econf_free()?
- If not, why it happens?
- And finally, is a similar code in logindefs.c vulnerable to a similar type of crash?
--
Best Regards / S pozdravem,
Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o. e-mail: sbrabec@suse.com
Křižíkova 148/34 (Corso IIa) tel: +420 284 084 060
186 00 Praha 8-Karlín fax: +420 284 084 001
Czech Republic http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76
^ permalink raw reply
* Re: [PATCH] libblkid: Fix crash while parsing config with libeconf
From: Stanislav Brabec @ 2025-05-16 7:53 UTC (permalink / raw)
To: util-linux; +Cc: Stefan Schubert
In-Reply-To: <20250516013111.1099053-1-sbrabec@suse.cz>
I forgot to mention:
https://bugzilla.opensuse.org/show_bug.cgi?id=1242705
with a full reproducer and backtrace
^ permalink raw reply
* [PATCH] libblkid: Fix crash while parsing config with libeconf
From: Stanislav Brabec @ 2025-05-16 1:31 UTC (permalink / raw)
To: util-linux; +Cc: Stanislav Brabec, Stefan Schubert
As the whhole econf_file structure is freed by econf_free(file) at the end
of blkid_read_config, econf_file structure cannot be defined as static and
initialized only once. The econf_free() is not robust enough and keeps a
pointer to the garbage after the first call. And if /etc/blkid.conf does
not exist, it is called second time.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Stefan Schubert <schubi@suse.de>
---
libblkid/src/config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libblkid/src/config.c b/libblkid/src/config.c
index 934d28d65..39024b42e 100644
--- a/libblkid/src/config.c
+++ b/libblkid/src/config.c
@@ -154,7 +154,7 @@ struct blkid_config *blkid_read_config(const char *filename)
#else /* !HAVE_LIBECONF */
- static econf_file *file = NULL;
+ econf_file *file = NULL;
char *line = NULL;
bool uevent = false;
econf_err error;
--
2.48.1
^ permalink raw reply related
* mount -a inconsistency: mapper vs block device.
From: Anand Jain @ 2025-05-15 8:16 UTC (permalink / raw)
To: util-linux; +Cc: Btrfs BTRFS, asj
Here is a simple test case that reproduces a scenario where mount -a
gets confused when an LVM non-mapper device path is used.
When the mapper path is used, verbose output reports "already mounted",
but when the actual device path is used, it reports "successfully
mounted". Since the mapper path is just a symlink to the actual dm
device, shouldn't mount -a resolve them to the same major:minor and
behave consistently?
util-linux 2.40.2 (libmount 2.40.2)
$ file /dev/dm-0
/dev/dm-0: block special (252/0)
$ file /dev/mapper/vg_fstests-lv1
/dev/mapper/vg_fstests-lv1: symbolic link to ../dm-0
------------
Create a Btrfs filesystem using an LVM device and a block device in the
same order (or using two LVM devices). We need two devices; otherwise,
the kernel doesn't go through the volume assembly path in memory.
$ mkfs.btrfs -fq /dev/dm-0 /dev/sdb > /dev/null
Udev creates the by-uuid symlink using the mapper path.
$ blkid --uuid 6e80077f-0e0d-49a6-bcb5-a9aebd4fd113
/dev/mapper/vg_fstests-lv1
mount also follows the mapper symlink.
$ mount --verbose /dev/dm-0 /mnt/scratch
mount: /dev/mapper/vg_fstests-lv1 mounted on /mnt/scratch.
However, since mkfs.btrfs used the actual device dm-0, and the mapper is
just a symlink to it, the path won't change. (I will fix mkfs.btrfs to
use the mapper path, but that will hide the subtle mount -a issue.)
$ cat /proc/self/mounts | grep scratch
/dev/dm-0 /mnt/scratch btrfs
rw,relatime,space_cache=v2,subvolid=5,subvol=/ 0 0
$ echo UUID=c48751d4-0b34-4480-a51b-2877474c17b7 /mnt/scratch btrfs
defaults 0 0 >> /etc/fstab
$ udevadm settle
$ mount --verbose -a
/ : ignored
/boot : already mounted
/boot/efi : already mounted
/mnt/scratch : successfully mounted <---
$ echo $?
0
------------
Now use the device-mapper path, mount -a --verbose appears to
be correct.
------------
$ mkfs.btrfs -fq /dev/mapper/vg_fstests-lv1 /dev/sdb > /dev/null
$ blkid --uuid 3e6036f0-0187-487d-962f-9573b68e9468
/dev/mapper/vg_fstests-lv1
$ mount --verbose /dev/mapper/vg_fstests-lv1 /mnt/scratch
mount: /dev/mapper/vg_fstests-lv1 mounted on /mnt/scratch.
$ cat /proc/self/mounts | grep scratch
/dev/mapper/vg_fstests-lv1 /mnt/scratch btrfs
rw,relatime,space_cache=v2,subvolid=5,subvol=/ 0 0
$ echo UUID=3e6036f0-0187-487d-962f-9573b68e9468 /mnt/scratch btrfs
defaults 0 0 >> /etc/fstab
$ udevadm settle
$ mount --verbose -a
/ : ignored
/boot : already mounted
/boot/efi : already mounted
/mnt/scratch : already mounted <--
$ echo $?
0
------------
When the mapper path is used, mount recognizes it as already mounted.
But when the block device path is used, it doesn't recognize that
it's already mounted.
Also, in the older mount version 2.37.4, mount -a fails. Any idea which
patch or patchset fixed this?
---------
mount from util-linux 2.37.4 (libmount 2.37.4:
$ mount --verbose -a :32
/ : ignored
/boot : already mounted
/boot/efi : already mounted
/Volumes/work : already mounted
STDERR:
mount: /mnt/scratch: /dev/mapper/vg_fstests-lv1 already mounted or mount
point busy.
--------
Thanks, Anand
^ permalink raw reply
* Re: util-linux-2.41 breaks static build of btrfs-progs
From: Karel Zak @ 2025-05-13 9:41 UTC (permalink / raw)
To: Stanislav Brabec; +Cc: util-linux
In-Reply-To: <ddfd6167-e88f-4505-8768-a9d8e1d5cc92@suse.cz>
On Sun, Apr 20, 2025 at 09:24:43PM +0200, Stanislav Brabec wrote:
> The question is:
> Should be this fixed by util-linux by prefixing of ul_ to all symbols that
> are not declared as static?
I have added the "ul_" prefix to some functions to make the names less
generic: https://github.com/util-linux/util-linux/pull/3569
I'm going to backport it to stable/v2.41 too.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH 1/2] irqtop: use standard 'always/never' arguments instead of 'enable/disable'
From: Karel Zak @ 2025-05-05 13:23 UTC (permalink / raw)
To: Benno Schulenberg; +Cc: util-linux, Zhenwei Pi
In-Reply-To: <20250502122242.72961-1-bensberg@telfort.nl>
On Fri, May 02, 2025 at 02:22:41PM +0200, Benno Schulenberg wrote:
> bash-completion/irqtop | 2 +-
> sys-utils/irqtop.1.adoc | 6 ++++--
> sys-utils/irqtop.c | 11 +++++------
> 3 files changed, 10 insertions(+), 9 deletions(-)
Both patches have been applied. Thank you.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH] bits: only build when cpu_set_t is available
From: Karel Zak @ 2025-05-05 13:22 UTC (permalink / raw)
To: Alyssa Ross; +Cc: util-linux
In-Reply-To: <20250501075806.88759-1-hi@alyssa.is>
On Thu, May 01, 2025 at 09:58:06AM +0200, Alyssa Ross wrote:
> configure.ac | 6 +++++-
> meson.build | 2 +-
> 2 files changed, 6 insertions(+), 2 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: util-linux-2.41 breaks static build of btrfs-progs
From: Karel Zak @ 2025-05-05 9:50 UTC (permalink / raw)
To: Stanislav Brabec; +Cc: util-linux
In-Reply-To: <vy5gwsr6al5wl7nlksaq6orzkhhp4tog7gxtsjchl76ess5rtc@tmkazaywmvgv>
On Mon, May 05, 2025 at 11:34:11AM +0200, Karel Zak wrote:
> On Sun, Apr 20, 2025 at 09:24:43PM +0200, Stanislav Brabec wrote:
> > Static build of btrfs-progs fails with util-linux-2.41 with a simple
> > problem:
> > Symbol parse_range becomes visible in libblkid.a, breaking parse-utils.c in
> > btrfs-progs, using the same symbol.
> >
> > The question is:
> > Should be this fixed by util-linux by prefixing of ul_ to all symbols that
> > are not declared as static?
>
> I think the ul_ prefix should be used for all generic names like
> parse_range(). I'm not sure if I want to use it strictly for all
> functions, as the set of functions is large and such conflicts are
> very rare.
>
> ChatGPT has an interesting suggestion: add the prefix to the .a
> library using "objcopy --redefine-syms" for all non-API and non-static
> functions.
>
> #!/bin/bash
> PREFIX=foo_
>
> # Extract all global (non-static) function symbols from the .a file
> nm -g --defined-only libmylib.a | awk '{print $3}' | grep -v "^$PREFIX" | sort -u > tmp.syms
Note that the list of symbols should also be filtered according to
libblkid.sym to keep the API functions unmodified.
> # Generate rename list: <old> <new>
> awk -v pfx="$PREFIX" '{print $1 " " pfx $1}' tmp.syms > rename.syms
>
> # Apply symbol renaming
> objcopy --redefine-syms=rename.syms libmylib.a libmylib_prefixed.a
Updated, not tested version:
#!/bin/bash
set -e
LIB=libfoo.a
VERSION_SCRIPT=libfoo.sym
PREFIX=foo_
TMPDIR=$(mktemp -d)
RENAME_SYMS="$TMPDIR/rename.syms"
# 1. Get all defined global symbols in the .a (non-static functions/vars)
nm -g --defined-only "$LIB" | awk '{print $3}' | sort -u > "$TMPDIR/all_syms.txt"
# 2. Extract exported (API) symbols from the version script
awk '/global:/{flag=1; next} /local:/{flag=0} flag' "$VERSION_SCRIPT" | \
tr -d '; \t' | grep -v '^$' | sort -u > "$TMPDIR/exported_syms.txt"
# 3. Compute symbols to rename (non-exported global ones)
comm -23 "$TMPDIR/all_syms.txt" "$TMPDIR/exported_syms.txt" | \
awk -v pfx="$PREFIX" '{print $1 " " pfx $1}' > "$RENAME_SYMS"
# 4. Apply renaming to the archive
cp "$LIB" "${LIB%.a}_prefixed.a"
objcopy --redefine-syms="$RENAME_SYMS" "${LIB%.a}_prefixed.a"
echo "Renamed library created: ${LIB%.a}_prefixed.a"
echo "Renamed symbols:"
cat "$RENAME_SYMS"
# 5. Optional cleanup
# rm -r "$TMPDIR"
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: util-linux-2.41 breaks static build of btrfs-progs
From: Karel Zak @ 2025-05-05 9:34 UTC (permalink / raw)
To: Stanislav Brabec; +Cc: util-linux
In-Reply-To: <ddfd6167-e88f-4505-8768-a9d8e1d5cc92@suse.cz>
On Sun, Apr 20, 2025 at 09:24:43PM +0200, Stanislav Brabec wrote:
> Static build of btrfs-progs fails with util-linux-2.41 with a simple
> problem:
> Symbol parse_range becomes visible in libblkid.a, breaking parse-utils.c in
> btrfs-progs, using the same symbol.
>
> The question is:
> Should be this fixed by util-linux by prefixing of ul_ to all symbols that
> are not declared as static?
I think the ul_ prefix should be used for all generic names like
parse_range(). I'm not sure if I want to use it strictly for all
functions, as the set of functions is large and such conflicts are
very rare.
ChatGPT has an interesting suggestion: add the prefix to the .a
library using "objcopy --redefine-syms" for all non-API and non-static
functions.
#!/bin/bash
PREFIX=foo_
# Extract all global (non-static) function symbols from the .a file
nm -g --defined-only libmylib.a | awk '{print $3}' | grep -v "^$PREFIX" | sort -u > tmp.syms
# Generate rename list: <old> <new>
awk -v pfx="$PREFIX" '{print $1 " " pfx $1}' tmp.syms > rename.syms
# Apply symbol renaming
objcopy --redefine-syms=rename.syms libmylib.a libmylib_prefixed.a
Maybe it's elegant way to go. Not sure, not tested :-)
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH 2/2] strutils: move an error message to where it is used, and improve it
From: Karel Zak @ 2025-05-05 8:42 UTC (permalink / raw)
To: Benno Schulenberg; +Cc: util-linux
In-Reply-To: <20250502122242.72961-2-bensberg@telfort.nl>
On Fri, May 02, 2025 at 02:22:42PM +0200, Benno Schulenberg wrote:
> Calling gettext() is somewhat costly: it has to find the given message
> among the more than five thousand messages in util-linux's repertoire.
> So, call gettext() only when the message actually gets printed.
I like the change. The `gettext()` argument for options parsers is a
common issue, and there may be more areas where we can improve. The
general pattern is:
x = strtoxxx_or_err(optarg, _("invalid xxx argument"));
Perhaps we can use the command line option name as an argument and
compose the final error message within the strtoxxx_or_err()
functions.
x = strtoxxx_or_err(optarg, "xxx");
And in strtoxxx_or_err(const char *str, const char *optname):
errx(STRTOXX_EXIT_CODE, _("invalid %s argument: %s"), optname, str);
BTW, it's pretty common:
$ git grep '.*_or_err' | wc -l
399
so we can save a lot of gettext() calls and make the utils faster.
Volunteers? 😊
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* [PATCH 2/2] strutils: move an error message to where it is used, and improve it
From: Benno Schulenberg @ 2025-05-02 12:22 UTC (permalink / raw)
To: util-linux
In-Reply-To: <20250502122242.72961-1-bensberg@telfort.nl>
Calling gettext() is somewhat costly: it has to find the given message
among the more than five thousand messages in util-linux's repertoire.
So, call gettext() only when the message actually gets printed.
Besides, allowing to customize the error message for parse_switch() was
a nice gesture, but it's unneeded: a fixed error message is good enough.
Also, "argument error" was rather vague, as it doesn't say _what_ the
error is. Better say "unsupported argument".
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
---
include/strutils.h | 2 +-
lib/strutils.c | 8 ++++----
sys-utils/eject.c | 6 ++----
sys-utils/irqtop.c | 3 +--
sys-utils/losetup.c | 2 +-
sys-utils/tunelp.c | 8 ++++----
term-utils/setterm.c | 36 ++++++++++++------------------------
7 files changed, 25 insertions(+), 40 deletions(-)
diff --git a/include/strutils.h b/include/strutils.h
index 63cd1c1c6..f8eb5f7c4 100644
--- a/include/strutils.h
+++ b/include/strutils.h
@@ -68,7 +68,7 @@ extern int isxdigit_strend(const char *str, const char **end);
#define isxdigit_string(_s) isxdigit_strend(_s, NULL)
-extern int parse_switch(const char *arg, const char *errmesg, ...);
+extern int parse_switch(const char *arg, ...);
#ifndef HAVE_MEMPCPY
extern void *mempcpy(void *restrict dest, const void *restrict src, size_t n);
diff --git a/lib/strutils.c b/lib/strutils.c
index 0cf0da96b..00934d511 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -247,14 +247,14 @@ int isxdigit_strend(const char *str, const char **end)
}
/*
- * parse_switch(argv[i], "on", "off", "yes", "no", NULL);
+ * For example: parse_switch(argv[i], "on", "off", "yes", "no", NULL);
*/
-int parse_switch(const char *arg, const char *errmesg, ...)
+int parse_switch(const char *arg, ...)
{
const char *a, *b;
va_list ap;
- va_start(ap, errmesg);
+ va_start(ap, *arg);
do {
a = va_arg(ap, char *);
if (!a)
@@ -275,7 +275,7 @@ int parse_switch(const char *arg, const char *errmesg, ...)
} while (1);
va_end(ap);
- errx(STRTOXX_EXIT_CODE, "%s: '%s'", errmesg, arg);
+ errx(STRTOXX_EXIT_CODE, _("unsupported argument: %s"), arg);
}
#ifndef HAVE_MEMPCPY
diff --git a/sys-utils/eject.c b/sys-utils/eject.c
index 310d6c3df..d01cde719 100644
--- a/sys-utils/eject.c
+++ b/sys-utils/eject.c
@@ -207,8 +207,7 @@ static void parse_args(struct eject_control *ctl, int argc, char **argv)
switch (c) {
case 'a':
ctl->a_option = 1;
- ctl->a_arg = parse_switch(optarg, _("argument error"),
- "on", "off", "1", "0", NULL);
+ ctl->a_arg = parse_switch(optarg, "on", "off", "1", "0", NULL);
break;
case 'c':
ctl->c_option = 1;
@@ -229,8 +228,7 @@ static void parse_args(struct eject_control *ctl, int argc, char **argv)
break;
case 'i':
ctl->i_option = 1;
- ctl->i_arg = parse_switch(optarg, _("argument error"),
- "on", "off", "1", "0", NULL);
+ ctl->i_arg = parse_switch(optarg, "on", "off", "1", "0", NULL);
break;
case 'm':
ctl->m_option = 1;
diff --git a/sys-utils/irqtop.c b/sys-utils/irqtop.c
index 51e04ee85..7275d0510 100644
--- a/sys-utils/irqtop.c
+++ b/sys-utils/irqtop.c
@@ -366,9 +366,8 @@ static void parse_args( struct irqtop_ctl *ctl,
ctl->cpustat_mode = IRQTOP_CPUSTAT_AUTO;
else
ctl->cpustat_mode = IRQTOP_CPUSTAT_DISABLE - parse_switch(optarg,
- _("unsupported argument"), "yes", "no",
"always", "never", "enable", "disable",
- "on", "off", "1", "0", NULL);
+ "on", "off", "yes", "no", "1", "0", NULL);
break;
case 'C':
{
diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
index eafab72f3..2840586a8 100644
--- a/sys-utils/losetup.c
+++ b/sys-utils/losetup.c
@@ -818,7 +818,7 @@ int main(int argc, char **argv)
case OPT_DIO:
use_dio = set_dio = 1;
if (optarg)
- use_dio = parse_switch(optarg, _("argument error"), "on", "off", NULL);
+ use_dio = parse_switch(optarg, "on", "off", NULL);
if (use_dio)
lo_flags |= LO_FLAGS_DIRECT_IO;
break;
diff --git a/sys-utils/tunelp.c b/sys-utils/tunelp.c
index 95a21b39e..51442d595 100644
--- a/sys-utils/tunelp.c
+++ b/sys-utils/tunelp.c
@@ -189,24 +189,24 @@ int main(int argc, char **argv)
break;
case 'a':
cmds->op = LPABORT;
- cmds->val = parse_switch(optarg, _("argument error"), "on", "off", NULL);
+ cmds->val = parse_switch(optarg, "on", "off", NULL);
cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next;
cmds->next = NULL;
break;
case 'q':
- show_irq = parse_switch(optarg, _("argument error"), "on", "off", NULL);
+ show_irq = parse_switch(optarg, "on", "off", NULL);
break;
case 'o':
cmds->op = LPABORTOPEN;
- cmds->val = parse_switch(optarg, _("argument error"), "on", "off", NULL);
+ cmds->val = parse_switch(optarg, "on", "off", NULL);
cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next;
cmds->next = NULL;
break;
case 'C':
cmds->op = LPCAREFUL;
- cmds->val = parse_switch(optarg, _("argument error"), "on", "off", NULL);
+ cmds->val = parse_switch(optarg, "on", "off", NULL);
cmds->next = xmalloc(sizeof(struct command));
cmds = cmds->next;
cmds->next = NULL;
diff --git a/term-utils/setterm.c b/term-utils/setterm.c
index 801095c87..886ff78fc 100644
--- a/term-utils/setterm.c
+++ b/term-utils/setterm.c
@@ -559,23 +559,19 @@ static void parse_option(struct setterm_control *ctl, int ac, char **av)
break;
case OPT_CURSOR:
ctl->opt_cursor = set_opt_flag(ctl->opt_cursor);
- ctl->opt_cu_on = parse_switch(optarg, _("argument error"),
- "on", "off", NULL);
+ ctl->opt_cu_on = parse_switch(optarg,"on", "off", NULL);
break;
case OPT_REPEAT:
ctl->opt_repeat = set_opt_flag(ctl->opt_repeat);
- ctl->opt_rep_on = parse_switch(optarg, _("argument error"),
- "on", "off", NULL);
+ ctl->opt_rep_on = parse_switch(optarg, "on", "off", NULL);
break;
case OPT_APPCURSORKEYS:
ctl->opt_appcursorkeys = set_opt_flag(ctl->opt_appcursorkeys);
- ctl->opt_appck_on = parse_switch(optarg, _("argument error"),
- "on", "off", NULL);
+ ctl->opt_appck_on = parse_switch(optarg, "on", "off", NULL);
break;
case OPT_LINEWRAP:
ctl->opt_linewrap = set_opt_flag(ctl->opt_linewrap);
- ctl->opt_li_on = parse_switch(optarg, _("argument error"),
- "on", "off", NULL);
+ ctl->opt_li_on = parse_switch(optarg, "on", "off", NULL);
break;
case OPT_DEFAULT:
ctl->opt_default = set_opt_flag(ctl->opt_default);
@@ -598,33 +594,27 @@ static void parse_option(struct setterm_control *ctl, int ac, char **av)
break;
case OPT_INVERSESCREEN:
ctl->opt_inversescreen = set_opt_flag(ctl->opt_inversescreen);
- ctl->opt_invsc_on = parse_switch(optarg, _("argument error"),
- "on", "off", NULL);
+ ctl->opt_invsc_on = parse_switch(optarg, "on", "off", NULL);
break;
case OPT_BOLD:
ctl->opt_bold = set_opt_flag(ctl->opt_bold);
- ctl->opt_bo_on = parse_switch(optarg, _("argument error"),
- "on", "off", NULL);
+ ctl->opt_bo_on = parse_switch(optarg, "on", "off", NULL);
break;
case OPT_HALF_BRIGHT:
ctl->opt_halfbright = set_opt_flag(ctl->opt_halfbright);
- ctl->opt_hb_on = parse_switch(optarg, _("argument error"),
- "on", "off", NULL);
+ ctl->opt_hb_on = parse_switch(optarg, "on", "off", NULL);
break;
case OPT_BLINK:
ctl->opt_blink = set_opt_flag(ctl->opt_blink);
- ctl->opt_bl_on = parse_switch(optarg, _("argument error"),
- "on", "off", NULL);
+ ctl->opt_bl_on = parse_switch(optarg, "on", "off", NULL);
break;
case OPT_REVERSE:
ctl->opt_reverse = set_opt_flag(ctl->opt_reverse);
- ctl->opt_re_on = parse_switch(optarg, _("argument error"),
- "on", "off", NULL);
+ ctl->opt_re_on = parse_switch(optarg, "on", "off", NULL);
break;
case OPT_UNDERLINE:
ctl->opt_underline = set_opt_flag(ctl->opt_underline);
- ctl->opt_un_on = parse_switch(optarg, _("argument error"),
- "on", "off", NULL);
+ ctl->opt_un_on = parse_switch(optarg, "on", "off", NULL);
break;
case OPT_STORE:
ctl->opt_store = set_opt_flag(ctl->opt_store);
@@ -632,8 +622,7 @@ static void parse_option(struct setterm_control *ctl, int ac, char **av)
case OPT_CLEAR:
ctl->opt_clear = set_opt_flag(ctl->opt_clear);
if (optarg)
- ctl->opt_cl_all = parse_switch(optarg, _("argument error"),
- "all", "rest", NULL);
+ ctl->opt_cl_all = parse_switch(optarg, "all", "rest", NULL);
else
ctl->opt_cl_all = 1;
break;
@@ -667,8 +656,7 @@ static void parse_option(struct setterm_control *ctl, int ac, char **av)
break;
case OPT_MSG:
ctl->opt_msg = set_opt_flag(ctl->opt_msg);
- ctl->opt_msg_on = parse_switch(optarg, _("argument error"),
- "on", "off", NULL);
+ ctl->opt_msg_on = parse_switch(optarg, "on", "off", NULL);
break;
case OPT_MSGLEVEL:
ctl->opt_msglevel = set_opt_flag(ctl->opt_msglevel);
--
2.48.1
^ permalink raw reply related
* [PATCH 1/2] irqtop: use standard 'always/never' arguments instead of 'enable/disable'
From: Benno Schulenberg @ 2025-05-02 12:22 UTC (permalink / raw)
To: util-linux; +Cc: Zhenwei Pi
Most other util-linux tools that accept the option argument "auto"
additionally accept "always" and "never", not "enable" / "disable".
So, make option --cpu-stat accept those standard words (besides the
deviant ones), and adjust the documentation to use the standard words.
Furthermore, make --cpu-stat accept also "on", "off", "yes", "no",
"1", and "0", to allow the user to use shorter words. The per-CPU
stats can now be suppressed with a succinct: `irqtop -c0`.
CC: Zhenwei Pi <pizhenwei@bytedance.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
---
bash-completion/irqtop | 2 +-
sys-utils/irqtop.1.adoc | 6 ++++--
sys-utils/irqtop.c | 11 +++++------
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/bash-completion/irqtop b/bash-completion/irqtop
index 5faf122e5..0dd2f1981 100644
--- a/bash-completion/irqtop
+++ b/bash-completion/irqtop
@@ -9,7 +9,7 @@ _irqtop_module()
return 0
;;
'-c'|'--cpu-stat')
- COMPREPLY=( $(compgen -W "auto enable disable" -- $cur) )
+ COMPREPLY=( $(compgen -W "auto enable disable always never" -- $cur) )
return 0
;;
'-C'|'--cpu-list')
diff --git a/sys-utils/irqtop.1.adoc b/sys-utils/irqtop.1.adoc
index cf258d085..63675f076 100644
--- a/sys-utils/irqtop.1.adoc
+++ b/sys-utils/irqtop.1.adoc
@@ -29,8 +29,10 @@ Specify which output columns to print. Use *--help* to get a list of all support
Send the produced tables to stdout instead of to a static screen.
This can be used for sending the output to other programs or to a file.
-*-c*, *--cpu-stat* _mode_::
-Show per-cpu statistics by specified mode. Available modes are: *auto*, *enable*, *disable*. The default option *auto* detects the width of window, then shows the per-cpu statistics if the width of window is large enough to show a full line of statistics.
+*-c*, *--cpu-stat* _when_::
+Whether to show the per-CPU statistics. Possible arguments are: *auto*, *never*, *always*.
+The default is *auto*: the per-CPU statistics are shown when the window is wide enough
+for the full list of CPUs.
*-C*, *--cpu-list* _list_::
Specify cpus in list format to show.
diff --git a/sys-utils/irqtop.c b/sys-utils/irqtop.c
index 3dbd030e0..51e04ee85 100644
--- a/sys-utils/irqtop.c
+++ b/sys-utils/irqtop.c
@@ -307,7 +307,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(USAGE_OPTIONS, stdout);
fputs(_(" -b, --batch send tables to stdout, not to a static screen\n"), stdout);
- fputs(_(" -c, --cpu-stat <mode> whether to show the per-cpu stats (auto|enable|disable)\n"), stdout);
+ fputs(_(" -c, --cpu-stat <when> whether to show the per-cpu stats (auto|never|always)\n"), stdout);
fputs(_(" -C, --cpu-list <list> show IRQs only for the specified cpus\n"), stdout);
fputs(_(" -d, --delay <secs> wait this number of seconds between updates\n"), stdout);
fputs(_(" -J, --json use JSON output format (implies --batch)\n"), stdout);
@@ -364,12 +364,11 @@ static void parse_args( struct irqtop_ctl *ctl,
case 'c':
if (!strcmp(optarg, "auto"))
ctl->cpustat_mode = IRQTOP_CPUSTAT_AUTO;
- else if (!strcmp(optarg, "enable"))
- ctl->cpustat_mode = IRQTOP_CPUSTAT_ENABLE;
- else if (!strcmp(optarg, "disable"))
- ctl->cpustat_mode = IRQTOP_CPUSTAT_DISABLE;
else
- errx(EXIT_FAILURE, _("unsupported mode '%s'"), optarg);
+ ctl->cpustat_mode = IRQTOP_CPUSTAT_DISABLE - parse_switch(optarg,
+ _("unsupported argument"), "yes", "no",
+ "always", "never", "enable", "disable",
+ "on", "off", "1", "0", NULL);
break;
case 'C':
{
--
2.48.1
^ permalink raw reply related
* [PATCH] bits: only build when cpu_set_t is available
From: Alyssa Ross @ 2025-05-01 7:58 UTC (permalink / raw)
To: util-linux
Doesn't build on macOS.
Fixes: 6e1301d59 ("text-utils: add bits command")
Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
configure.ac | 6 +++++-
meson.build | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index a5d910204..ac043d856 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2309,7 +2309,11 @@ UL_REQUIRES_HAVE([scriptlive], [pty], [openpty function (libutil)])
AM_CONDITIONAL([BUILD_SCRIPTLIVE], [test "x$build_scriptlive" = xyes])
-UL_BUILD_INIT([bits], [yes])
+AC_ARG_ENABLE([bits],
+ AS_HELP_STRING([--disable-bits], [do not build bits]),
+ [], [UL_DEFAULT_ENABLE([bits], [check])])
+UL_BUILD_INIT([bits])
+UL_REQUIRES_HAVE([bits], [cpu_set_t], [cpu_set_t type])
AM_CONDITIONAL([BUILD_BITS], [test "x$build_bits" = xyes])
UL_BUILD_INIT([col], [check])
diff --git a/meson.build b/meson.build
index 1537f5e61..6e0381646 100644
--- a/meson.build
+++ b/meson.build
@@ -1248,7 +1248,7 @@ endif
############################################################
-opt = not get_option('build-bits').disabled()
+opt = not get_option('build-bits').require(have_cpu_set_t).disabled()
exe = executable(
'bits',
bits_sources,
base-commit: caa26876bc75041833c9644491cc2670d623f750
--
2.47.2
^ permalink raw reply related
* Re: [PATCH 1/7] unshare: make the wording of a message identical to that of three others
From: Karel Zak @ 2025-04-30 11:19 UTC (permalink / raw)
To: Benno Schulenberg; +Cc: util-linux
In-Reply-To: <xtmcfjudjau4kuzdjbqj53mqoi5254awzu3opjtprrcvbenif2@i5jqhk5b4pe5>
On Wed, Apr 30, 2025 at 01:18:25PM +0200, Karel Zak wrote:
> On Tue, Apr 29, 2025 at 03:55:28PM +0200, Benno Schulenberg wrote:
> >
> > Op 29-04-2025 om 13:11 schreef Karel Zak:
> > > Created a pull request at
> > > https://github.com/util-linux/util-linux/pull/3550 to test the patches
> > > via CI. I hope I have applied the correct versions of the patches :)
> >
> > The last patch ("docs,usage") probably needs the attached extra diff to
> > pass the tests.
>
> Yes, po4a.cfg needs to be updated too.
updated: https://github.com/util-linux/util-linux/pull/3550/commits/18e5242e0cb6ad8e98e89975e2553b327d169863
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH 1/7] unshare: make the wording of a message identical to that of three others
From: Karel Zak @ 2025-04-30 11:18 UTC (permalink / raw)
To: Benno Schulenberg; +Cc: util-linux
In-Reply-To: <f3465a40-837f-42e5-934b-09f4d5551909@telfort.nl>
On Tue, Apr 29, 2025 at 03:55:28PM +0200, Benno Schulenberg wrote:
>
> Op 29-04-2025 om 13:11 schreef Karel Zak:
> > Created a pull request at
> > https://github.com/util-linux/util-linux/pull/3550 to test the patches
> > via CI. I hope I have applied the correct versions of the patches :)
>
> The last patch ("docs,usage") probably needs the attached extra diff to
> pass the tests.
Yes, po4a.cfg needs to be updated too.
> (I'm surprised that the build system does not automatically make rules
> for all the .adoc files in man-common.)
This is config file for po/asciidocs converter.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH 3/7] lsfd: improve grammar, and use angular brackets around placeholder word
From: Benno Schulenberg @ 2025-04-30 8:20 UTC (permalink / raw)
To: Masatake YAMATO, kzak; +Cc: util-linux
In-Reply-To: <20250430.045441.583220097476882528.yamato@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 285 bytes --]
Op 29-04-2025 om 21:54 schreef Masatake YAMATO:
> Simplifying the output of --help is nice
> However, from the man page, I want to keep the description of -p
> supporting whitespace as a separator.
Okay. I will add that back when the current PR has been merged.
Benno
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply
* Re: [PATCH 3/7] lsfd: improve grammar, and use angular brackets around placeholder word
From: Masatake YAMATO @ 2025-04-29 19:54 UTC (permalink / raw)
To: kzak; +Cc: bensberg, util-linux
In-Reply-To: <3vy4ysebkufi3zpcv2s66nnzghsf7nu4fthkmzotj6ctxawnd5@ottmham4b2lu>
From: Karel Zak <kzak@redhat.com>
Subject: Re: [PATCH 3/7] lsfd: improve grammar, and use angular brackets around placeholder word
Date: Thu, 24 Apr 2025 12:05:07 +0200
> On Thu, Apr 24, 2025 at 06:55:05PM +0900, Masatake YAMATO wrote:
>> > Also, use dots instead of "(s)" to indicate possible multiple arguments,
>> > and don't use "<when>" when the possible arguments differ from "always",
>> > "never", "auto".
>> >
>> > Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
>> > ---
>> > lsfd-cmd/lsfd.c | 6 +++---
>> > 1 file changed, 3 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/lsfd-cmd/lsfd.c b/lsfd-cmd/lsfd.c
>> > index 2eb53935c..3610de8dd 100644
>> > --- a/lsfd-cmd/lsfd.c
>> > +++ b/lsfd-cmd/lsfd.c
>> > @@ -2190,14 +2190,14 @@ static void __attribute__((__noreturn__)) usage(void)
>> > fputs(_(" -o, --output <list> output columns (see --list-columns)\n"), out);
>> > fputs(_(" -r, --raw use raw output format\n"), out);
>> > fputs(_(" -u, --notruncate don't truncate text in columns\n"), out);
>> > - fputs(_(" -p, --pid <pid(s)> collect information only specified processes\n"), out);
>> > + fputs(_(" -p, --pid <pid>... collect information only for specified processes\n"), out);
>>
>> This change implies that --pid 1 2 3 works.
>> However, specifying multiple pids to one --pid doesn't work.
>>
>> # lsfd --pid 1 $$
>> Try 'lsfd --help' for more information.
>>
>> Only --pid "1 2 3" or works. See double-quote chars.
>>
>> # lsfd --pid "1 $$"
>
> It also supports comma, it means --pid 1,2,3
>
> It would be better to not announce that space is possible to use as
> separator, and use comma in the help and man page
>
> fputs(_(" -p, --pid <list> restrict to specified processes (command separated pids)\nn"), out);
>
> or so ...
I added code supporting whitespace as a separator for combining lsfd with
pidof, as I wrote as an example in lsfd(1):
# lsfd --pid "$(pidof firefox)"
The idea combining with pidof comes from strace.
The -p option of strace supported whitespace as a separator.
So we can run strace with pidof like:
# strace -p "$(pidof firefox)"
I didn't know this smart feature.
So I added -S option, an option for specifying separator to pidof ago.
$ pidof -S ' -p ' zsh
4185021 -p 4161716 -p 4156470 -p 4155385
$ strace -p $(pidof -S ' -p ' zsh)
https://gitlab.com/procps-ng/procps/-/commit/73492b182dc60c1605d1b0d62de651fad97807af
https://lists.strace.io/pipermail/strace-devel/2018-March/007950.html
https://lists.strace.io/pipermail/strace-devel/2018-March/007951.html
https://lists.strace.io/pipermail/strace-devel/2018-March/007952.html
That was a small thing but impressive study for me.
Simplifying the output of --help is nice
However, from the man page, I want to keep the description of -p
supporting whitespace as a separator.
Masatake YAMATO
> Karel
>
> --
> Karel Zak <kzak@redhat.com>
> http://karelzak.blogspot.com
>
^ permalink raw reply
* Re: [PATCH 1/7] unshare: make the wording of a message identical to that of three others
From: Benno Schulenberg @ 2025-04-29 13:55 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux
In-Reply-To: <qf3xkiasm5b5zliten36bjv4ynd4kdzj7nll5x3nq5jsasfegg@evnsrxot4x6j>
[-- Attachment #1.1.1: Type: text/plain, Size: 440 bytes --]
Op 29-04-2025 om 13:11 schreef Karel Zak:
> Created a pull request at
> https://github.com/util-linux/util-linux/pull/3550 to test the patches
> via CI. I hope I have applied the correct versions of the patches :)
The last patch ("docs,usage") probably needs the attached extra diff to
pass the tests.
(I'm surprised that the build system does not automatically make rules
for all the .adoc files in man-common.)
Benno
[-- Attachment #1.1.2: po4a-hyperlink.diff --]
[-- Type: text/x-patch, Size: 785 bytes --]
diff --git a/po-man/po4a.cfg b/po-man/po4a.cfg
index 25df538a3..959ddb8bf 100644
--- a/po-man/po4a.cfg
+++ b/po-man/po4a.cfg
@@ -7,6 +7,7 @@
[type:asciidoc] ../man-common/footer-lib.adoc $lang:$lang/man-common/footer-lib.adoc opt:"--keep 0"
[type:asciidoc] ../man-common/footer.adoc $lang:$lang/man-common/footer.adoc opt:"--keep 0"
[type:asciidoc] ../man-common/help-version.adoc $lang:$lang/man-common/help-version.adoc opt:"--keep 0"
+[type:asciidoc] ../man-common/hyperlink.adoc $lang:$lang/man-common/hyperlink.adoc opt:"--keep 0"
[type:asciidoc] ../man-common/in-bytes.adoc $lang:$lang/man-common/in-bytes.adoc opt:"--keep 0"
[type:asciidoc] ../man-common/translation.adoc $lang:$lang/man-common/translation.adoc opt:"--keep 0"
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox