]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
7 years agoMerge pull request #5270 from poettering/seccomp-namespace-fix
Evgeny Vereshchagin [Thu, 9 Feb 2017 00:31:22 +0000 (03:31 +0300)] 
Merge pull request #5270 from poettering/seccomp-namespace-fix

swap seccomp filter params on s390

7 years agoman: fix docs for swap's DefaultDependencies= (#5278)
David Glasser [Wed, 8 Feb 2017 23:12:36 +0000 (15:12 -0800)] 
man: fix docs for swap's DefaultDependencies= (#5278)

There was a missing dependency and one with the wrong type. Additionally, refer
to DefaultDependencies= once instead of twice, without a vague reference in the
first one that doesn't mention that the value matters.

Fixes #5226.

7 years agoupdate TODO 5270/head
Lennart Poettering [Wed, 8 Feb 2017 15:29:05 +0000 (16:29 +0100)] 
update TODO

7 years agoseccomp: on s390 the clone() parameters are reversed
Lennart Poettering [Wed, 8 Feb 2017 15:21:11 +0000 (16:21 +0100)] 
seccomp: on s390 the clone() parameters are reversed

Add a bit of code that tries to get the right parameter order in place
for some of the better known architectures, and skips
restrict_namespaces for other archs.

This also bypasses the test on archs where we don't know the right
order.

In this case I didn't bother with testing the case where no filter is
applied, since that is hopefully just an issue for now, as there's
nothing stopping us from supporting more archs, we just need to know
which order is right.

