]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
5 years agodocs/COREDUMP_PACKAGE_METADATA.md: Add debuginfod key
Mark Wielaard [Thu, 6 May 2021 01:05:02 +0000 (03:05 +0200)] 
docs/COREDUMP_PACKAGE_METADATA.md: Add debuginfod key

Signed-off-by: Mark Wielaard <mark@klomp.org>
5 years agotest: drop default ACL from $TESTDIR
Yu Watanabe [Thu, 6 May 2021 06:47:01 +0000 (15:47 +0900)] 
test: drop default ACL from $TESTDIR

This fixes an issue introduced by the commit 954c77c2510c0328fd98354a59f380945752c38c.

For some reasons, setting default ACL on $TESTDIR makes TEST-29-PORTABLE
fail. Let's drop the default ACL, and set ACL on saved results instead.

Fixes #19519.

5 years agotest: increase image size when static library or standalone binaries are installed
Yu Watanabe [Thu, 6 May 2021 04:28:19 +0000 (13:28 +0900)] 
test: increase image size when static library or standalone binaries are installed

5 years agoUnify pn81H3 and cvrLenovoideapadD330-10IGM
howl [Tue, 4 May 2021 09:20:23 +0000 (11:20 +0200)] 
Unify pn81H3 and cvrLenovoideapadD330-10IGM

D330-10IGM has been added due the fact that 81H3 and 81MD product name belongs to the same product version. So the fact is that now that we know 81MD has the same transformation matrix that the 81H3 we can just use the product version and get rid the product name.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
5 years agodocs: Fix typos in PORTABLE_SERVICES.md
Phaedrus Leeds [Thu, 6 May 2021 03:59:29 +0000 (22:59 -0500)] 
docs: Fix typos in PORTABLE_SERVICES.md

5 years agotest: drop log_trace() in test-random-util
Yu Watanabe [Wed, 5 May 2021 18:47:58 +0000 (03:47 +0900)] 
test: drop log_trace() in test-random-util

It provides almost no inoformation. Moreover, it massively increases
logs, and firefox cannot show the results of Ubuntu CIs due to this.

5 years agoMerge pull request #19515 from keszybz/config-parser-crash-fix
Yu Watanabe [Thu, 6 May 2021 03:46:13 +0000 (12:46 +0900)] 
Merge pull request #19515 from keszybz/config-parser-crash-fix

Fix crashes in config parsing

5 years agoMerge pull request #19514 from keszybz/return-UnitNameFlags-more
Yu Watanabe [Thu, 6 May 2021 03:46:00 +0000 (12:46 +0900)] 
Merge pull request #19514 from keszybz/return-UnitNameFlags-more

Return UnitNameFlags from unit_name_to_instance()

5 years agoMerge pull request #19513 from takaswie/topic/ieee1394-hwdb-entries-for-video
Yu Watanabe [Thu, 6 May 2021 03:45:05 +0000 (12:45 +0900)] 
Merge pull request #19513 from takaswie/topic/ieee1394-hwdb-entries-for-video

hwdb: ieee1394-unit-function: add entries to obsolete existent udev rules for video function

5 years agoMerge pull request #19507 from nabijaczleweli/bootctlpsko-lite
Yu Watanabe [Thu, 6 May 2021 03:44:21 +0000 (12:44 +0900)] 
Merge pull request #19507 from nabijaczleweli/bootctlpsko-lite

bootctl: take --make-machine-id-directory=yes|no|auto and make/remove \$MACHINE_ID accordingly

5 years agoci: cover standalone/static binaries in build test
Frantisek Sumsal [Wed, 5 May 2021 19:07:36 +0000 (21:07 +0200)] 
ci: cover standalone/static binaries in build test

5 years agoMerge pull request #19498 from poettering/mallinfo2
Luca Boccassi [Wed, 5 May 2021 21:00:49 +0000 (22:00 +0100)] 
Merge pull request #19498 from poettering/mallinfo2

selinux: use mallocinfo2() if it exists

5 years agoudev: make /dev/vfio/vfio 0666
Alyssa Ross [Tue, 4 May 2021 22:05:55 +0000 (22:05 +0000)] 
udev: make /dev/vfio/vfio 0666

Quoting Documentation/driver-api/vfio.rst in Linux:

> note that /dev/vfio/vfio provides no capabilities on its own and is therefore
> expected to be set to mode 0666 by the system

5 years agosd-device: reject empty driver name 19515/head
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 15:02:49 +0000 (17:02 +0200)] 
sd-device: reject empty driver name

If ":" was the last char in the string, we would call access() on ".../drivers/", which
would pass. It probably doesn't matter, but let's reject this anyway.

5 years agosd-device: use memdupa_suffix0() where appropriate
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 14:57:39 +0000 (16:57 +0200)] 
sd-device: use memdupa_suffix0() where appropriate

No functional change intended.

5 years agosd-device: do no allocate strings of unknown length on the stack
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 14:49:41 +0000 (16:49 +0200)] 
sd-device: do no allocate strings of unknown length on the stack

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33881.

Not only we would duplicate unknown input on the stack, we would do it
over and over. So let's first check that the input has reasonable length,
but also allocate just one fixed size buffer.

5 years agofuzz-journald-kmsg: silence output as usual
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 14:44:52 +0000 (16:44 +0200)] 
fuzz-journald-kmsg: silence output as usual

5 years agocore: fix crash in BPFProgram parsing
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 14:04:29 +0000 (16:04 +0200)] 
core: fix crash in BPFProgram parsing

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33270.

