1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 01:27:11 +03:00
Commit Graph

33139 Commits

Author SHA1 Message Date
Lennart Poettering
8e766630f0 tree-wide: drop redundant _cleanup_ macros (#8810)
This drops a good number of type-specific _cleanup_ macros, and patches
all users to just use the generic ones.

In most recent code we abstained from defining type-specific macros, and
this basically removes all those added already, with the exception of
the really low-level ones.

Having explicit macros for this is not too useful, as the expression
without the extra macro is generally just 2ch wider. We should generally
emphesize generic code, unless there are really good reasons for
specific code, hence let's follow this in this case too.

Note that _cleanup_free_ and similar really low-level, libc'ish, Linux
API'ish macros continue to be defined, only the really high-level OO
ones are dropped. From now on this should really be the rule: for really
low-level stuff, such as memory allocation, fd handling and so one, go
ahead and define explicit per-type macros, but for high-level, specific
program code, just use the generic _cleanup_() macro directly, in order
to keep things simple and as readable as possible for the uninitiated.

Note that before this patch some of the APIs (notable libudev ones) were
already used with the high-level macros at some places and with the
generic _cleanup_ macro at others. With this patch we hence unify on the
latter.
2018-04-25 12:31:45 +02:00
Lennart Poettering
0d6f0ea6c1
Merge pull request #8807 from ChrisLesiak/systemd-update-done-mtime-fix
fileio.c: fix incorrect mtime
2018-04-25 02:14:54 +02:00
Zbigniew Jędrzejewski-Szmek
722df70f10
Merge pull request #8775 from poettering/strip-cso
teach strip_tab_ansi() to strip ANSI CSO sequences
2018-04-24 20:57:56 +02:00
Lennart Poettering
81183d9b99
Merge pull request #8802 from keszybz/errno-reform
Errno reform
2018-04-24 20:25:27 +02:00
Chris Lesiak
be83711c7e fileio.c: fix incorrect mtime
A regression was introduced that caused the mtime of /etc/.updated
and /var/.updated to be the current time when systemd-update-done
ran instead of being copied from /usr.

This was nearly fixed, but due to fflush being called after mtime
was carefully set, it was overwritten with the current time.

Regression introduced in 872c403963

A fix was just missed in 39c38d773f

Fixes #8806
2018-04-24 11:18:43 -05:00
Lennart Poettering
9dfcc1df07
Merge pull request #8800 from keszybz/trivialities
Trivial cleanups
2018-04-24 17:30:07 +02:00
Lennart Poettering
9ea41a9bda
Merge pull request #8801 from fbuihuu/tmpfiles-fixes
Tmpfiles fixes
2018-04-24 17:29:10 +02:00
Lennart Poettering
e44924f5c1 update TODO 2018-04-24 15:58:31 +02:00
Lennart Poettering
c7e03d2e67 string-util: use fflush_and_check() where appropriate 2018-04-24 15:58:31 +02:00
Lennart Poettering
695a944c64 string-util: teach strip_tab_ansi() to deal with CSO sequences
With the recent terminal_urlify() APIs we'll now sometimes generate
clickable link CSO sequences. Hence we should also be able to remove
them again from strings. This beefs up the logic to do so.

Follow-up for: 23b27b39d2
2018-04-24 15:58:31 +02:00
Zbigniew Jędrzejewski-Szmek
b29f6480ec basic/log: do not use global errno in log_*_errno()
Quoting https://github.com/systemd/systemd/pull/8760#discussion_r183321060:

> When we originally added the errno patching we went for a "best of both
> worlds" approach, i.e. that we override errno if an error is specified, but
> if no error is specified (i.e. 0 is passed as error code) then we use the
> previously set errno, similar in style how plain `printf()` would do it. In
> retrospect I think we almost never purposefully made use of the second,
> i.e. the plain `printf()` logic, but we multiple times ran into this case
> accidentally and introduced a bug. Hence yes, it probably makes sense to
> switch this over, and consistently ignore the `errno` already set and always
> override it with the error passed in. The only problem I see with that is: I
> wonder if there might be a case or two lurking somewhere where we actually
> made use of the "best of both worlds" approach, and if so, if we can detect
> where... (But then again, even if there is, and we fail to find those cases,
> maybe that's not all bad, as it's just a few new bugs against probably fixing
> many more old and future bugs, if you follow what I mean).

I scanned our codebase, and found some bugs in the value passed to log_*_errno,
but no intentional cases of error=0 being passed.
2018-04-24 14:10:27 +02:00
Zbigniew Jędrzejewski-Szmek
a1bcaa075b core/device: avoid bogus errno use and invert ratelimit_test()
I'm not sure if I understand the original code. AFAICS, errno does not
have to be set at all in this callback.

ratelimit_test() returns positive if we are under limit. The code would only
log if the condition happened very often, which I assume is not inteded, and
this check was supposed to prevent too much logging.
2018-04-24 14:10:27 +02:00
Zbigniew Jędrzejewski-Szmek
bb1d9534ae sd-lldp: eliminate unnecessary variable 2018-04-24 14:10:27 +02:00
Zbigniew Jędrzejewski-Szmek
13bb68bbe3 basic/audit-util: always log the reason when disabling audit logs
This state is cached, and it's seems OK to log at least once.
2018-04-24 14:10:27 +02:00
Zbigniew Jędrzejewski-Szmek
4355f1c9da Fix three uses of bogus errno value in logs (and returned value in one case) 2018-04-24 14:10:27 +02:00
Zbigniew Jędrzejewski-Szmek
b1c05b98bf tree-wide: avoid assignment of r just to use in a comparison
This changes
  r = ...;
  if (r < 0)
to
  if (... < 0)
when r will not be used again.
2018-04-24 14:10:27 +02:00
Zbigniew Jędrzejewski-Szmek
9169e4c7ba Revert "bus-unit-util: fix bus_wait_for_jobs() debug output (#8760)"
This reverts commit d6b87637c5.

Let's try a different approach.
2018-04-24 14:09:53 +02:00
Franck Bui
939ca21363 tmpfiles: 'e' is supposed to accept shell-style globs 2018-04-24 12:24:38 +02:00
Franck Bui
d460ba18e7 tmpfiles: 'e' is supposed to operate on directory only 2018-04-24 12:23:29 +02:00
Zbigniew Jędrzejewski-Szmek
7ccf760381 systemd-hwdb: reflow help() to avoid a line break 2018-04-24 12:11:10 +02:00
Zbigniew Jędrzejewski-Szmek
5b24525a89 CGROUP_DELEGATION: typo and grammar fixes 2018-04-24 12:07:34 +02:00
Franck Bui
4dfaa528d4 fs-util: introduce fchmod_opath()
fchmod(2) still doesn't take file descriptors opened with O_PATH.
2018-04-24 11:57:48 +02:00
Franck Bui
7b887f2284 tmpfiles: remove spurious curly braces in create_item() 2018-04-24 11:57:48 +02:00
Zbigniew Jędrzejewski-Szmek
a1113e0865 core/manager: make manager_enumerate() static 2018-04-24 11:44:19 +02:00
Zbigniew Jędrzejewski-Szmek
94b01dae47 core/manager: trivial simplification 2018-04-24 11:44:19 +02:00
Milan
679def2a06 nspawn: fix copy/reflink fallback when directory already exists (#8781) 2018-04-24 11:38:08 +02:00
Lennart Poettering
46c5cf49e1
Merge pull request #8796 from yuwata/remove-unused-variables
Remove unused variables
2018-04-24 11:37:44 +02:00
Yu Watanabe
c9825701e6 test: drop unused variables
Follow-up for 49eb36596b.
2018-04-24 15:43:41 +09:00
Yu Watanabe
38d7f50632 login: drop an unused variable
Follow-up for 99f1229d76.
2018-04-24 15:42:03 +09:00
Paul Menzel
33ce73f66c man/os-release: Document that blank lines are permitted (#8777)
Fixes: https://github.com/systemd/systemd/issues/8773
2018-04-23 11:03:16 +02:00
Paul Milliken
0a186735c9 hwdb: Add accelerometer orientation quirk for the Linx 1010B tablet (#8784) 2018-04-23 10:49:54 +02:00
Kai-Heng Feng
cab01e9ecf hwdb: Use wlan keycode for all Dell systems (#8762)
Once the seat is acquired, gnome-settings-daemon (GSD) takes full
control of rfkill by sending RFKILL_IOCTL_NOINPUT ioctl to disable
rfkill control in kernel.

Since GSD expects wlan keycode when the hotkey gets pressed, we should
change the "unknown" to "wlan" accordingly.

Tested under both GNOME and KDE.
2018-04-23 10:23:03 +02:00
Yu Watanabe
41d0da0f6a doc: add $SYSTEMD_TIMEDATED_NTP_SERVICES= in ENVIRONMENT.md (#8785) 2018-04-23 10:14:15 +02:00
Yu Watanabe
162c875513 bus-message: use streq_ptr() (#8786) 2018-04-23 10:13:26 +02:00
Muhammet Kara
44d4d85813 po: update Turkish translation (#8783) 2018-04-23 10:12:03 +02:00
Zbigniew Jędrzejewski-Szmek
951a44ea15
Merge pull request #8520 from drinkcat/upstream-udevadm
udevadm/hwdb: Return non-zero exit code on error
2018-04-23 09:37:17 +02:00
Mario Limonciello
b0d70534de hoestnamed: Also parse HOME_URL from /usr/lib/os-release (#8779)
64928aa545 added parsing to
/etc/os-release.
2018-04-23 09:24:39 +02:00
Zbigniew Jędrzejewski-Szmek
d2bc13bde8
Merge pull request #8675 from fbuihuu/make-sure-device-enter-in-plugged-state
device: make sure to always retroactively start device dependencies
2018-04-23 09:14:42 +02:00
Yu Watanabe
80f0048203
Merge pull request #8769 from keszybz/followups
Three trivial followups for recent patches
2018-04-23 10:24:39 +09:00
Lennart Poettering
d6b87637c5 bus-unit-util: fix bus_wait_for_jobs() debug output (#8760)
We shouldn't print 'errno' if its not initialized properly.
2018-04-23 09:24:43 +09:00
Nicolas Boichat
aacbcab66d systemd-hwdb update: Return non-zero exit code on error when --strict is used
- Add a new flag --strict to tell systemd-hwdb to return a
   non-zero code on error.
 - Make systemd-hwdb update return an error when any parsing
   error occurs (only if strict flag is set).
2018-04-23 08:07:27 +08:00
Nicolas Boichat
dd6f840e36 udevadm/hwdb: Return non-zero exit code on error when --strict is used
- Add a new flag --strict to tell udevadm hwdb to return a
   non-zero code on error.
 - Make udevadm hwdb --update return an error when any parsing
   error occurs (only if strict flag is set).
2018-04-23 07:53:33 +08:00
Lennart Poettering
4f4ef6a099
Merge pull request #8778 from poettering/cgroup-delegation-doc
some docs regarding cgroup delegation and systemd
2018-04-20 20:24:10 +02:00
Lennart Poettering
e30eaff3a3 doc: add a bit more documentation about systemd and cgroups and cgroupsv2 and delegation
Ultimately we should replace the relevant wiki texts with documentation
maintained as part of our project tree. This is a start. It can't
replace the wiki documentation in full yet, but I think it's already
very useful.
2018-04-20 20:22:05 +02:00
Lennart Poettering
070d0ac9cf update TODO 2018-04-20 20:01:08 +02:00
Franck Bui
036d2eefae device: skip deserialization of device units when udevd is not running
Do not try to party initialize a device during deserialization if it's not
known by udev (anymore) and therefore hasn't been seen during device
enumeration.

The device unit in this case has not been initialized properly and setting it
in the "plugged" state can be confusing.

Actually this happens during every boots when PID switches to the new rootfs:
PID is reexecuted and enumerates devices but since udev is not running, the
list of enumerated devices is empty.
2018-04-20 17:49:28 +02:00
Franck Bui
918e6f1c01 device: make sure to always retroactively start device dependencies
PID1 updates the state of device units upon 2 different events:

 - when it processes an event sent by udev and in this case the device deps are
   started if the device enters in the "plugged" state.

 - when it enumerates all devices during its startup or when it is asked to
   reload its configuration data but in this case the device deps (if any) are
   not retroactively started.

When udev processes a new "add" kernel event, it first registers the new device
in its databases then sends an event to systemd.

If for any reason, systemd is asked to reload its configuration between the
previous 2 steps, it might see for the first time the new device while scanning
/sys for all devices. Only during a second step, udev will send the event for
the new device.

In this peculiar case the device deps wont be started (even though the device
is first seen by PID1).

Indeed when reloading its configurations, PID1 will put the device unit in the
"plugged" state but without starting the device deps. Thereafter PID1 will get
the event from udev for the new device but the device unit will be in "plugged"
state already therefore it won't see any need to start the device dependencies.

Rather than assuming that during the reloading of systemd manager configuration
all devices listed in udev DBs have been already processed and should be put in
the "plugged" state (done by device_coldplug()), this patch does that only for
devices which have been processed via an udev event (device_dispatch_io())
previously. In this case we set "d->found" to "DEVICE_FOUND_UDEV" and we make
also sure to no more initialize "d->found" while enumerating devices. Instead
this field is now saved/restored while devices are serialized.
2018-04-20 17:49:28 +02:00
Tobias Jungel
4c3879863a networkd: more specific link down while enslaving (#8771)
Issue #5853 introduced a link_down for every netdev enslaved. This behaviour is
not required on other slave interfaces.

fixes 14b6bb7
2018-04-20 16:30:40 +02:00
Zbigniew Jędrzejewski-Szmek
60e9682a80 man: document the new $SYSTEMD_DEBUGGER variable
Follow-up for c5896b6a.
2018-04-20 15:56:52 +02:00
Zbigniew Jędrzejewski-Szmek
340ac01986 sysusers: use uniform order for variables
Follow-up for 43e948eea6.
2018-04-20 15:56:52 +02:00