Fixes: #5241
7 years agosystemctl: make sure that --now is carried out (#5209)
Jan Synacek [Wed, 8 Feb 2017 19:57:08 +0000 (20:57 +0100)] 
systemctl: make sure that --now is carried out (#5209)

When services are already enabled/disabled/masked, make sure
that --now still enforces start/stop.

7 years agosd-event: "when exiting no signal event are pending" is a wrong assertion (#5271)
Franck Bui [Wed, 8 Feb 2017 19:56:22 +0000 (20:56 +0100)] 
sd-event: "when exiting no signal event are pending" is a wrong assertion (#5271)

The code make the following assertion: when freeing a event loop object
(usually it's done after exiting from the main event loop), no signal events
are still queued and are pending.

This assertion can be found in event_unmask_signal_data() with
"assert(!d->current);" assertion.

It appears that this assertion can be wrong at least in a specific case
described below.

Consider the following example which is inspired from udev: a process defines 3
source events: 2 are created by sd_event_add_signal() and 1 is created by
sd_event_add_post().

 1. the process receives the 2 signals consecutively so that signal 'A' source
     event is queued and pending. Consequently the post source event is also
     queued and pending. This is done by sd_event_wait().

 2. The callback for signal 'A' is called by sd_event_dispatch().

 3. The next call to sd_event_wait() will queue signal 'B' source event.

 4. The callback for the post source event is called and calls sd_event_exit().

 5. the event loop is exited.

 6. freeing the event loop object will lead to the assertion failure in
     event_unmask_signal_data().

This patch simply removes this assertion as it doesn't seem to be a
bug if the signal data still reference a signal source at this point.

7 years agosysctl.d: replace URL of SysRq key documentation (#5274)
Peter Körner [Wed, 8 Feb 2017 18:42:43 +0000 (19:42 +0100)] 
sysctl.d: replace URL of SysRq key documentation (#5274)

The kernel documentation page is not distribution specific and also more
likely to be up to date than the Fedora wiki page referenced previously.

7 years agonspawn: Add support for sysroot pivoting (#5258)
Philip Withnall [Wed, 8 Feb 2017 15:54:31 +0000 (15:54 +0000)] 
nspawn: Add support for sysroot pivoting (#5258)

Add a new --pivot-root argument to systemd-nspawn, which specifies a
directory to pivot to / inside the container; while the original / is
pivoted to another specified directory (if provided). This adds
support for booting container images which may contain several bootable
sysroots, as is common with OSTree disk images. When these disk images
are booted on real hardware, ostree-prepare-root is run in conjunction
with sysroot.mount in the initramfs to achieve the same results.

7 years agotest: Fix a maybe-uninitialised compiler warning (#5269)
Philip Withnall [Wed, 8 Feb 2017 15:53:01 +0000 (15:53 +0000)] 
test: Fix a maybe-uninitialised compiler warning (#5269)

The compiler warning is a false positive, since n_addresses is always
initialised on the success path from parse_argv(), but the compiler
obviously can’t work that out.

Fixes:
   src/test/test-nss.c:426:9: warning: 'n_addresses' may be used uninitialized in this function [-Wmaybe-uninitialized]

7 years agoseccomp: MemoryDenyWriteExecute= should affect both mmap() and mmap2() (#5254)
Lennart Poettering [Wed, 8 Feb 2017 14:14:02 +0000 (15:14 +0100)] 
seccomp: MemoryDenyWriteExecute= should affect both mmap() and mmap2() (#5254)

On i386 we block the old mmap() call entirely, since we cannot properly
filter it. Thankfully it hasn't been used by glibc since quite some
time.

Fixes: #5240
7 years agoMerge pull request #5231 from keszybz/mask-wants
Lennart Poettering [Wed, 8 Feb 2017 13:50:56 +0000 (14:50 +0100)] 
Merge pull request #5231 from keszybz/mask-wants

Mask individual .wants/.requires symlinks

7 years agodissect: don't honour NOAUTO flags when looking for ESP (#5224)
Lennart Poettering [Wed, 8 Feb 2017 03:10:48 +0000 (04:10 +0100)] 
dissect: don't honour NOAUTO flags when looking for ESP (#5224)

The flag is originally defined for "basic data partitions", but not for the
ESP. We reuse it for the various partitions defined by the Discoverable
Partitions Spec, but it isn't defined for the ESP, hence don't check for
it. Instead, do check for GPT_FLAG_NO_BLOCK_IO_PROTOCOL, as that flag
actually is defined for all partition types, and recommended to use by
the UEFI spec.

Fixes: #5218
7 years agotests: add dropin dependency tests 5231/head
Franck Bui [Fri, 27 Jan 2017 15:02:22 +0000 (16:02 +0100)] 
tests: add dropin dependency tests

[zj: tests assertions adjusted to the different logic in which masking
     of a dependency through one name, does not forbid the dependency
     being added through another name.]

7 years agocore/load-dropin: add more sanity checks on .wants/.requires symlinks
Zbigniew Jędrzejewski-Szmek [Sun, 5 Feb 2017 03:36:17 +0000 (22:36 -0500)] 
core/load-dropin: add more sanity checks on .wants/.requires symlinks

Feb 04 22:35:42 systemd[1462]: foo.service: Wants dependency dropin /home/zbyszek/.config/systemd/user/foo.service.wants/diffname.service target ../barbar.service has different name
Feb 04 22:35:42 systemd[1462]: foo.service: Wants dependency dropin /home/zbyszek/.config/systemd/user/foo.service.wants/wrongname is not a valid unit name, ignoring

7 years agocore: drop code that is now unused
Zbigniew Jędrzejewski-Szmek [Sun, 5 Feb 2017 02:32:08 +0000 (21:32 -0500)] 
core: drop code that is now unused

7 years agocore: implement masking of .wants/.requires symlinks
Zbigniew Jędrzejewski-Szmek [Sun, 5 Feb 2017 01:50:44 +0000 (20:50 -0500)] 
core: implement masking of .wants/.requires symlinks

Fixes #1169.
Fixes #4830.

Example log errors:
Feb 04 22:13:28 systemd[1462]: foo.service: Wants dependency on empty_file.service is masked by /home/zbyszek/.config/systemd/user/foo.service.wants/empty_file.service, ignoring
Feb 04 22:13:28 systemd[1462]: foo.service: Wants dependency on masked.service is masked by /home/zbyszek/.config/systemd/user/foo.service.wants/masked.service, ignoring

7 years agocore: when loading .wants and .requires, follow the same logic as .d conf dropins
Zbigniew Jędrzejewski-Szmek [Sun, 5 Feb 2017 01:50:44 +0000 (20:50 -0500)] 
core: when loading .wants and .requires, follow the same logic as .d conf dropins

Essentially, instead of sequentially adding deps based on all symlinks
encountered in .wants and .requires dirs for each name and each unit file load
path, iteratate over the load paths and unit names gathering symlinks, then
order them based on priority, and then iterate over the final list, adding
dependencies.

This patch doesn't change the logic too much, except that the order in which
dependencies are applied might be different. It wasn't defined before, so that
not really a change. Adding filtering on the symlinks is left for later
patches.

7 years agobasic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffix
Zbigniew Jędrzejewski-Szmek [Wed, 8 Feb 2017 02:06:38 +0000 (21:06 -0500)] 
basic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffix

7 years agoman: s/--unmount/--umount/g (#5243)
Lennart Poettering [Wed, 8 Feb 2017 00:54:37 +0000 (01:54 +0100)] 
man: s/--unmount/--umount/g (#5243)

The --help text currently uses the "--umount" spelling, hence to the
same in the man page too.

And let's settle on "umount" instead of "unmount" here, since most folks
probably expect that when typing in a command, as util-linux' tool is
called "umount" after all, and so is the symlink "systemd-umount" we
install.

7 years agoMerge pull request #5263 from poettering/install-alias
Zbigniew Jędrzejewski-Szmek [Wed, 8 Feb 2017 00:50:20 +0000 (19:50 -0500)] 
Merge pull request #5263 from poettering/install-alias

7 years agoRevert "fix handling of templates instantiated in /usr/lib (#5263)"
Zbigniew Jędrzejewski-Szmek [Wed, 8 Feb 2017 00:49:47 +0000 (19:49 -0500)] 
Revert "fix handling of templates instantiated in /usr/lib  (#5263)"

This reverts commit 0698b674920aa8a56dbd6a625729a35e5ae9c5df.

It was supposed to be merged, not squashed.

7 years agofix handling of templates instantiated in /usr/lib (#5263)
Lennart Poettering [Wed, 8 Feb 2017 00:48:56 +0000 (01:48 +0100)] 
fix handling of templates instantiated in /usr/lib  (#5263)

Fix handling of templates instantiated in /usr/lib.
All work to fix #5136.

7 years agoman: document *.d/ drop-in file order (#5262)
Lucas Werkmeister [Tue, 7 Feb 2017 23:58:02 +0000 (00:58 +0100)] 
man: document *.d/ drop-in file order (#5262)

7 years agotmpfiles.d: set primary group rights to r-w (#5265)
lewo [Tue, 7 Feb 2017 23:56:55 +0000 (00:56 +0100)] 
tmpfiles.d: set primary group rights to r-w (#5265)

If the /var/log/journal directory is created with rigths 700, the application
of an ACL rules without any primary group right sets it to 0. A chmod 755 on
this file will then only set the ACL mask and let the ACL primary group right
to 0. The directory is then unreadable for the primary group.

This patch explicitly sets the primary group to avoid this problem.

Fixes #5264.

7 years agoMerge pull request #5219 from poettering/run-size-check
Zbigniew Jędrzejewski-Szmek [Tue, 7 Feb 2017 23:37:04 +0000 (18:37 -0500)] 
Merge pull request #5219 from poettering/run-size-check

before reloading, check that /run/systemd has enough space

7 years agoMerge pull request #5259 from lucaswerkmeister/man
Lennart Poettering [Tue, 7 Feb 2017 19:24:43 +0000 (20:24 +0100)] 
Merge pull request #5259 from lucaswerkmeister/man

Manpage improvements

7 years agoMerge pull request #5261 from AsciiWolf/master
Lennart Poettering [Tue, 7 Feb 2017 19:24:05 +0000 (20:24 +0100)] 
Merge pull request #5261 from AsciiWolf/master

l10n: various fixes

7 years agoinstall: remove some unused parameters from various functions in install.c 5263/head
Lennart Poettering [Tue, 7 Feb 2017 19:22:09 +0000 (20:22 +0100)] 
install: remove some unused parameters from various functions in install.c

No need to pass what we don't use.

7 years agoinstall: when a template unit is instantiated via a /usr symlink, consider it enabled
Lennart Poettering [Tue, 7 Feb 2017 19:16:12 +0000 (20:16 +0100)] 
install: when a template unit is instantiated via a /usr symlink, consider it enabled

If a unit foobar@.service stored below /usr is instantiated via a
symlink foobar@quux.service also below /usr, then we should consider the
instance statically enabled, while the template itself should continue
to be considered enabled/disabled/static depending on its [Install]
section.

In order to implement this we'll now look for enablement symlinks in all
unit search paths, not just in the config and runtime dirs.

Fixes: #5136
7 years agol10n: fix file permissions of Indonesian translation 5261/head
AsciiWolf [Tue, 7 Feb 2017 18:02:01 +0000 (19:02 +0100)] 
l10n: fix file permissions of Indonesian translation

7 years agol10n: fix strings formatting in Czech translation
AsciiWolf [Tue, 7 Feb 2017 18:00:24 +0000 (19:00 +0100)] 
l10n: fix strings formatting in Czech translation

7 years agoman: document that systemd-run --on-* cannot be used with --pty 5259/head
Lucas Werkmeister [Tue, 7 Feb 2017 15:25:17 +0000 (16:25 +0100)] 
man: document that systemd-run --on-* cannot be used with --pty

7 years agoinstall: don't enter loop when traversing a template symlinks
Lennart Poettering [Tue, 7 Feb 2017 15:22:49 +0000 (16:22 +0100)] 
install: don't enter loop when traversing a template symlinks

Before this patch, if we'd encounter an instance or template symlink
while traversing a chain of symlinks we'd fill in the instance name and
retry the iteration. This makes no sense if the resulting name is
actually the same as we are coming from, as we'd just spin a couple of
times in the loop, until the UNIT_FILE_FOLLOW_SYMLINK_MAX iteration
limit is hit.

Fix this, by accepted the symlink as it is, if it identical to what we
filled in.

7 years agoman: use systemctl enable --now
Lucas Werkmeister [Thu, 26 Jan 2017 10:03:09 +0000 (11:03 +0100)] 
man: use systemctl enable --now

7 years agoman: add cross-reference
Lucas Werkmeister [Thu, 26 Jan 2017 10:01:28 +0000 (11:01 +0100)] 
man: add cross-reference

The third paragraph of the Description already linked to
systemd.resource-control(5), but it was missing from the list of
additional options for the [Service] section.

7 years agoMerge pull request #5225 from poettering/seccomp-socket
Evgeny Vereshchagin [Tue, 7 Feb 2017 02:06:54 +0000 (05:06 +0300)] 
Merge pull request #5225 from poettering/seccomp-socket

make RestrictAddressFamilies= officially a NOP on i386

7 years agoMerge pull request #5239 from poettering/notify-access-all
Evgeny Vereshchagin [Mon, 6 Feb 2017 20:59:33 +0000 (23:59 +0300)] 
Merge pull request #5239 from poettering/notify-access-all

man: document that sd_notify() is racy in some cases

7 years agoupdate TODO
Lennart Poettering [Mon, 6 Feb 2017 20:14:31 +0000 (21:14 +0100)] 
update TODO

7 years agoREADME: suffix unit file options with "="
Lennart Poettering [Mon, 6 Feb 2017 20:13:21 +0000 (21:13 +0100)] 
README: suffix unit file options with "="

7 years agoupdate TODO
Lennart Poettering [Mon, 6 Feb 2017 19:26:33 +0000 (20:26 +0100)] 
update TODO

7 years agonotify: document that we fake the PID when sending sd_notify() 5239/head
Lennart Poettering [Mon, 6 Feb 2017 19:01:24 +0000 (20:01 +0100)] 
notify: document that we fake the PID when sending sd_notify()

7 years agoupdate TODO
Lennart Poettering [Mon, 6 Feb 2017 17:37:28 +0000 (18:37 +0100)] 
update TODO

7 years agoman: document that sd_notify() is racy in some cases
Lennart Poettering [Mon, 6 Feb 2017 12:49:44 +0000 (13:49 +0100)] 
man: document that sd_notify() is racy in some cases

7 years agocore: use a memfd for serialization 5219/head
Lennart Poettering [Fri, 3 Feb 2017 15:30:00 +0000 (16:30 +0100)] 
core: use a memfd for serialization

If we can, use a memfd for serializing state during a daemon reload or
reexec. Fall back to a file in /run/systemd or /tmp only if memfds are
not available.

See: #5016

7 years agomanager: refuse reloading/reexecing when /run is overly full
Lennart Poettering [Fri, 3 Feb 2017 11:12:54 +0000 (12:12 +0100)] 
manager: refuse reloading/reexecing when /run is overly full

Let's add an extra safety check: before entering a reload/reexec, let's
verify that there's enough room in /run for it.

Fixes: #5016
7 years agosystemd-mount: add missing fsck argument (#5238)
Lukas Rusak [Mon, 6 Feb 2017 13:25:15 +0000 (05:25 -0800)] 
systemd-mount: add missing fsck argument (#5238)

7 years agoman: Document that RestrictAddressFamilies= doesn't work on s390/s390x/... 5225/head
Lennart Poettering [Fri, 3 Feb 2017 17:33:04 +0000 (18:33 +0100)] 
man: Document that RestrictAddressFamilies= doesn't work on s390/s390x/...

We already say that it doesn't work on i386, but there are more archs
like that apparently.

7 years agoseccomp: RestrictAddressFamilies= is not supported on i386/s390/s390x, make it a NOP
Lennart Poettering [Fri, 3 Feb 2017 17:31:05 +0000 (18:31 +0100)] 
seccomp: RestrictAddressFamilies= is not supported on i386/s390/s390x, make it a NOP

See: #5215

7 years agoupdate TODO
Lennart Poettering [Mon, 6 Feb 2017 12:49:40 +0000 (13:49 +0100)] 
update TODO

7 years agoMerge pull request #5237 from keszybz/explicit-bzero
Lennart Poettering [Mon, 6 Feb 2017 12:35:56 +0000 (13:35 +0100)] 
Merge pull request #5237 from keszybz/explicit-bzero

Use `explicit_bzero`

7 years agocgls: look at the right variable in error path (#5234)
Zbigniew Jędrzejewski-Szmek [Mon, 6 Feb 2017 12:34:01 +0000 (07:34 -0500)] 
cgls: look at the right variable in error path (#5234)

CID #1370779.

7 years agojournalctl: replace string_erase with memset('x') 5237/head
Zbigniew Jędrzejewski-Szmek [Mon, 6 Feb 2017 01:09:41 +0000 (20:09 -0500)] 
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.

7 years agotreewide: replace homegrown memory_erase with explicit_bzero
Zbigniew Jędrzejewski-Szmek [Mon, 6 Feb 2017 01:05:27 +0000 (20:05 -0500)] 
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.

7 years agoresolved: downgrade "processing query..." message to debug (#5233)
Felipe Sateler [Sun, 5 Feb 2017 22:17:50 +0000 (19:17 -0300)] 
resolved: downgrade "processing query..." message to debug (#5233)

It doesn't really add much value in normal operation and just spams the log.

7 years agoMerge pull request #5223 from keszybz/root-workdir
Martin Pitt [Sun, 5 Feb 2017 21:31:02 +0000 (22:31 +0100)] 
Merge pull request #5223 from keszybz/root-workdir

Fix WorkDir=~ with empty User=

7 years agobuild-sys,man: describe systemd-umount and hook it up to installation (#5227)
Zbigniew Jędrzejewski-Szmek [Sun, 5 Feb 2017 21:27:38 +0000 (16:27 -0500)] 
build-sys,man: describe systemd-umount and hook it up to installation (#5227)

7 years agoseccomp: don't ever try to add an ABI before removing the default native ABI (#5230)
Evgeny Vereshchagin [Sun, 5 Feb 2017 16:58:19 +0000 (19:58 +0300)] 
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!

7 years agocatalog: update Russian translation (#5232)
Sergey Ptashnick [Sun, 5 Feb 2017 16:56:47 +0000 (20:56 +0400)] 
catalog: update Russian translation (#5232)

7 years agocore/timer: downgrade message about random time addition (#5229)
Zbigniew Jędrzejewski-Szmek [Sun, 5 Feb 2017 08:37:46 +0000 (03:37 -0500)] 
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.

7 years agoSilence two "unused function af_lookup" warnings (#5222)
Zbigniew Jędrzejewski-Szmek [Sat, 4 Feb 2017 15:25:20 +0000 (10:25 -0500)] 
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)
 ^~~~~~~~~~~~~

7 years agosystemd-mount features and improvements (#5067)
Lukas Rusak [Sat, 4 Feb 2017 15:21:49 +0000 (07:21 -0800)] 
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.

7 years agoMerge pull request #4973 from poettering/run-race
Martin Pitt [Fri, 3 Feb 2017 17:44:42 +0000 (18:44 +0100)] 
Merge pull request #4973 from poettering/run-race

run: fix race for "systemd-run --wait"

7 years agoman: clarify interface for suspend/resume integration (#5220)
Martin Pitt [Fri, 3 Feb 2017 17:11:37 +0000 (18:11 +0100)] 
man: clarify interface for suspend/resume integration (#5220)

Fixes #4916.

7 years agocore/execute: pass the username to utmp/wtmp database 5223/head
Zbigniew Jędrzejewski-Szmek [Fri, 3 Feb 2017 16:32:42 +0000 (11:32 -0500)] 
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.

7 years agocore/execute: set HOME, USER also for root users
Zbigniew Jędrzejewski-Szmek [Fri, 3 Feb 2017 14:41:53 +0000 (09:41 -0500)] 
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.

7 years agotime-util: Fix overflow check introduce in commit f977849 (#5216)
Benjamin Robin [Fri, 3 Feb 2017 15:13:55 +0000 (16:13 +0100)] 
time-util: Fix overflow check introduce in commit f977849 (#5216)

7 years agorun: exit early in --pty if service failed 4973/head
Lennart Poettering [Fri, 23 Dec 2016 23:35:58 +0000 (00:35 +0100)] 
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
7 years agorun: explicitly close pty forwarder before printing summary
Lennart Poettering [Fri, 23 Dec 2016 23:34:34 +0000 (00:34 +0100)] 
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.

7 years agorun: complain when --pty is used together with --no-block, which makes no sense
Lennart Poettering [Fri, 23 Dec 2016 23:30:49 +0000 (00:30 +0100)] 
run: complain when --pty is used together with --no-block, which makes no sense

7 years agosd-event: when an event source fails, don't assume the type of it is still set
Lennart Poettering [Fri, 23 Dec 2016 22:26:15 +0000 (23:26 +0100)] 
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.

7 years agoMerge pull request #5213 from keszybz/systemctl-root-cat
Lennart Poettering [Fri, 3 Feb 2017 10:02:28 +0000 (11:02 +0100)] 
Merge pull request #5213 from keszybz/systemctl-root-cat

Two fixes to path lookup when --root is used

7 years agorules: allow systemd to manage UBI volumes (#5214)
Mirza Krak [Fri, 3 Feb 2017 08:26:50 +0000 (09:26 +0100)] 
rules: allow systemd to manage UBI volumes (#5214)

UBI is a software layer on top of MTD devices that is used with flash
chips.

7 years agologind: Don't try to emit a change signal for the 'Sessions' property (#5211)
afrantzis [Fri, 3 Feb 2017 01:39:26 +0000 (03:39 +0200)] 
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.

7 years agoMerge pull request #5212 from poettering/time-range
Zbigniew Jędrzejewski-Szmek [Fri, 3 Feb 2017 01:36:18 +0000 (20:36 -0500)] 
Merge pull request #5212 from poettering/time-range

time handling fixes

7 years agoptyfwd: set event source description strings for all event sources of a ptyfwd object
Lennart Poettering [Fri, 23 Dec 2016 22:25:49 +0000 (23:25 +0100)] 
ptyfwd: set event source description strings for all event sources of a ptyfwd object

7 years agorun: fix race for "systemd-run --wait"
Lennart Poettering [Fri, 23 Dec 2016 21:56:39 +0000 (22:56 +0100)] 
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
7 years agocgls: --machine= expects an argument, indicate that in log messages 5212/head
Lennart Poettering [Thu, 2 Feb 2017 17:36:15 +0000 (18:36 +0100)] 
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.

7 years agotime-util: add overflow checking to monotonic timestamp specifications
Lennart Poettering [Thu, 2 Feb 2017 17:35:00 +0000 (18:35 +0100)] 
time-util: add overflow checking to monotonic timestamp specifications

7 years agotime-util: when formatting usec_t as raw integers use PRIu64
Lennart Poettering [Thu, 2 Feb 2017 17:34:26 +0000 (18:34 +0100)] 
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.

7 years agotime-util: when converting to time_t do something useful in 2038
Lennart Poettering [Thu, 2 Feb 2017 17:33:36 +0000 (18:33 +0100)] 
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.

7 years agotime-util: refuse formatting/parsing times that we can't store
Lennart Poettering [Thu, 2 Feb 2017 17:30:29 +0000 (18:30 +0100)] 
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.

7 years agotime: time_t is signed, and mktime() is happy to return negative time
Lennart Poettering [Thu, 2 Feb 2017 17:25:33 +0000 (18:25 +0100)] 
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.

7 years agonspawn: shown exec() command is misleading
Lennart Poettering [Thu, 2 Feb 2017 17:27:25 +0000 (18:27 +0100)] 
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 1a68e1e543fd8f899503bec00585a16ada296ef7.

7 years agosystemctl: 'show' don't exit with a failure status if the requested property does...
Franck Bui [Thu, 2 Feb 2017 18:29:44 +0000 (19:29 +0100)] 
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 3dced37b7c2c9a5c733817 (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
7 years agosystemctl: also use chase_symlinks for dropins 5213/head
Zbigniew Jędrzejewski-Szmek [Thu, 2 Feb 2017 17:17:20 +0000 (12:17 -0500)] 
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.

7 years agosystemctl: do not prepend arg_root twice when catting units
Zbigniew Jędrzejewski-Szmek [Thu, 2 Feb 2017 16:32:40 +0000 (11:32 -0500)] 
systemctl: do not prepend arg_root twice when catting units

The paths in lookup_paths already contain the arg_root prefix.

Fixes #5190.

7 years agocore/mount: remove repeated word
Zbigniew Jędrzejewski-Szmek [Thu, 2 Feb 2017 16:18:34 +0000 (11:18 -0500)] 
core/mount: remove repeated word

7 years agoMerge pull request #5204 from keszybz/masked-warning-cleanup
Lennart Poettering [Thu, 2 Feb 2017 10:47:30 +0000 (11:47 +0100)] 
Merge pull request #5204 from keszybz/masked-warning-cleanup

Cleanup of error code mismatch for masked units

7 years agoMerge pull request #5202 from keszybz/cgls-units
Lennart Poettering [Thu, 2 Feb 2017 10:45:51 +0000 (11:45 +0100)] 
Merge pull request #5202 from keszybz/cgls-units

systemd-cgls --unit --user-unit

7 years agoMerge pull request #5203 from poettering/dotdot
Zbigniew Jędrzejewski-Szmek [Thu, 2 Feb 2017 03:43:28 +0000 (22:43 -0500)] 
Merge pull request #5203 from poettering/dotdot

trivial unification of checking for "." and ".." when iterating through directories...

7 years agocgls: allow --unit, --user-unit to take optional argument 5202/head
Zbigniew Jędrzejewski-Szmek [Thu, 2 Feb 2017 03:24:41 +0000 (22:24 -0500)] 
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.

7 years agocgls: add --user-unit to show user units
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 20:20:46 +0000 (15:20 -0500)] 
cgls: add --user-unit to show user units

7 years agocgls: add --unit to show units
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 19:52:46 +0000 (14:52 -0500)] 
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.

7 years agoshared/cgroup-show: extract funtion to query unit cgroup path
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 19:30:57 +0000 (14:30 -0500)] 
shared/cgroup-show: extract funtion to query unit cgroup path

…and use it where possible.

7 years agocgtop: use common function to query cgroup root
Zbigniew Jędrzejewski-Szmek [Thu, 2 Feb 2017 01:26:58 +0000 (20:26 -0500)] 
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
...

7 years agocgls: make function to query cgroup root public
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 18:25:27 +0000 (13:25 -0500)] 
cgls: make function to query cgroup root public

No functional change.

7 years agocore/transaction: also downgrade warning for masked units wanted by followed units 5204/head
Zbigniew Jędrzejewski-Szmek [Thu, 2 Feb 2017 00:48:27 +0000 (19:48 -0500)] 
core/transaction: also downgrade warning for masked units wanted by followed units

The warning "Cannot add dependency job, ignoring" was downgraded to info in one
place, but not in the other.

C.f. #5179.

7 years agoConsistently use ERFKILL for masked units
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 23:36:09 +0000 (18:36 -0500)] 
Consistently use ERFKILL for masked units

76ec966f0e33685f833 changed the code from ESHUTDOWN to ERFKILL, but missed one
spot in bus-common-errors.c. Fix that.

The code in transaction.c was checking for ERFKILL, but I'm not sure if this
mismatch had any effect, i.e. if there were any code paths in which the wrong
code actually made difference.

Also add comments when ESHUTDOWN is used in the journal code, so it's easy to
distinguish those cases when grepping. Standarize on the same capitalization.

(There's also a bunch of uses in sd-bus.c, but that's clearly different.)

7 years agoMerge pull request #5151 from keszybz/journal-flags
Lennart Poettering [Thu, 2 Feb 2017 00:01:45 +0000 (01:01 +0100)] 
Merge pull request #5151 from keszybz/journal-flags

More information about unsupported journal file flags

7 years agoman: fix spelling error parth -> path
Brandon Philips [Wed, 1 Feb 2017 23:54:42 +0000 (00:54 +0100)] 
man: fix spelling error parth -> path