5 years agobasic/log: use SYNTHETIC_ERRNO in one more place
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 13:51:41 +0000 (15:51 +0200)] 
basic/log: use SYNTHETIC_ERRNO in one more place

5 years agocore: use the same pattern for extract_first_word() checks
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 13:41:06 +0000 (15:41 +0200)] 
core: use the same pattern for extract_first_word() checks

No functional change, but there is no reason to write it too verbosely
or in different orders.

5 years agocore: fix potential crash in BPFProgram=
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 13:39:55 +0000 (15:39 +0200)] 
core: fix potential crash in BPFProgram=

5 years agocore: fix crash in parsing of SocketBind{Allow,Deny}=
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 13:38:33 +0000 (15:38 +0200)] 
core: fix crash in parsing of SocketBind{Allow,Deny}=

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33876.

5 years agoudev: uaccess: remove ID_FFADO entry 19513/head
Takashi Sakamoto [Wed, 5 May 2021 14:10:29 +0000 (23:10 +0900)] 
udev: uaccess: remove ID_FFADO entry

The ID_FFADO environment variable comes from external FFADO project.
Now we have comprehensive and self-contained rules instead of it.
Let's remove it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
5 years agohwdb: ieee1394-unit-function: add entry for AV/C device with vendor unique command set
Takashi Sakamoto [Wed, 5 May 2021 14:10:29 +0000 (23:10 +0900)] 
hwdb: ieee1394-unit-function: add entry for AV/C device with vendor unique command set

In IEC 61883-1:1998, we can see some values for AV/C device with vendor
unique command set in IEC 61883-1:1998. Current udev rule handles it
for video. However it brings an issue that the functions in AV/C device
are not distinguished just by the content of configuration ROM.

In former commit, hardware database was added to describe function type
of unit in the node, then udev rules are added to utilize the database.

However, we have an request to obsolete existent udev rules by putting
enough entries to the database. It should be done carefully.

This commit adds entry into hardware database just for backward
compatibility. The entry can match to some node and unit unexpectedly.
Therefore this commit modifies existent entries to invalidate the effect
from added entry.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
5 years agohwdb: ieee1394-unit-function: add entry for AV/C device with generic AV/C command set
Takashi Sakamoto [Wed, 5 May 2021 14:10:29 +0000 (23:10 +0900)] 
hwdb: ieee1394-unit-function: add entry for AV/C device with generic AV/C command set

Typical node of AV/C device has standard content of configuration ROM.
This is defined in documentation of 1394 Trading Association.

 * Configuration ROM for AV/C Devices 1.0 (Dec. 12, 2000, 1394 Trading
   Association, TA Document 1999027)

However, it brings an issue that the functions in AV/C device are not
distinguished just by the content of configuration ROM.

In former commit, hardware database was added to describe function type
of unit in the node, then udev rules are added to utilize the database.

However, we have an request to obsolete existent udev rules by putting
enough entries to the database. It should be done carefully.

This commit adds entry into hardware database just for backward
compatibility. The entry can match to some node and unit unexpectedly.
Therefore this commit modifies existent entries to invalidate the effect
from added entry.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
5 years agohwdb: ieee1394-unit-function: remove entry for Cool Stream iSweet
Takashi Sakamoto [Wed, 5 May 2021 14:10:29 +0000 (23:10 +0900)] 
hwdb: ieee1394-unit-function: remove entry for Cool Stream iSweet

IIDC specification describes configuration ROM without model field, thus
it's not possible to match any entry with vendor ID and model ID.
Current entry for Cool Stream iSweet can match any node and unit of
IIDC.

This commit removes the entry. I note that this model uses Texus
Instruments MC680-DCC as all-in-one chipset for video function in
IEEE 1394 bus.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
5 years agohwdb: ieee1394-unit-function: add entries for Point Grey cameras
Takashi Sakamoto [Wed, 5 May 2021 14:10:29 +0000 (23:10 +0900)] 
hwdb: ieee1394-unit-function: add entries for Point Grey cameras

Point Grey Research, inc. shipped cameras to support IIDC, however some
of them are necessarily compliant to IIDC specification in terms of the
value of software version field in unit directory of configuration ROM.

This commit adds entries for them.

Reviewed-by: Damien Douxchamps <damien@douxchamps.net>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
5 years agohwdb: ieee1394-unit-function: add IIDC generic entries
Takashi Sakamoto [Wed, 5 May 2021 14:10:29 +0000 (23:10 +0900)] 
hwdb: ieee1394-unit-function: add IIDC generic entries

Instrumentation & Industrial Digital Camera (IIDC) specifications are
defined by 1394 Trading Association for camera device in IEEE 1394 bus.
IIDC2 specifications are defined by joint working group between Japan
Industrial Imaging Association (JIIA) and 1394 Trade Association as
bus-independent specification.

This commit adds entries for the specifications to remove existent udev
rules. Supported specifications are listed below:

 * 1394-based Digital Camera Specification Version 1.04 (Aug. 9, 1996,
   1394 Trading Association)
 * 1394-based Digital Camera Specification Version 1.20 (Jul. 23, 1998,
   1394 Trading Association)
 * IIDC Digital Camera Control Specification Ver.1.30 (Jul. 25, 2000,
   1394 Trading Association)
 * IIDC Digital Camera Control Specification Ver.1.31 (Feb. 2, 2004,
   1394 Trading Association, TA Document 2003017)
 * IIDC Digital Camera Control Specification Ver.1.32 (Jul. 24, 2008,
   1394 Trading Association, Document number 2007009)
 * IIDC2 Digital Camera Control Specification Ver.1.0.0 (Jan 26th, 2012,
   1394 Trading Association, TS2011001)
 * IIDC2 Digital Camera Control Specification Ver.1.1.0 (May 19th, 2015,
   1394 Trading Association, TS2015001)

