Thomas Weißschuh [Wed, 21 Jun 2023 12:26:05 +0000 (14:26 +0200)]
tests: (run.sh) detect builddir from working directory
This makes it easier to run test.sh from the build directory as
everything will work without any parameters irrespective of the build
directories name.
Karel Zak [Mon, 26 Jun 2023 10:00:41 +0000 (12:00 +0200)]
Merge branch 'lsfd--fix-separators-for-json-output-endpoints-only' of https://github.com/masatake/util-linux into stable/v2.39
* 'lsfd--fix-separators-for-json-output-endpoints-only' of https://github.com/masatake/util-linux:
tests: (lsfd) add a case for verifying ENDPOINTS column output in JSON mode
lsfd: use ARRAY_STRING for ENDPOINTS column in JSON output mode
lsfd: (filter) weakly support ARRAY_STRING and ARRAY_NUMBER json types
Karel Zak [Thu, 22 Jun 2023 11:11:57 +0000 (13:11 +0200)]
libmount: fix sync options between context and fs structs
Since v2.39 libmount prefers "struct libmnt_optlist" to keep mount options
rather than the original "struct libmnt_fs". This is problem if the
"fs" struct is defined and maintained outside the context.
The library has already a way how to sync "fs" and "optlist", but this
needs to be improved and used more widely. Changes:
* force "fs" from context to always read options from "optlist"
* copy options from "fs" to "optlist" in mnt_context_set_fs()
* internally redirect mnt_fs_* API for options to "optlist" if optlist
defined
* add simple test to make sure options from different sources are
always merged together
Addresses: https://github.com/util-linux/util-linux/issues/2326 Signed-off-by: Karel Zak <kzak@redhat.com>
Masatake YAMATO [Thu, 22 Jun 2023 02:28:47 +0000 (11:28 +0900)]
lsfd: (filter) weakly support ARRAY_STRING and ARRAY_NUMBER json types
We will have operators for array types in the future. Till having
them, we treat the types as STRING. So we can use string operators for
the column having types.
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)));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~