1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 16:59:03 +03:00
Commit Graph

33148 Commits

Author SHA1 Message Date
Lennart Poettering
4d7c3570a6 missing: add IPV4_MIN_MTU
Similar to IPV6_MIN_MTU, let's add the same for IPv4.
2018-04-26 13:51:44 +02:00
Lennart Poettering
ba68a35958 networkd: drop duplicate definition of IPV6_MIN_MTU
We already have it in missing.h, and once suffices.
2018-04-26 13:51:44 +02:00
Antique
96aa6591d1 cgroup-util: fix enabling of controllers (#8816)
If enabling controller for some reason fails we need to clear error
for the FILE stream.  Enabling remaining controllers would otherwise
fail because write_string_stream_ts() checks for ferror(f) and returns
-EIO if there is one.

Broken by commit <77fa610b22>.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-04-26 12:37:35 +02:00
Yu Watanabe
8ac42236b0 meson: drop 'name' argument in cc.has_argument() (#8823)
This fixes the following warning with clang and meson-0.46.0,
```
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
Compiler for C supports arguments -Wno-typedef-redefinition: YES
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
WARNING: Passed invalid keyword argument "name".
WARNING: This will become a hard error in the future.
Compiler for C supports arguments -Wno-gnu-variable-sized-type-not-at-end: YES
```
2018-04-26 10:53:10 +02:00
Yu Watanabe
ad628501b9 man: fix description of --value option for loginctl (#8820) 2018-04-26 09:51:11 +02:00
Lennart Poettering
2de2337518
Merge pull request #8812 from keszybz/gpt-auto-memleak
gpt-auto-generator: use stack variables and fix minor memleak
2018-04-25 15:46:57 +02:00
Zbigniew Jędrzejewski-Szmek
22ce84de18 meson: do not link libsystemd_static into libcore (#8813)
(or in terms of the names of the actual files on disk, do not link
libsystemd-shared-238.a into libcore.a).

libsystemd_static is linked into libsystemd_shared, which in turn means that
anything that links to libcore and libsystemd_shared will get libsystemd_static
twice:

$ cc -o systemd 'systemd@exe/src_core_main.c.o' -Wl,--no-undefined -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -pie -DVALGRIND -Wl,--start-group src/core/libcore.a src/shared/libsystemd-shared-238.a src/shared/libsystemd-shared-238.so -pthread -lrt -lseccomp -lselinux -lmount -lblkid -Wl,--end-group -lseccomp -lpam -L/lib64 -laudit -lkmod -lmount -lrt -lcap -lacl -lcryptsetup -lgcrypt -lip4tc -lip6tc -lseccomp -lselinux -lidn -llzma -llz4 -lblkid '-Wl,-rpath,$ORIGIN/src/shared' -Wl,-rpath-link,/home/zbyszek/src/systemd/build/src/shared

This propagation of the dependency seems correct (in the sense that meson is
doing the expected thing based on the given configuration). Linking was done
this way in the original meson conversion. I was probably trying to get
everything to compile and link, I'm not sure why this particular choice was
made. In the meantime, meson has gotten better at propagating dependencies, so
it's possible that this had slightly different effect in the original
conversion, but I did not verify this. Either way, I think we should drop this.

With the patch:
$ cc -o systemd 'systemd@exe/src_core_main.c.o' -Wl,--no-undefined -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -pie -DVALGRIND -Wl,--start-group src/core/libcore.a src/shared/libsystemd-shared-238.so -pthread -lrt -lseccomp -lselinux -lmount -Wl,--end-group -lblkid -lrt -lseccomp -lpam -L/lib64 -laudit -lkmod -lselinux -lmount '-Wl,-rpath,$ORIGIN/src/shared' -Wl,-rpath-link,/home/zbyszek/src/systemd/build/src/shared

This is more correct because we're not linking the same code twice.
With the patch, libystemd_static is used in exactly four places:
- src/shared/libsystemd-shared-238.so
- src/udev/libudev.so.1.6.10
- pam_systemd.so
- test-bus-error
(compared to a bunch more executables before, including systemd,
systemd-analyze, test-hostname, test-ns, etc.)

Size savings are also noticable:

$ size /var/tmp/inst?/usr/lib/systemd/libsystemd-shared-238.so
   text	   data	    bss	    dec	    hex	filename
2397826	 578488	  15920	2992234	 2da86a	/var/tmp/inst1/usr/lib/systemd/libsystemd-shared-238.so
2397826	 578488	  15920	2992234	 2da86a	/var/tmp/inst2/usr/lib/systemd/libsystemd-shared-238.so

$ size /var/tmp/inst?/usr/lib/systemd/systemd
   text	   data	    bss	    dec	    hex	filename
1858790	 261688	   9320	2129798	 207f86	/var/tmp/inst1/usr/lib/systemd/systemd
1556358	 258704	   8072	1823134	 1bd19e	/var/tmp/inst2/usr/lib/systemd/systemd

$ du -s /var/tmp/inst?
52216	/var/tmp/inst1
50844	/var/tmp/inst2

https://github.com/google/oss-fuzz/issues/1330#issuecomment-384054530 might be related.
2018-04-25 13:47:18 +02:00
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
Zbigniew Jędrzejewski-Szmek
e137880b2a gpt-auto-generator: emit warnings and fail if we fail to query mount points
Right now gpt-auto-generator will iterate through all mount entries, and
silently ignore failure to check if the mount point target is empty.
This can hide real errors (in particular from MAC), so instead let's warn
and return failure at the end if this happens. We will still iterate
over other candidates, so there should be no change in behaviour.

Logging is moved into path_is_busy() to avoid the duplication of the same
logging code in the two callers.
2018-04-25 12:22:06 +02:00
Zbigniew Jędrzejewski-Szmek
2aa2860bc3 gpt-auto-generator: use stack variables and fix minor memleak 2018-04-25 09:45:28 +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