Reviewed-by: Damien Douxchamps <damien@douxchamps.net>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
5 years agohwdb: ieee1394-unit-function: add entries for Digital Everywhere FloppyDTV and FireDTV
Takashi Sakamoto [Wed, 5 May 2021 14:10:29 +0000 (23:10 +0900)] 
hwdb: ieee1394-unit-function: add entries for Digital Everywhere FloppyDTV and FireDTV

Linux kernel has firedtv kernel module as driver for Digital Everywhere
FloppyDTV and FireDTV. Although this driver works without any help of
userspace application, it's better to add entries to hardware database
for developer's convenience.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
5 years agohwdb: ieee1394-unit-function: fix indentation
Takashi Sakamoto [Wed, 5 May 2021 14:10:29 +0000 (23:10 +0900)] 
hwdb: ieee1394-unit-function: fix indentation

Zbigniew Jędrzejewski-Szmek points that current entries are against the
convention of indentation. It should be indented by one space instead of
two.

This commit fixes current entries according to it.

Reported-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fixes: 1b6d9a05b14a ("hwdb: add database entries for models with ASICs in BeBoB solution")
Fixes: 0db0564e957f ("hwdb: add database entries for models with Fireworks board module")
Fixes: 38338b302cb0 ("hwdb: add database entries for models with OXFW970/971 ASICs")
Fixes: c0d8b61f9385 ("hwdb: add database entries for models based on DICE ASICs with TCAT specification")
Fixes: a774b5099bce ("hwdb: add database entries for models based on DICE ASICs specialized to M-Audio")
Fixes: ff1cb7b9393a ("hwdb: add database entries for models based on DICE ASICs specialized to Weiss Engineering")
Fixes: 6f44dddbe20a ("hwdb: add database entries for models based on DICE ASICs specialized by Loud Technologies")
Fixes: 49ed0aad525b ("hwdb: add database entries for models based on DICE ASICs specialized by Harman Music Group")
Fixes: effbb4024b8b ("hwdb: add database entries for models based on DICE ASICs specialized by Solid State Logic")
Fixes: 4aaa093b5fb6 ("hwdb: add database entries for models of Digidesign Digi 00x family")
Fixes: c489e7f9d3c4 ("hwdb: add database entries for Tascam FireWire series")
Fixes: 650b8967a57b ("hwdb: add database entries for MOTU FireWire series")
Fixes: 51e9242b9b91 ("hwdb: add database entries for RME Fireface series")
Fixes: a90a6a9ae9f8 ("hwdb: add database entries for Yamaha mLAN 2nd generation")
Fixes: 41f2d0d393a4 ("hwdb: add database entries for Yamaha mLAN 3rd generation")
Fixes: 1d2ee962922f ("hwdb: add database entries for Focusrite Liquid Mix series")
Fixes: 0c20543835d6 ("hwdb: add database entries for TC Electronic PowerCore FireWire series")
Fixes: 8b4b76dc5021 ("hwdb: add database entry for node with single unit with video function")
Fixes: 12dd2404bee8 ("hwdb: add database entries for node with multiple units")
Fixes: dece0357e1c8 ("hwdb: add database entries for node with single unit for multiple functions")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
5 years agohwdb: fix parser to execute test for ieee1394-unit-function with no argument
Takashi Sakamoto [Wed, 5 May 2021 14:10:29 +0000 (23:10 +0900)] 
hwdb: fix parser to execute test for ieee1394-unit-function with no argument

When given no arguments, hwdb parser script seeks test target files by
glob pattern. Although I added a new file for IEEE 1394 unit functions,
the file is excluded as test target due to the pattern.

This commit fixes it.

Fixes: 7713f3fc6a2 ("hwdb: add parser grammar for IEEE 1394 unit function list")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
5 years agobasic/time-util: use _cleanup_ in one more place 19514/head
Zbigniew Jędrzejewski-Szmek [Tue, 4 May 2021 17:10:15 +0000 (19:10 +0200)] 
basic/time-util: use _cleanup_ in one more place

5 years agoMake unit_name_to_instance() return UnitNameFlags
Zbigniew Jędrzejewski-Szmek [Tue, 4 May 2021 16:40:02 +0000 (18:40 +0200)] 
Make unit_name_to_instance() return UnitNameFlags

The function returns non-negative UnitNameFlags on success, and negative
errno on error. In the past we kept the return type as int because of those
negative return values. But nowadays _UNIT_NAME_INVALID == -EINVAL. And if
we tried to actually return something that doesn't fit in the return type,
the compiler would throw an error. By changing to the "real" return type,
we allow the debugger to use symbolic representation for the variables.

5 years agobootctl: take --make-machine-id-directory=yes|no|auto and make/remove \$MACHINE_ID... 19507/head
наб [Wed, 17 Mar 2021 17:58:07 +0000 (18:58 +0100)] 
bootctl: take --make-machine-id-directory=yes|no|auto and make/remove \$MACHINE_ID accordingly

auto resolves to yes if /etc/machine-id resides on non-tmpfs

This effectively reverts commit 31e57550b552e113bd3d44355b237c41e42beb58

5 years agocore,journald: use quoted commandlines 18863/head
Zbigniew Jędrzejewski-Szmek [Fri, 2 Apr 2021 12:11:10 +0000 (14:11 +0200)] 
core,journald: use quoted commandlines

