1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 14:55:37 +03:00
Commit Graph

51125 Commits

Author SHA1 Message Date
Takashi Sakamoto
70fb7e5da5 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>
2021-05-05 23:10:29 +09:00
Takashi Sakamoto
78eb99c496 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>
2021-05-05 23:10:29 +09:00
Takashi Sakamoto
cc447b33f6 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>
2021-05-05 23:10:29 +09:00
Takashi Sakamoto
a9c6f9b8a6 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: 1b6d9a05b1 ("hwdb: add database entries for models with ASICs in BeBoB solution")
Fixes: 0db0564e95 ("hwdb: add database entries for models with Fireworks board module")
Fixes: 38338b302c ("hwdb: add database entries for models with OXFW970/971 ASICs")
Fixes: c0d8b61f93 ("hwdb: add database entries for models based on DICE ASICs with TCAT specification")
Fixes: a774b5099b ("hwdb: add database entries for models based on DICE ASICs specialized to M-Audio")
Fixes: ff1cb7b939 ("hwdb: add database entries for models based on DICE ASICs specialized to Weiss Engineering")
Fixes: 6f44dddbe2 ("hwdb: add database entries for models based on DICE ASICs specialized by Loud Technologies")
Fixes: 49ed0aad52 ("hwdb: add database entries for models based on DICE ASICs specialized by Harman Music Group")
Fixes: effbb4024b ("hwdb: add database entries for models based on DICE ASICs specialized by Solid State Logic")
Fixes: 4aaa093b5f ("hwdb: add database entries for models of Digidesign Digi 00x family")
Fixes: c489e7f9d3 ("hwdb: add database entries for Tascam FireWire series")
Fixes: 650b8967a5 ("hwdb: add database entries for MOTU FireWire series")
Fixes: 51e9242b9b ("hwdb: add database entries for RME Fireface series")
Fixes: a90a6a9ae9 ("hwdb: add database entries for Yamaha mLAN 2nd generation")
Fixes: 41f2d0d393 ("hwdb: add database entries for Yamaha mLAN 3rd generation")
Fixes: 1d2ee96292 ("hwdb: add database entries for Focusrite Liquid Mix series")
Fixes: 0c20543835 ("hwdb: add database entries for TC Electronic PowerCore FireWire series")
Fixes: 8b4b76dc50 ("hwdb: add database entry for node with single unit with video function")
Fixes: 12dd2404be ("hwdb: add database entries for node with multiple units")
Fixes: dece0357e1 ("hwdb: add database entries for node with single unit for multiple functions")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2021-05-05 23:10:29 +09:00
Takashi Sakamoto
5d66d89c42 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: 7713f3fc6a ("hwdb: add parser grammar for IEEE 1394 unit function list")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
2021-05-05 23:10:29 +09:00
Zbigniew Jędrzejewski-Szmek
c9816a9ac4 basic/time-util: use _cleanup_ in one more place 2021-05-05 15:08:48 +02:00
Zbigniew Jędrzejewski-Szmek
73ce91a05a 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.
2021-05-05 15:08:48 +02:00
наб
6a3fff75ba
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 31e57550b5
2021-05-05 14:35:00 +02:00
Zbigniew Jędrzejewski-Szmek
2f960b3858 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"
2021-05-05 13:59:23 +02:00
Zbigniew Jędrzejewski-Szmek
5dd55303f4 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.
2021-05-05 13:59:23 +02:00
Zbigniew Jędrzejewski-Szmek
4e3fbc133e man: add an example of coredumpctl output
People like examples. Also shows off the new quoted command line.
2021-05-05 13:59:23 +02:00
Zbigniew Jędrzejewski-Szmek
510c7a953e test-process-util: add test that prints all cmdlines 2021-05-05 13:59:23 +02:00
Zbigniew Jędrzejewski-Szmek
99009ed0f4 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.
2021-05-05 13:59:23 +02:00
Zbigniew Jędrzejewski-Szmek
07468a16e4 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.
2021-05-05 13:59:23 +02:00
Zbigniew Jędrzejewski-Szmek
daceaabe1f 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.
2021-05-05 13:59:23 +02:00
Zbigniew Jędrzejewski-Szmek
61977664e9 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.
2021-05-05 13:59:23 +02:00
Zbigniew Jędrzejewski-Szmek
82208a9949 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.
2021-05-05 13:59:23 +02:00
Zbigniew Jędrzejewski-Szmek
fc96e5c053 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.
2021-05-05 13:59:23 +02:00
Zbigniew Jędrzejewski-Szmek
b19f211698 basic/escape: flagsify xescape_full() 2021-05-05 13:59:23 +02:00
Zbigniew Jędrzejewski-Szmek
d12ccbc302 test-fileio: modernization 2021-05-05 13:59:23 +02:00
Zbigniew Jędrzejewski-Szmek
ad0e687c07 basic/fileio: add a mode to read_full_virtual_file() where not the whole file is read 2021-05-05 13:59:23 +02:00
Luca Boccassi
73e799387f
Merge pull request #19505 from jwrdegoede/hwdb-2-accel-quirks
hwdb: Add 2 new accel quirks
2021-05-05 11:38:28 +01:00
Zbigniew Jędrzejewski-Szmek
0089ab0800 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.
2021-05-05 12:12:42 +02:00
Zbigniew Jędrzejewski-Szmek
523e1b14a1 basic/string-util: simplify how str_realloc() is used
All callers ignore failure anyway, so let's do that internally.
2021-05-05 12:12:42 +02:00
Zbigniew Jędrzejewski-Szmek
a01080ceb3 basic/string-util: inline iterator variable declarations 2021-05-05 12:12:42 +02:00
Zbigniew Jędrzejewski-Szmek
6302d38609 basic/string-util: split out helper function 2021-05-05 12:12:42 +02:00
Zbigniew Jędrzejewski-Szmek
566d06ae50 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.
2021-05-05 12:12:42 +02:00
Zbigniew Jędrzejewski-Szmek
1129cd8a71 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.
2021-05-05 12:12:10 +02:00
Zbigniew Jędrzejewski-Szmek
b086a89695
Merge pull request #19453 from keszybz/consider-instance-aliases
Consider instance aliases
2021-05-05 11:23:42 +02:00
Zbigniew Jędrzejewski-Szmek
4c4c250563
Merge pull request #19454 from keszybz/assorted-cleanups
Assorted cleanups
2021-05-05 11:06:33 +02:00
Zbigniew Jędrzejewski-Szmek
ea0d33e2af 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.
2021-05-05 11:04:59 +02:00
наб
2d94502724
meson: don't fail if latest tag's commit is signed
Today this is v248 with 938bdfc0fa, 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
2021-05-04 20:08:59 +02:00
Zbigniew Jędrzejewski-Szmek
41b2d7ac1d TEST-15: add test for template aliases 2021-05-04 17:59:34 +02:00
Zbigniew Jędrzejewski-Szmek
fd22838734 basic/unit-file: fix detection of instance aliases
We had the following scenario:
under /etc/systemd/system/
- foo@.service
- bar@tty12.servicefoo@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.
2021-05-04 17:59:34 +02:00
Hans de Goede
bda6bfa5c1 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.
2021-05-04 17:38:33 +02:00
Hans de Goede
e0883f5350 hwdb: Add accel orientation quirk for the Glavey TM800A550L tablet
Add a quirk to fix the accelerometer orientation on the Glavey TM800A550L
tablet.
2021-05-04 17:36:52 +02:00
Lennart Poettering
8b25cab720 update TODO 2021-05-04 16:01:00 +02:00
Lennart Poettering
1885169c2f 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 4b6f74f5a0 and related
commits.
2021-05-04 16:00:53 +02:00
Yu Watanabe
8fc1efa88f hostnamectl: fix hyperlink in "Operating System" field
This fixes a bug introduced by 822be62fb2.

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.
2021-05-04 15:27:20 +02:00
Yu Watanabe
296c13dec4 tree-wide: fix typo 2021-05-04 15:03:04 +02:00
Zbigniew Jędrzejewski-Szmek
edb83bceec core/automount: drop unecessary cast 2021-05-04 14:57:49 +02:00
Zbigniew Jędrzejewski-Szmek
4c1f9343b2 core/cgroup: remove some unnecessary variables 2021-05-04 14:57:49 +02:00
Zbigniew Jędrzejewski-Szmek
905a0abd22 basic/log: directly initialize iovec arrays
It doesn't change much, but removes a bunch of explicit size and index handling
and unnecessary initializations.
2021-05-04 14:57:49 +02:00
Zbigniew Jędrzejewski-Szmek
2f9d1da95a basic/io-util: move iterator variable declarations into loop headers 2021-05-04 14:57:49 +02:00
Zbigniew Jędrzejewski-Szmek
cf1e6e6260 resolved: directly initialize iovec array 2021-05-04 14:57:49 +02:00
Zbigniew Jędrzejewski-Szmek
32f65484d7 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.
2021-05-04 14:57:49 +02:00
Zbigniew Jędrzejewski-Szmek
0f6bb1ed05 core: remove spurious % in dump string 2021-05-04 14:22:58 +02:00
Zbigniew Jędrzejewski-Szmek
806a93623c core/cgroup: use assert_se() more 2021-05-04 14:22:58 +02:00
Zbigniew Jędrzejewski-Szmek
431733b866 core: minor simplification 2021-05-04 14:22:58 +02:00
Zbigniew Jędrzejewski-Szmek
7e92ab4eb8 meson: make one check shorter 2021-05-04 14:22:58 +02:00