Commit Graph

28177 Commits

Author SHA1 Message Date
Lennart Poettering 33bac67b48 update TODO 2017-02-06 20:26:33 +01:00
Lennart Poettering d543b9f586 update TODO 2017-02-06 18:37:28 +01:00
Lukas Rusak 0f92383243 systemd-mount: add missing fsck argument (#5238) 2017-02-06 14:25:15 +01:00
Lennart Poettering 9194199c98 Merge pull request #5237 from keszybz/explicit-bzero
Use `explicit_bzero`
2017-02-06 13:35:56 +01:00
Zbigniew Jędrzejewski-Szmek 65c8834942 cgls: look at the right variable in error path (#5234)
CID #1370779.
2017-02-06 13:34:01 +01:00
Zbigniew Jędrzejewski-Szmek 1075122f42 journalctl: replace string_erase with memset('x')
The compiler should not be able to optimize out the memset, because optarg is global
memory. In this case, not making the argument an empty string is nicer, so just use
an open-coded version of string_erase from before the explicit_bzero change.
2017-02-05 21:07:55 -05:00
Zbigniew Jędrzejewski-Szmek 2d26d8e07e treewide: replace homegrown memory_erase with explicit_bzero
explicit_bzero was added in glibc 2.25. Make use of it.

explicit_bzero is hardcoded to zero the memory, so string erase now
truncates the string, instead of overwriting it with 'x'. This causes
a visible difference only in the journalctl case.
2017-02-05 21:07:55 -05:00
Felipe Sateler 52e634271f resolved: downgrade "processing query..." message to debug (#5233)
It doesn't really add much value in normal operation and just spams the log.
2017-02-05 17:17:50 -05:00
Martin Pitt d2697a95fe Merge pull request #5223 from keszybz/root-workdir
Fix WorkDir=~ with empty User=
2017-02-05 22:31:02 +01:00
Zbigniew Jędrzejewski-Szmek d20a328f97 build-sys,man: describe systemd-umount and hook it up to installation (#5227) 2017-02-05 22:27:38 +01:00
Evgeny Vereshchagin 1b52793d5d seccomp: don't ever try to add an ABI before removing the default native ABI (#5230)
https://github.com/systemd/systemd/issues/5215#issuecomment-277156262

libseccomp does not allow you to add architectures to a filter that
doesn't match the byte ordering of the architectures already added to
the filter (it would be a mess, not to mention largely pointless) and
since systemd attempts to add an ABI before removing the default native
ABI, you will always fail on Power (either due to ppc or ppc64le). The
fix is to remove the native ABI before adding a new ABI so you don't run
into problems with byte ordering.

You would likely see the same failure on a MIPS system.

Thanks @pcmoore!
2017-02-05 11:58:19 -05:00
Sergey Ptashnick 2604f8270c catalog: update Russian translation (#5232) 2017-02-05 11:56:47 -05:00
Zbigniew Jędrzejewski-Szmek 382852fd58 core/timer: downgrade message about random time addition (#5229)
This seems like something that shouldn't be higher then debug level, even
if it does not get emitted too often.

Fixes #5228.
2017-02-05 09:37:46 +01:00
Zbigniew Jędrzejewski-Szmek cfe5b07106 Silence two "unused function af_lookup" warnings (#5222)
Gcc7 is smarter about detecting unused functions and detects those two functions
which are unused in tests. But gperf generates them for us, so let's instead of removing
tell gcc that we know they might be unused in the test code.

In file included from ../src/test/test-af-list.c:29:0:
./src/basic/af-from-name.h:140:1: warning: ‘lookup_af’ defined but not used [-Wunused-function]
 lookup_af (register const char *str, register size_t len)
 ^~~~~~~~~
In file included from ../src/test/test-arphrd-list.c:29:0:
./src/basic/arphrd-from-name.h:125:1: warning: ‘lookup_arphrd’ defined but not used [-Wunused-function]
 lookup_arphrd (register const char *str, register size_t len)
 ^~~~~~~~~~~~~
2017-02-04 10:25:20 -05:00
Lukas Rusak c37fb55bd8 systemd-mount features and improvements (#5067)
systemd-mount --unmount /some/path
systemd-mount --umount /some/path
systemd-mount -u /some/path
systemd-unmount /some/path
all do the same thing that one could expect from the name.
2017-02-04 10:21:49 -05:00
Martin Pitt b4a8c5ddb1 Merge pull request #4973 from poettering/run-race
run: fix race for "systemd-run --wait"
2017-02-03 18:44:42 +01:00
Martin Pitt 63927b9f4c man: clarify interface for suspend/resume integration (#5220)
Fixes #4916.
2017-02-03 12:11:37 -05:00
Zbigniew Jędrzejewski-Szmek 6a93917df9 core/execute: pass the username to utmp/wtmp database
Before previous commit, username would be NULL for root, and set only
for other users. So the argument passed to utmp_put_init_process()
would be "root" for other users and NULL for root. Seems strange.
Instead, always pass the username if available.
2017-02-03 11:49:43 -05:00
Zbigniew Jędrzejewski-Szmek 8b89628a10 core/execute: set HOME, USER also for root users
This changes the environment for services running as root from:

LANG=C.utf8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
INVOCATION_ID=ffbdec203c69499a9b83199333e31555
JOURNAL_STREAM=8:1614518

to

LANG=C.utf8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
HOME=/root
LOGNAME=root
USER=root
SHELL=/bin/sh
INVOCATION_ID=15a077963d7b4ca0b82c91dc6519f87c
JOURNAL_STREAM=8:1616718

Making the environment special for the root user complicates things
unnecessarily. This change simplifies both our logic (by making the setting
of the variables unconditional), and should also simplify the logic in
services (particularly scripts).

Fixes #5124.
2017-02-03 11:49:22 -05:00
Benjamin Robin d201d90838 time-util: Fix overflow check introduce in commit f977849 (#5216) 2017-02-03 16:13:55 +01:00
Lennart Poettering 95f1d6bfec run: exit early in --pty if service failed
This reworks systemd-run so that in --pty mode we watch the unit state
the way we do it in --wait mode. Whenever we notice that the service is
in failed or inactive state finish right-away, but first write all
unwritten characters we can read from the master TTY device.

This makes sure that when the TTY service fails before it opens the
slave PTY device we properly notice that and exit early, so that borked
start parameters result in immediate systemd-run failure. Previously,
we'd not notice this at all, as a PTY slave that never was opened won't
result in POLLHUP events, and we'd hence simply keep reading from it
forever.

In essence, --pty now enables the same unit watching logic that --wait
enables. However, unless --wait is specified we won#t show the final
summary, hence the effective difference should be pretty minimal.

Fixes: #3915
2017-02-03 11:51:57 +01:00
Lennart Poettering 9182fb52ac run: explicitly close pty forwarder before printing summary
If the PTY forwarder is still around our TTY will have borked settings,
regarding newlines, hence explicitly close it before showing the
summary, so that it looks pretty.
2017-02-03 11:51:57 +01:00
Lennart Poettering 578c03bce0 run: complain when --pty is used together with --no-block, which makes no sense 2017-02-03 11:51:57 +01:00
Lennart Poettering 8f5c235d9e sd-event: when an event source fails, don't assume the type of it is still set
If a callback of an event source returns an error, then the event source
might already be half-destroyed, if the callback dropped all refs.
Hence, don't assume that the type is still valid, and save it before we
issue the callback.
2017-02-03 11:51:57 +01:00
Lennart Poettering 5c1d991f40 Merge pull request #5213 from keszybz/systemctl-root-cat
Two fixes to path lookup when --root is used
2017-02-03 11:02:28 +01:00
Mirza Krak ce283b8887 rules: allow systemd to manage UBI volumes (#5214)
UBI is a software layer on top of MTD devices that is used with flash
chips.
2017-02-03 09:26:50 +01:00
afrantzis 7d049e304e logind: Don't try to emit a change signal for the 'Sessions' property (#5211)
The 'Sessions' property for both org.freedesktop.login1.User and
org.freedesktop.login1.Seat is marked as EmitsChangedSignal(false).
Trying to emit a change signal that includes the 'Sessions' property
leads to the signal not being sent at all.

Fixes #5210.
2017-02-02 20:39:26 -05:00
Zbigniew Jędrzejewski-Szmek 2341216ad7 Merge pull request #5212 from poettering/time-range
time handling fixes
2017-02-02 20:36:18 -05:00
Lennart Poettering 9a1c8f2d24 ptyfwd: set event source description strings for all event sources of a ptyfwd object 2017-02-02 20:59:43 +01:00
Lennart Poettering 5b1bad8d45 run: fix race for "systemd-run --wait"
D-Bus is inherently racy when a function returns an object path for a
newly allocated object the client shall watch: as the object already
exists before the client can subscribe to it, it might lose messages
from it.

Let's fix this, by explicitly querying unit properties right after
subscribing to its property changes.

Fixes: #4920
2017-02-02 20:59:43 +01:00
Lennart Poettering ed737400c2 cgls: --machine= expects an argument, indicate that in log messages
We gnerally suffix file settings and cmdline options that expect ags
with "=" to indicate that. Do so here, too.
2017-02-02 20:12:32 +01:00
Lennart Poettering 315782db14 time-util: add overflow checking to monotonic timestamp specifications 2017-02-02 20:12:32 +01:00
Lennart Poettering 74c5b33b0a time-util: when formatting usec_t as raw integers use PRIu64
After all, usec_t is defined as uint64_t, and not as unsigned long long.
2017-02-02 20:12:31 +01:00
Lennart Poettering f977849c24 time-util: when converting to time_t do something useful in 2038
On systems where time_t is 32bit we should invalidate the
timeval/timespec instead of proceeding with a potentially overflown
value.
2017-02-02 20:12:31 +01:00
Lennart Poettering 1bb4b028a3 time-util: refuse formatting/parsing times that we can't store
usec_t is always 64bit, which means it can cover quite a number of
years. However, 4 digit year display and glibc limitations around time_t
limit what we can actually parse and format. Let's make this explicit,
so that we never end up formatting dates we can#t parse and vice versa.

Note that this is really just about formatting/parsing. Internal
calculations with times outside of the formattable range are not
affected.
2017-02-02 20:12:31 +01:00
Lennart Poettering c477ff141b time: time_t is signed, and mktime() is happy to return negative time
Passing a year such as 1960 to mktime() will result in a negative return
value. This is quite confusing, as the man page claims that on failure
the call will return -1...

Given that our own usec_t type is unsigned, and we can't express times
before 1970 hence, let's consider all negative times returned by
mktime() as invalid, regardless if just -1, or anything else negative.
2017-02-02 20:12:31 +01:00
Lennart Poettering ced58da749 nspawn: shown exec() command is misleading
There's no point in updating exec_target for each binary we try to
execute, if we override it right-away anyway... Let's just do this once,
and include all binaries we try each time.

Follow-up for 1a68e1e543.
2017-02-02 20:10:28 +01:00
Franck Bui f1669917f5 systemctl: 'show' don't exit with a failure status if the requested property does not exist (#5201)
"systemctl show -pUnknown <service>" used to exit with '0' even if the property
passed by '-p' doesn't exist. But since commit 3dced37b7c (v231+),
it exits with a failure status.

"systemctl show" is supposed to be scriptable and therefore its behavior is
supposed to be stable.

This patch restores the old behavior on which a couple of scripts already rely
now.

Also when the requested property doesn't exist, it always logs it at the debug
level since this part of the code is only used by the show command.

Fixes: #5118
2017-02-02 13:29:44 -05:00
Zbigniew Jędrzejewski-Szmek 17e78d1825 systemctl: also use chase_symlinks for dropins
The general rule is:
- code in shared/ should take an "original_root" argument (possibly NULL)
  and pass it along down to chase_symlinks
- code in core/ should always use specify original_root==NULL, since we
  don't support running the manager from non-root directory
- code in systemctl and other tools should pass arg_root.

For any code that is called from tools which support --root, chase_symlinks
must be used to look up paths.
2017-02-02 12:17:20 -05:00
Zbigniew Jędrzejewski-Szmek 3ef21542b2 systemctl: do not prepend arg_root twice when catting units
The paths in lookup_paths already contain the arg_root prefix.

Fixes #5190.
2017-02-02 11:32:40 -05:00
Zbigniew Jędrzejewski-Szmek ce954c0319 core/mount: remove repeated word 2017-02-02 11:18:34 -05:00
Lennart Poettering 486b3d08db Merge pull request #5204 from keszybz/masked-warning-cleanup
Cleanup of error code mismatch for masked units
2017-02-02 11:47:30 +01:00
Lennart Poettering b415174d8e Merge pull request #5202 from keszybz/cgls-units
systemd-cgls --unit --user-unit
2017-02-02 11:45:51 +01:00
Zbigniew Jędrzejewski-Szmek f7dda6c625 Merge pull request #5203 from poettering/dotdot
trivial unification of checking for "." and ".." when iterating through directories...
2017-02-01 22:43:28 -05:00
Zbigniew Jędrzejewski-Szmek 256c1eba6b cgls: allow --unit, --user-unit to take optional argument
The following are all equivalent:
--unit foo.service bar.service
--unit=foo.service bar.service
--unit=foo.service --unit=bar.service
foo.service bar.service --unit

Similarly for --user-unit.

The only case that doesn't work well is when --unit and --user-unit are mixed:
  --unit=foo.service --user-unit=bar.service
We'll treat both names as user units. I think this is OK.
2017-02-01 22:32:19 -05:00
Zbigniew Jędrzejewski-Szmek e7aa3f5014 cgls: add --user-unit to show user units 2017-02-01 22:31:41 -05:00
Zbigniew Jędrzejewski-Szmek d9855d87eb cgls: add --unit to show units
$ systemd-cgls -u systemd-journald.service machine.slice

I opted for a "global" switch, instead of modifying the behaviour of just one
argument. It seem to be a more useful setting, since usually one will want to
query one or more units, and not mix unit names with paths.

Closes #5156.
2017-02-01 22:30:03 -05:00
Zbigniew Jędrzejewski-Szmek bc06be7533 shared/cgroup-show: extract funtion to query unit cgroup path
…and use it where possible.
2017-02-01 20:31:50 -05:00
Zbigniew Jędrzejewski-Szmek d3e8277d50 cgtop: use common function to query cgroup root
show_cgroup_get_root_and_warn is renamed to show_cgroup_get_path_and_warn
because it now optionally allows querying a non-root path.

This removes duplicated code and teaches cgtop to combine
-M with a root prefix:

$ systemd-cgtop -M myprecious /system.slice
...
2017-02-01 20:29:09 -05:00
Zbigniew Jędrzejewski-Szmek 049cb73b36 cgls: make function to query cgroup root public
No functional change.
2017-02-01 20:25:30 -05:00