I think quoting is more useful than not quoting. Without, arguments with
whitespace cannot be split correctly.

Unlike in coredump, "normal" quoting is used in those two cases. This output is
mostly for informational purposes, so the more readable quoting seems apropriate.

dbus GetProcesses:
$ busctl --user call org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/run_2dr4450e1ae73944194bb6593fcfd255fbe_2eservice org.freedesktop.systemd1.Service GetProcesses
a(sus) 2
"/user.slice/user-1000.slice/user@1000.service/app.slice/run-r4450e1ae73944194bb6593fcfd255fbe.service" 131494 "/usr/bin/bash -c \"sleep 100; sleep 20\""
"/user.slice/user-1000.slice/user@1000.service/app.slice/run-r4450e1ae73944194bb6593fcfd255fbe.service" 131496 "sleep 100"

5 years agocoredump: use "POSIX quotes" for cmdline
Zbigniew Jędrzejewski-Szmek [Fri, 2 Apr 2021 11:52:56 +0000 (13:52 +0200)] 
coredump: use "POSIX quotes" for cmdline

$ coredumpctl info |grep Command
  Command Line: bash -c kill -SEGV $$      (before)
  Command Line: bash -c "kill -SEGV \$\$"  (road not taken, C quotes)
  Command Line: bash -c $'kill -SEGV $$'   (now, POSIX quotes)

Before we wouldn't use any quoting, making it impossible to figure how the
command line was split into arguments. We could use "normal" quotes, but this
has the disadvantage that the commandline *looks* like it could be pasted into
the terminal and executed, but this is not true: various non-printable
characters cannot be expressed in this quoting style. (This is not visible in
this example). Thus, "POSIX quotes" are used, which should allow any command
line to be expressed acurrately and pasted directly into a shell prompt to
reexecute.

