Karel Zak [Tue, 20 Jun 2023 11:15:45 +0000 (13:15 +0200)]
lib: remove pager.c from libcommon
The libcommon is a binary archive to keep compilation and maintenance
simple. The library is not linked as shared or so. The unused symbols
are removed from binaries (for example, by "make install-strip").
But it isn't evident for license analyzers (and some humans) that the
library uses GPL and non-GPL stuff simultaneously. Let's avoid doubts
and keep pager.c (with GPL license) out of the archive
Karel Zak [Mon, 19 Jun 2023 11:29:42 +0000 (13:29 +0200)]
libmount: always ignore user=<name>
The library (on mount) cares about "user", but has to ignore
"user=name". It works as expected, but only for non-root users. We
need to ignore it also root to be compatible with /sbin/mount.cifs
where some people still use "user=" (rather than "username=").
This conditional was never implemented in the meson config. Under
autotools, it is guarded by availability of headers and an option. I
didn't implement the option here.
Fixes #2310.
'!= false' is used because 'x == 1' is rejected by meson if 'x' is
false. OTOH, 'x != false' seems to work if 'x' is 1.
Karel Zak [Thu, 25 May 2023 09:48:24 +0000 (11:48 +0200)]
libmount: don't call hooks after mount.<type> helper
In case more filesystems are specified (or when libmount follows
/{etc,proc}/filesystems) then the library may try to use and
initialize the new API because for some filesystems, we need
exec(/sbin/mount.<type>) and for another fsopen().
The hooks that use the API have to smart and detect that the mount
operation was done in external /sbin/mount.<type> helper. And in this
case, the new API file descriptors must be ignored.
The exception is propagation flags, mount(8) can set the flags after
exec(/sbin/mount.<type>), for example, "mount -t ntfs --make-private".
Fixes: https://github.com/util-linux/util-linux/issues/2267 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 22 May 2023 15:26:55 +0000 (17:26 +0200)]
libmount: don't call mount.<type> helper with usernames
This is v2.39 regression. The "user" mount option is internally
converted to "user=<name>", but this should not be exported to
the mount helpers.
The mount helper accepts the <name> only if specified in mount options
(cifs uses user=). The real username as generated by libmount is not
relevant in this case.
Frantisek Sumsal [Thu, 18 May 2023 16:56:15 +0000 (18:56 +0200)]
build-sys: add --disable-waitpid
The new pidfd stuff waitpid uses is not compatible with older kernel
headers, but the rest of the util-linux is still perfectly fine, so
allow disabling just the waitpid utility to make the builds happy again.
наб [Sun, 14 May 2023 23:19:58 +0000 (01:19 +0200)]
mesg.1 cleanups/updates
First hunk: grammar.
Second hunk: (a) mentioning BSD ptys and not UNIX98 ones is odd,
(b) mentioning /only/ ptys is odder still.
Third hunk: mesg is found in the UNIX Programmer's Manual;
it takes its modern form in V7
(it's unclear to me why V6 specifically is mentioned,
since it's still default-invert + always-report-"was X").
Thomas Weißschuh [Fri, 19 May 2023 15:34:00 +0000 (17:34 +0200)]
libsmartcols: (samples): fix format truncation warning
As this is only an example and the needed memory is not much just
hardcode a large enough number.
The previously computed value was wrong anyways.
libsmartcols/samples/continuous.c: In function 'main':
libsmartcols/samples/continuous.c:110:61: error: '%3d' directive output may be truncated writing between 3 and 11 bytes into a region of size between 0 and 7 [-Werror=format-truncation=]
110 | snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
| ^~~
libsmartcols/samples/continuous.c:110:25: note: 'snprintf' output between 11 and 333 bytes into a destination of size 12
110 | snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111 | done ? 100 : (int)(diff / (TIME_PERIOD / 100.0)));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libsmartcols/samples/continuous.c:110:61: error: '%3d' directive output may be truncated writing 3 bytes into a region of size between 0 and 7 [-Werror=format-truncation=]
110 | snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
| ^~~
libsmartcols/samples/continuous.c:110:25: note: 'snprintf' output between 11 and 325 bytes into a destination of size 12
110 | snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111 | done ? 100 : (int)(diff / (TIME_PERIOD / 100.0)));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karel Zak [Wed, 10 May 2023 13:13:17 +0000 (15:13 +0200)]
Merge branch 'tests' of https://github.com/t-8ch/util-linux
* 'tests' of https://github.com/t-8ch/util-linux:
ci: don't try to install kernel modules if they are not available
ci: update package list before trying to determine package availability
tools: (asciidoctor-unicodeconverter) don't fix multi manpages
tools: (asciidoctor-unicodeconverter) properly handle dotted commands
Chris Webb [Tue, 9 May 2023 16:46:00 +0000 (17:46 +0100)]
lib/pager: fix output truncation from buffered stdout
Commit 518a0ad dropped fflush(stdout) and fflush(stderr) from
wait_for_pager() before STDOUT_FILENO and STDERR_FILENO are closed
because it is called from a signal handler and they are async-unsafe.
However, failure to flush output leads to unwanted truncation when
stdout is fully buffered, which it is by default when we are linked
against musl.
Ensure stdout and stderr are line-buffered before redirecting them to
the pager subprocess to avoid this.
Addresses: https://github.com/util-linux/util-linux/issues/2218 Signed-off-by: Chris Webb <chris@arachsys.com>
Karel Zak [Tue, 9 May 2023 11:25:09 +0000 (13:25 +0200)]
fsck: use BLKID_SUBLKS_BADCSUM
We need to be a little bit more promiscuou in fsck to see also
inconsistent superblocks.
It would be possible to do not use libmount to ask for filesystem type
and ask directly libblkid, but libmount is also used to parse fstab
and search in the file and in this case it caches FS tags. It seems
better to continue with libmount to reduce overhead and keep the code
simple.
Addresses: https://github.com/util-linux/util-linux/issues/2214 Signed-off-by: Karel Zak <kzak@redhat.com>