Karel Zak [Tue, 13 Sep 2022 06:57:49 +0000 (08:57 +0200)]
Merge branch 'lsfd-refine-columns' of https://github.com/masatake/util-linux
* 'lsfd-refine-columns' of https://github.com/masatake/util-linux:
lsfd: cosmetic change
lsfd: (man) write about PIDFD.* columns
lsfd: show pid, comm, and nspid of pidfd in PIDFD.{PID,COMM,NSPID} columns
lsfd: (filter): accept '.' used in column names
tests: (lsfd) fix the potential problems reported by github-code-scan
tests: (lsfd) put double quote characters around variable expansions
lsfd: use NAME column to show cooked file names
lsfd: use TYPE column to show cooked file types
lsfd: show classes of anonyomous inodes in AINODECLASS column
lsfd: cosmetic changes
tests: (mkfds) add a factory for making an inotify fd
tests: (mkfds) cosmetic change, deleting an empty line
lsfd: show pid, comm, and nspid of pidfd in PIDFD.{PID,COMM,NSPID} columns
The values shown in the new columns are already shown in NAME column.
Showing these values together in the NAME column helps users
understand the pidfds opened quickly. However, the showing them
together is not suitable for machine processing. The newly introduced
columns are for machine processing.
This change splits the NAME column
into cooked NAME column and raw KNAME column.
KNAME represents the type information extracted from /proc/$pid/fd or
/proc/$pid/map_files. NAME is the same as KNAME but humans friendly
and talkative if a special handler is implemented for the type of the
file.
Peter Ujfalusi [Wed, 7 Sep 2022 05:41:41 +0000 (08:41 +0300)]
lib/timeutils: Require '@' prefix for seconds since the Epoch timestamp
Since the seconds since the Epoch is just a number it might be better to
require special prefix to indicate the intention that the user wants to
interpret the number as seconds since the Epoch.
Use the same '@' character as prefix as used by systemd.time to make it
easier to integrate in scripts intended to be used on systems with or
without systemd.
Fix also the initial support which discarded the seconds from the converted
timestamp.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
A. show quickly understandable information in limited display area, and
B. provide primitive raw information for post-process tools.
For the purpose A, summarizing information is nice. However, the
summarized information is not suitable for tools.
To satisfy the both requirements, I plan introducing new fields
with a new convention.
STTYPE represents the type information returned from stat(2).
TYPE is the same as STTYPE but two exceptions; TYPE is filled with
PROTONAME value if the target fd is a socket, or with AINODECLASS
value if the target fd is a anonymous inode.
Jakub Wilk [Wed, 7 Sep 2022 15:55:16 +0000 (17:55 +0200)]
Use "grep -E" instead of "egrep"
The egrep command has been deprecated since GNU grep 2.5.3
(released in 2007). In GNU grep 3.8, it issues an obsolescence warning:
https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d4
Karel Zak [Mon, 5 Sep 2022 07:01:42 +0000 (09:01 +0200)]
lsblk: add PARTN column
Add PARTN column, the source for this column is ID_PART_ENTRY_NUMBER
from udev db, the original source of this information comes from
libblkid. There is also another PARTN in udevdb, but it's based on
data from kernel uevent.
Fixes: https://github.com/util-linux/util-linux/issues/1787 Signed-off-by: Karel Zak <kzak@redhat.com>
Jeremy Linton [Thu, 1 Sep 2022 21:52:30 +0000 (16:52 -0500)]
lscpu: Even more Arm part numbers
Arm has published further MIDR/part numbers on
https://developer.arm.com/ip-products/processors/cortex-a.
Some of the new ones have already been merged, so lets
fill in the gaps with A34, A65AE and X1C.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Chris Webb [Wed, 24 Aug 2022 11:52:55 +0000 (12:52 +0100)]
unshare: Don't waste an ID when -r is used with --map-auto
When --map-root-user or --map-current-user are used with --map-auto, one of
the IDs from the first range in /etc/subuid and /etc/subgid is wasted and
left unmapped:
In the second unshare, only 99 of the 100 UIDs available from /etc/subuid
are actually mapped, whereas in the first unshare, all 100 delegated UIDs
are correctly mapped.
Distinguish auto mappings from manually-specified ones so they can be
handled correctly, while still ensuring explicit --map-users/groups that
overlap with the single mapping are correctly reduced in length because
of the hole that's punched:
Check whether magic.h header exists before defining HAVE_MAGIC.
Despite library availability there still can be missing header.
Current test doesn't cover that possibility which will lead compilation
to fail in case of separate sysroot.
Signed-off-by: Mateusz Marciniec <mateuszmar2@gmail.com> Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com>
Karel Zak [Fri, 19 Aug 2022 07:29:56 +0000 (09:29 +0200)]
Merge branch 'lsfd-pidfd' of https://github.com/masatake/util-linux
* 'lsfd-pidfd' of https://github.com/masatake/util-linux:
lsfd.1.adoc: write about how pidfds are represented in NAME column
lsfd: show pids targeted by pidfds in NAME column
lsfd: add a helper function to get 'struct proc' object for given pid
lsfd: introduce a method table for supporting various anon inodes
lsfd.1.adoc: write more about TYPE column
lsfd.1.adoc: fix a wrong formatting
lsfd.1.adoc: fix typos
lsfd.1.adoc: use monospace face instead of italic face
lsfd: delete __unused__ attr from a used parameter
Karel Zak [Mon, 8 Aug 2022 09:18:49 +0000 (11:18 +0200)]
Merge branch 'lsfd--testing-mmapped-packet-socket' of https://github.com/masatake/util-linux
* 'lsfd--testing-mmapped-packet-socket' of https://github.com/masatake/util-linux:
test: (lsfd) add a case for displaying PROTONAME column of mmap'ed AF_PACKET socket
Khem Raj [Sun, 7 Aug 2022 21:39:19 +0000 (14:39 -0700)]
check for sys/pidfd.h
This header in newer glibc defines the signatures of functions
pidfd_send_signal() and pidfd_open() and when these functions are
defined by libc then we need to include the relevant header to get
the definitions. Clang 15+ has started to error out when function
signatures are missing.
Fixes errors like
misc-utils/kill.c:402:6: error: call to undeclared function 'pidfd_send_signal'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
if (pidfd_send_signal(pfd, ctl->numsig, &info, 0) < 0)
Karel Zak [Wed, 20 Jul 2022 13:23:01 +0000 (15:23 +0200)]
lib/fileutils: fix compiler warning
lib/fileutils.c: In function ‘dup_fd_cloexec’:
lib/fileutils.c:75:35: warning: unused parameter ‘lowfd’ [-Wunused-parameter]
int dup_fd_cloexec(int oldfd, int lowfd)
^
Addresses: https://github.com/util-linux/util-linux/issues/1755 Signed-off-by: Karel Zak <kzak@redhat.com>
Kai Lüke [Thu, 14 Jul 2022 21:49:16 +0000 (23:49 +0200)]
meson: Install binaries to prefix
When compiled in Flatpak /usr is read-only and the /app prefix is used.
However, the binary installation did not use the prefix but had /usr
hardcoded.
Use the prefix instead of /usr when assembling the prefix/(s)bin paths.
The internal Apple model numbers for the SoCs are somewhat
confusing given that they are mostly similar and differ by only
one or two digits. Instead, use the public nomenclature for these
chips to avoid ambiguity and beautify the output.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Sol Boucher [Fri, 8 Jul 2022 16:09:13 +0000 (12:09 -0400)]
unshare: Fix "you (user xxxx) don't exist" error when uid differs from primary gid
This problem affected the --map-auto and --map-groups=auto command-line switches.
The root cause is that /etc/subgid is indexed by user or uid, not by group or gid;
therefore, we should be using the effective uid to find entries in this file, just
as we do for /etc/subuid.
Michael Trapp [Mon, 20 Jun 2022 15:10:36 +0000 (17:10 +0200)]
libuuid: Implement continuous clock handling for time based UUIDs
In a uuidd setup, the daemon is a singleton and can maintain it's own
resources for time based UUID generation. This requires a dedicated
'clock sequence range' but does not need any further lock/update of
the LIBUUID_CLOCK_FILE from uuidd. The range of available clock values
is extended by a continuous handling of the clock updates - instead of
updating the value to the current timestamp, it is incremented by
the number of requested UUIDs.
Philip Hazelden [Sun, 3 Jul 2022 21:46:16 +0000 (22:46 +0100)]
Rename: fix empty 'from' with / in filename.
Previously, if we did e.g.
rename '' _ ./foo.txt
it would try to rename to ._/foo.txt, because `string_replace` was
passed `s="/foo.txt"` and `from` would match at the front. Now we pass
`s="foo.txt"`.
This doesn't affect the case when `to` contains a slash. In that
situation we'll still place `to` at the very beginning of the path, e.g.
rename '' _/ ./foo.txt # rename to _/./foo.txt
rename '' /_ ./foo.txt # rename to /_./foo.txt