I wonder if we should another field in the coredump entry that simply shows the
original cmdline with embedded NULs, in the original /proc/*/cmdline
format. This would allow clients to format the data as they see fit. But I
think we'd want to keep the serialized form anyway, for backwards compatibility.

5 years agoman: add an example of coredumpctl output
Zbigniew Jędrzejewski-Szmek [Wed, 3 Mar 2021 14:30:04 +0000 (15:30 +0100)] 
man: add an example of coredumpctl output

People like examples. Also shows off the new quoted command line.

5 years agotest-process-util: add test that prints all cmdlines
Zbigniew Jędrzejewski-Szmek [Thu, 1 Apr 2021 14:46:01 +0000 (16:46 +0200)] 
test-process-util: add test that prints all cmdlines

5 years agobasic/process-util: add mode where posix shell escape is used for quoting
Zbigniew Jędrzejewski-Szmek [Wed, 10 Mar 2021 23:10:02 +0000 (00:10 +0100)] 
basic/process-util: add mode where posix shell escape is used for quoting

The new flag is not used, except in tests, so no functional change yet.

This way, the command as shown can be copied-and-pasted into the shell
in more cases. For simple cases, shell quoting with "" is enough. But
$'' is needed when there are control characters in the command.

5 years agotest-process-util: run fewer getpid() tests
Zbigniew Jędrzejewski-Szmek [Fri, 2 Apr 2021 09:44:48 +0000 (11:44 +0200)] 
test-process-util: run fewer getpid() tests

Significant time was spent in the getpid() measurement code, which is not very
important.  So let's optimize this a bit by running the slower version less
times, and only running both tests a lesser amount of times unless slow tests
are enabled.

This gives the better accuracy then before in slow mode, and still reasonable
accuracy in fast mode without a noticable slowdown.

5 years agotest-process-util: add more debug logging but hide most of it by default
Zbigniew Jędrzejewski-Szmek [Fri, 2 Apr 2021 09:35:23 +0000 (11:35 +0200)] 
test-process-util: add more debug logging but hide most of it by default

It makes little sense to always print the stuff that is fully deterministic
and verified by asserts. It can be opted-in with $SYSTEMD_LOG_LEVEL when
developing the tests or debugging a failure.

5 years agobasic/process-util: allow quoting of commandlines
Zbigniew Jędrzejewski-Szmek [Tue, 30 Mar 2021 17:42:36 +0000 (19:42 +0200)] 
basic/process-util: allow quoting of commandlines

Since the new functionality is controlled by an option, this causes no change
in output yet, except tests.

The login in the old branch of !(flags & PROCESS_CMDLINE_QUOTE) is essentially
unmodified. But there is an important difference in behaviour: instead of
unconditionally reading the whole virtual file, we now read only 'max_columns'
bytes. This makes out code to write process lists quite a bit more efficient
when there are processes with long command lines.

5 years agotest-utf8: hide most output by default
Zbigniew Jędrzejewski-Szmek [Fri, 2 Apr 2021 09:09:09 +0000 (11:09 +0200)] 
test-utf8: hide most output by default

Unless one is working on the code, there is little reason to write most
of the output. So let's hide it unless requested with SYSTEMD_LOG_LEVEL=debug.

5 years agobasic/escape: allow truncation mode where "…" is always appended
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 10:53:53 +0000 (12:53 +0200)] 
basic/escape: allow truncation mode where "…" is always appended

So far we would append "…" or "..." when the string was wider than the specified
output width. But let's add a mode where the caller knows that the string being
passed is already truncated.

The condition for jumping back in utf8_escape_non_printable_full() was
off-by-one. But we only jumped to that label after doing a check with a
stronger condition, so I think it didn't matter. Now it matters because we'd
output the forced ellipsis one column too early.

5 years agobasic/escape: flagsify xescape_full()
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 10:41:25 +0000 (12:41 +0200)] 
basic/escape: flagsify xescape_full()

5 years agotest-fileio: modernization
Zbigniew Jędrzejewski-Szmek [Thu, 1 Apr 2021 13:23:15 +0000 (15:23 +0200)] 
test-fileio: modernization

5 years agobasic/fileio: add a mode to read_full_virtual_file() where not the whole file is...
Zbigniew Jędrzejewski-Szmek [Thu, 1 Apr 2021 13:23:02 +0000 (15:23 +0200)] 
basic/fileio: add a mode to read_full_virtual_file() where not the whole file is read

5 years agoMerge pull request #19505 from jwrdegoede/hwdb-2-accel-quirks
Luca Boccassi [Wed, 5 May 2021 10:38:28 +0000 (11:38 +0100)] 
Merge pull request #19505 from jwrdegoede/hwdb-2-accel-quirks

hwdb: Add 2 new accel quirks

5 years agobasic/escape: escape control characters, but not utf-8, in shell quoting
Zbigniew Jędrzejewski-Szmek [Wed, 3 Mar 2021 13:56:23 +0000 (14:56 +0100)] 
basic/escape: escape control characters, but not utf-8, in shell quoting

The comment in the code said that so far this didn't matter, but I want to use
shell quoting in more places where this will make a difference. So control
characters are now escaped. Normal utf-8 characters are passed through, it
is 2021 after all and pretty much everyone is (or should be) using utf-8.

While touching the code, change 'char *r' → 'char *buf', in line with modern
style.

5 years agobasic/string-util: simplify how str_realloc() is used
Zbigniew Jędrzejewski-Szmek [Thu, 11 Mar 2021 10:40:57 +0000 (11:40 +0100)] 
basic/string-util: simplify how str_realloc() is used

All callers ignore failure anyway, so let's do that internally.

5 years agobasic/string-util: inline iterator variable declarations
Zbigniew Jędrzejewski-Szmek [Wed, 3 Mar 2021 13:36:24 +0000 (14:36 +0100)] 
basic/string-util: inline iterator variable declarations

5 years agobasic/string-util: split out helper function
Zbigniew Jędrzejewski-Szmek [Wed, 3 Mar 2021 13:35:55 +0000 (14:35 +0100)] 
basic/string-util: split out helper function

5 years agobasic/escape: always escape newlines in shell_escape()
Zbigniew Jędrzejewski-Szmek [Wed, 3 Mar 2021 12:47:55 +0000 (13:47 +0100)] 
basic/escape: always escape newlines in shell_escape()

shell_escape() is mostly used for mount paths and similar, where we assume
no newlines are present in the string. But if any were ever present, we
should escape them. So let's simplify the code by making this unconditional.

5 years agobasic/escape: add mode where empty arguments are still shown as ""
Zbigniew Jędrzejewski-Szmek [Wed, 3 Mar 2021 12:40:51 +0000 (13:40 +0100)] 
basic/escape: add mode where empty arguments are still shown as ""

For variables, FOO= is OK. But when quoting positional arguments, we want to
use something with quotes ("", '', or even $'') for an empty string.

5 years agoMerge pull request #19453 from keszybz/consider-instance-aliases
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 09:23:42 +0000 (11:23 +0200)] 
Merge pull request #19453 from keszybz/consider-instance-aliases

Consider instance aliases

5 years agoMerge pull request #19454 from keszybz/assorted-cleanups
Zbigniew Jędrzejewski-Szmek [Wed, 5 May 2021 09:06:33 +0000 (11:06 +0200)] 
Merge pull request #19454 from keszybz/assorted-cleanups

Assorted cleanups

5 years agotests: use "H" as the hostname
Zbigniew Jędrzejewski-Szmek [Tue, 4 May 2021 11:54:33 +0000 (13:54 +0200)] 
tests: use "H" as the hostname

"systemd-testsuite" gets in the way when grepping for "testsuite-*.sh".
Also, the name doesn't matter for anything, so let's just use something
very short to save space.

5 years agomeson: don't fail if latest tag's commit is signed
наб [Fri, 16 Apr 2021 11:00:37 +0000 (13:00 +0200)] 
meson: don't fail if latest tag's commit is signed

Today this is v248 with 938bdfc0fa737d86eb3ecc70506e11e5f740e0dc, which,
if you don't know about the github webflow key fails to configure with
  meson.build:724:8: ERROR:  String "gpg: Signature made Tue 30 Mar 2021 22:59:02 CEST\ngpg:                using RSA key 4AEE18F83AFDEB23\ngpg: Can't check signature: No public key\n1617137942\n" cannot be converted to int
or, if you do, with
  meson.build:724:8: ERROR:  String 'gpg: Signature made Tue 30 Mar 2021 22:59:02 CEST\ngpg:                using RSA key 4AEE18F83AFDEB23\ngpg: Good signature from "GitHub (web-flow commit signing) <noreply@github.com>" [unknown]\ngpg: WARNING: This key is not certified with a trusted signature!\ngpg:          There is no indication that the signature belongs to the owner.\nPrimary key fingerprint: 5DE3 E050 9C47 EA3C F04A  42D3 4AEE 18F8 3AFD EB23\n1617137942\n' cannot be converted to int

5 years agoTEST-15: add test for template aliases 19453/head
Zbigniew Jędrzejewski-Szmek [Thu, 29 Apr 2021 07:47:23 +0000 (09:47 +0200)] 
TEST-15: add test for template aliases

5 years agobasic/unit-file: fix detection of instance aliases
Zbigniew Jędrzejewski-Szmek [Wed, 28 Apr 2021 15:06:19 +0000 (17:06 +0200)] 
basic/unit-file: fix detection of instance aliases

We had the following scenario:
under /etc/systemd/system/
- foo@.service
- bar@tty12.service → foo@tty12.service
- multi-user.target.wants/foo@tty12.service

Existing code did not "know" that foo@tty12.service has alias bar@tty12.service:
$ systemctl show -P Names foo@tty12.service
foo@tty12.service

Since multi-user.target is always loaded, we would load foo@tty12.service.
When trying to load bar@tty12.service, it would (correctly) detect that
bar@tty12.service is an alias for foo@tty12.service, and try to merge the
bar@tty12.service unit into the foo@tty12.service. This would fail, because
foo@tty12.service was already loaded, and only about-to-be-loaded units can
be merged.

With the patch we consider bar@tty12.service an alias of foo@tty12.service
immediately, so the issue does not occur:
$ systemctl show -P Names foo@tty12.service
foo@tty12.service bar@tty12.service

Fixes #19409.

This turned in a bigger rewrite. The logic add "the main name and all aliases"
was implemented twice, slightly different in both cases. I split that part out
to a new function. The result about the same length, but hopefully a bit easier
to read.

Logging output is also improved a bit. Some left-over debug logs have been
removed or cleaned up.

This is a fairly big change, but (with the addition in the following commit),
we have pretty good coverage of this logic.

5 years agohwdb: Add accel orientation quirk for the Toshiba WT8-B tablet 19505/head
Hans de Goede [Tue, 4 May 2021 15:38:33 +0000 (17:38 +0200)] 
hwdb: Add accel orientation quirk for the Toshiba WT8-B tablet

Add a quirk to fix the accelerometer orientation on the Toshiba WT8-B
tablet.

5 years agohwdb: Add accel orientation quirk for the Glavey TM800A550L tablet
Hans de Goede [Wed, 28 Apr 2021 11:57:10 +0000 (13:57 +0200)] 
hwdb: Add accel orientation quirk for the Glavey TM800A550L tablet

Add a quirk to fix the accelerometer orientation on the Glavey TM800A550L
tablet.

5 years agoupdate TODO 19498/head
Lennart Poettering [Tue, 4 May 2021 14:01:00 +0000 (16:01 +0200)] 
update TODO

5 years agoselinux: use mallocinfo2() if it exists
Lennart Poettering [Mon, 3 May 2021 18:36:32 +0000 (20:36 +0200)] 
selinux: use mallocinfo2() if it exists

New glibc deprecated mallocinfo(), even newer glibc added mallocinfo2()
as replacement. Use it, if it exists.

Follow-up for 4b6f74f5a0943e0abfa8e6997811f8f7b7f00a15 and related
commits.

5 years agohostnamectl: fix hyperlink in "Operating System" field
Yu Watanabe [Tue, 4 May 2021 09:00:12 +0000 (18:00 +0900)] 
hostnamectl: fix hyperlink in "Operating System" field

This fixes a bug introduced by 822be62fb23ed0ec1062ffd18057e53f6c2f8c01.

Before this, if terminal width is not enough, the all subsequent lines
are included in the hyperlink.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1955475.

5 years agotree-wide: fix typo
Yu Watanabe [Tue, 4 May 2021 11:16:12 +0000 (20:16 +0900)] 
tree-wide: fix typo

5 years agocore/automount: drop unecessary cast 19454/head
Zbigniew Jędrzejewski-Szmek [Mon, 26 Apr 2021 21:54:32 +0000 (23:54 +0200)] 
core/automount: drop unecessary cast

5 years agocore/cgroup: remove some unnecessary variables
Zbigniew Jędrzejewski-Szmek [Mon, 26 Apr 2021 21:53:07 +0000 (23:53 +0200)] 
core/cgroup: remove some unnecessary variables

5 years agobasic/log: directly initialize iovec arrays
Zbigniew Jędrzejewski-Szmek [Mon, 26 Apr 2021 21:52:10 +0000 (23:52 +0200)] 
basic/log: directly initialize iovec arrays

It doesn't change much, but removes a bunch of explicit size and index handling
and unnecessary initializations.

5 years agobasic/io-util: move iterator variable declarations into loop headers
Zbigniew Jędrzejewski-Szmek [Mon, 26 Apr 2021 21:30:45 +0000 (23:30 +0200)] 
basic/io-util: move iterator variable declarations into loop headers

5 years agoresolved: directly initialize iovec array
Zbigniew Jędrzejewski-Szmek [Tue, 4 May 2021 12:49:47 +0000 (14:49 +0200)] 
resolved: directly initialize iovec array

5 years agobasic/io-util: invert return value from IOVEC_INCREMENT()
Zbigniew Jędrzejewski-Szmek [Mon, 26 Apr 2021 21:30:26 +0000 (23:30 +0200)] 
basic/io-util: invert return value from IOVEC_INCREMENT()

We would try to return a value that could be nonzero only if the kernel
reported writing more bytes than we gave to it, hopefully a rare occurence.
Instead, assert that this doesn't happen.

Instead, return true if we got to the end of the iovec array. The caller
can use this information to know that the whole iovec array was written.
This allows one loop to be dropped in write_to_syslog().

Also drop _unlikely_: this function is called with very short arrays, and
it *is* likely that we trigger this condition. Let's just let the compiler
generate normal code without giving it a potentially false hint.

5 years agocore: remove spurious % in dump string
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 08:52:30 +0000 (10:52 +0200)] 
core: remove spurious % in dump string

5 years agocore/cgroup: use assert_se() more
Zbigniew Jędrzejewski-Szmek [Wed, 7 Apr 2021 08:29:39 +0000 (10:29 +0200)] 
core/cgroup: use assert_se() more

5 years agocore: minor simplification
Zbigniew Jędrzejewski-Szmek [Sun, 21 Feb 2021 20:29:00 +0000 (21:29 +0100)] 
core: minor simplification

5 years agomeson: make one check shorter
Zbigniew Jędrzejewski-Szmek [Fri, 23 Apr 2021 12:20:14 +0000 (14:20 +0200)] 
meson: make one check shorter

5 years agotest-unit-file: enable colors
Zbigniew Jędrzejewski-Szmek [Thu, 29 Apr 2021 12:36:44 +0000 (14:36 +0200)] 
test-unit-file: enable colors

There's quite a lot of output and it's much easier to grok this way.

5 years agoTEST-15: add forgotten file cleanup
Zbigniew Jędrzejewski-Szmek [Thu, 29 Apr 2021 12:36:20 +0000 (14:36 +0200)] 
TEST-15: add forgotten file cleanup

5 years agomanager: emit a message when we fail to create manager because /run is not set up
Zbigniew Jędrzejewski-Szmek [Thu, 29 Apr 2021 11:33:33 +0000 (13:33 +0200)] 
manager: emit a message when we fail to create manager because /run is not set up

$ SYSTEMD_LOG_LEVEL=debug build/systemd --test --user
...
Failed to lookup RuntimeDirectory path: No such device or address   <---- this line is new
Failed to allocate manager object: No such device or address

We would fail and only say "Failed to allocate manager object: ENODEV" which is
not entirely self-explanatory. Let's add a better log message.

5 years agoTEST-15: use ${:?} and shorten things a bit
Zbigniew Jędrzejewski-Szmek [Thu, 29 Apr 2021 07:20:39 +0000 (09:20 +0200)] 
TEST-15: use ${:?} and shorten things a bit

5 years agotest: properly catch tests error with no /testok or empty /failed
Zbigniew Jędrzejewski-Szmek [Thu, 29 Apr 2021 07:13:12 +0000 (09:13 +0200)] 
test: properly catch tests error with no /testok or empty /failed

When editing this function in 7bf20e48bd7d641a39a14a7feb749b7e8, I couldn't
decide whether to initialize ret at the top and only reset it on success, or
whether to assign a value in each branch. In the end I did neither ;( So if the
test finished without creating any of the result files, we would echo a
message, but return "success".

But there was bigger confusion with /failed: some tests create it empty, some
don't. I think we may want to do away pre-creation of /failed completely, and
assume the test failed unless /testok is found. But I'm leaving that for later
rework. For now let's just make sure we report return success only if /testok
or /skipped is found.

5 years agoAdd correct rotation support for Mediacom Winpad 7.0 W700
imayoda [Mon, 3 May 2021 02:02:08 +0000 (04:02 +0200)] 
Add correct rotation support for Mediacom Winpad 7.0 W700

this patch enables correct bios detection and matrix for the aforementioned tiny tablet (touchscreen support commit pending now in kernel)
thnx

5 years agohostnamectl: deprecate set-* methods and expose getters by only using nouns in commands
Jakub Warczarek [Fri, 23 Apr 2021 18:41:45 +0000 (18:41 +0000)] 
hostnamectl: deprecate set-* methods and expose getters by only using nouns in commands

5 years agocore: apply LogLevelMax to messages about units
Ryan Hendrickson [Fri, 30 Apr 2021 16:47:10 +0000 (12:47 -0400)] 
core: apply LogLevelMax to messages about units

This commit applies the filtering imposed by LogLevelMax on a unit's
processes to messages logged by PID1 about the unit as well.

The target use case for this feature is a service that runs on a timer
many times an hour, where the system administrator decides that writing
a generic success message to the journal every few minutes or seconds
adds no diagnostic value and isn't worth the clutter or disk I/O.

5 years agoMerge pull request #19403 from nmeyerhans/dmi-entries
Lennart Poettering [Mon, 3 May 2021 15:48:13 +0000 (17:48 +0200)] 
Merge pull request #19403 from nmeyerhans/dmi-entries

virt: differentiate Amazon EC2 bare-metal from VM instances using SMBIOS data

5 years agoDocument the need to do journalctl --flush for persistent logging (#19481)
Luca Adrian L [Mon, 3 May 2021 15:08:25 +0000 (17:08 +0200)] 
Document the need to do journalctl --flush for persistent logging (#19481)

Document the need to do journalctl --flush for persistent logging. (fixes #19480)

Co-authored-by: Luca Lindhorst <l.lindhorst@wut.de>
5 years agoRevert "sysusers/firstboot: temporarily disable LoadCredential"
Luca Boccassi [Sun, 2 May 2021 15:05:48 +0000 (16:05 +0100)] 
Revert "sysusers/firstboot: temporarily disable LoadCredential"

This reverts commit 7c20dd4b6ef6e69862576722ac69b895d7a92dc9.

Debian has now been updated to patch the issue, so SemaphoreCI should
no longer fail. The fix has also been backported to the affected
stable branches.

5 years agoMerge pull request #19487 from mrc0mmand/test-all-services-in-TEST-01
Yu Watanabe [Mon, 3 May 2021 03:15:29 +0000 (12:15 +0900)] 
Merge pull request #19487 from mrc0mmand/test-all-services-in-TEST-01

test: don't mask "supporting" services in TEST-01-BASIC

5 years agotest: fix a yet another pipefail + pipe race
Frantisek Sumsal [Fri, 30 Apr 2021 11:26:54 +0000 (13:26 +0200)] 
test: fix a yet another pipefail + pipe race

Basically the same scenario as in
a33e2692e162671f0d97856ad2f49a2620a1ec10, where `awk` exits as soon
as it finds a match, thus sending SIGPIPE to `ldd` if it's not fast
enough. That, in combination with `set -o pipefail` causes random &
unexpected fails, like:

```
No journal files were found.
-rw-r----- 1 root root 16777216 Apr 30 10:31
/var/tmp/TEST-01-BASIC_sanitizers-nspawn/system.journal
TEST-01-BASIC RUN: Basic systemd setup [OK]
systemd is not linked against the ASan DSO
gcc does this by default, for clang compile with -shared-libasan
make: *** [Makefile:2: clean-again] Error 1
make: Leaving directory '/build/test/TEST-01-BASIC'
```

5 years agoMerge pull request #19476 from yuwata/network-can
Yu Watanabe [Sat, 1 May 2021 06:03:22 +0000 (15:03 +0900)] 
Merge pull request #19476 from yuwata/network-can

network: several CAN device related updates

5 years agoMerge pull request #18904 from yuwata/udev-watch
Yu Watanabe [Sat, 1 May 2021 06:02:43 +0000 (15:02 +0900)] 
Merge pull request #18904 from yuwata/udev-watch

udev: several inotify watch fixups

5 years agotest: explicitly pull resolved/networkd in TEST-01-BASIC 19487/head
Frantisek Sumsal [Fri, 30 Apr 2021 19:04:15 +0000 (21:04 +0200)] 
test: explicitly pull resolved/networkd in TEST-01-BASIC

to give them at least a basic coverage.

5 years agoUse BIOS characteristics to distinguish EC2 bare-metal from VMs 19403/head
Noah Meyerhans [Fri, 30 Apr 2021 16:30:52 +0000 (09:30 -0700)] 
Use BIOS characteristics to distinguish EC2 bare-metal from VMs

DMI vendor information fields do not provide enough information for us to
distinguish between Amazon EC2 virtual machines and bare-metal instances.
SMBIOS provides a BIOS Information
table (https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.4.0.pdf
Ch. 7) that provides a field to indicate that the current machine is a virtual
machine.  On EC2 virtual machine instances, this field is set, while bare-metal
instances leave this unset, so we inspect the field via the kernel's
/sys/firemware/dmi/entries interface.

Fixes #18929

5 years agomachine-id-setup: generate machine-id from DMI product ID on Amazon EC2
Bertrand Jacquin [Sun, 11 Oct 2020 21:25:56 +0000 (22:25 +0100)] 
machine-id-setup: generate machine-id from DMI product ID on Amazon EC2

Amazon EC2 Nitro hypervisor is technically based on KVM[1].

[1] https://aws.amazon.com/ec2/faqs/

5 years agotest: don't mask "supporting" services in TEST-01-BASIC
Frantisek Sumsal [Fri, 30 Apr 2021 19:02:41 +0000 (21:02 +0200)] 
test: don't mask "supporting" services in TEST-01-BASIC

This got lost during one of the code de-duplication attempts.

5 years agovirt: detect Amazon EC2 Nitro instance
Bertrand Jacquin [Sun, 11 Oct 2020 20:25:00 +0000 (21:25 +0100)] 
virt: detect Amazon EC2 Nitro instance

Amazon EC2 Nitro hypervisor is technically based on KVM[1], which
systemd-detect-virt identify propely from CPUID. However the lack of
CPUID on aarch64 (A1, T4 instance type) prevents a correct
identification, impacting hostnamectl and systemd-random-seed. Instead
it's possible to identify virtualization from DMI vendor ID.

Prior to this commit:
  # hostnamectl
     Static hostname: n/a
  Transient hostname: ip-10-97-8-12
           Icon name: computer
          Machine ID: 8e3772fbcfa3dd6f330a12ff5df5a63b
             Boot ID: b7b7e2fe0079448db664839df59f9817
    Operating System: Gentoo/Linux
              Kernel: Linux 5.4.69-longterm
        Architecture: arm64

After this commit:
  # hostnamectl
     Static hostname: n/a
  Transient hostname: ip-10-97-8-12
           Icon name: computer-vm
             Chassis: vm
          Machine ID: 8e3772fbcfa3dd6f330a12ff5df5a63b
             Boot ID: bd04da57084e41078f20541101867113
      Virtualization: amazon
    Operating System: Gentoo/Linux
              Kernel: Linux 5.4.69-longterm
        Architecture: arm64

[1] https://aws.amazon.com/ec2/faqs/

5 years agosd-bus: fix vtable named argument logic
Yu Watanabe [Thu, 29 Apr 2021 19:00:02 +0000 (04:00 +0900)] 
sd-bus: fix vtable named argument logic

Fixes #19468.

5 years agotest: add a simple test for udev watch 18904/head
Yu Watanabe [Sun, 7 Mar 2021 20:21:45 +0000 (05:21 +0900)] 
test: add a simple test for udev watch

5 years agotest: generate debugging logs for udev tests
Yu Watanabe [Sun, 7 Mar 2021 05:18:07 +0000 (14:18 +0900)] 
test: generate debugging logs for udev tests

5 years agotest: run udev tests after currently queued events are finished
Yu Watanabe [Wed, 10 Mar 2021 15:33:03 +0000 (00:33 +0900)] 
test: run udev tests after currently queued events are finished