platform/upstream/systemd.git
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 agocgls: --machine= expects an argument, indicate that in log messages
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 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
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
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

7 years agosystemctl: restore --failed (#5198)
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 23:23:46 +0000 (18:23 -0500)]
systemctl: restore --failed (#5198)

'systemctl --failed' is an extremely common operation and it's nice to have
a shortcut for it.

Revert "man: don't document systemctl --failed" and add the option back to
systemctl's help and shell completion scripts.

This reverts commit 036359ba8d0aba7db7eac75d10073a849a033fd1.

7 years agohexdecoct: use typesafe new() instead of malloc()
Lennart Poettering [Wed, 1 Feb 2017 23:10:44 +0000 (00:10 +0100)]
hexdecoct: use typesafe new() instead of malloc()

7 years agofs-util: unify code we use to check if dirent's d_name is "." or ".."
Lennart Poettering [Wed, 1 Feb 2017 23:06:18 +0000 (00:06 +0100)]
fs-util: unify code we use to check if dirent's d_name is "." or ".."

We use different idioms at different places. Let's replace this is the
one true new idiom, that is even a bit faster...

7 years agosystem-update-generator: warn if the command line blocks updates (#5173)
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 20:50:03 +0000 (15:50 -0500)]
system-update-generator: warn if the command line blocks updates (#5173)

If "3", "5", "systemd.unit=", or similar are present on the kernel command line,
the system will not enter into offline update. This behaviour is in line with the
general logic that configuration on the kernel command line has higher priority
than the configuration on disk, but is rather surprising. Emit a warning to help
users diagnose the situation.

https://bugzilla.redhat.com/show_bug.cgi?id=1405439#c4

7 years agoupdate TODO
Lennart Poettering [Wed, 1 Feb 2017 19:02:17 +0000 (20:02 +0100)]
update TODO

7 years agoMerge pull request #5191 from keszybz/tweaks
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 15:27:32 +0000 (10:27 -0500)]
Merge pull request #5191 from keszybz/tweaks

7 years agoRevert "Trivial typo fixes and code refactorings (#5191)"
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 15:26:50 +0000 (10:26 -0500)]
Revert "Trivial typo fixes and code refactorings (#5191)"

Let's do a merge to preserve all the commit messages.

This reverts commit 785d345145bbd06c8f1c75c6a0b119c4e8f411db.

7 years agoTrivial typo fixes and code refactorings (#5191)
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 14:04:27 +0000 (09:04 -0500)]
Trivial typo fixes and code refactorings (#5191)

* logind: trivial simplification

free_and_strdup() handles NULL arg, so make use of that.

* boot: fix two typos

* pid1: rewrite check in ignore_proc() to not check condition twice

It's harmless, but it seems nicer to evaluate a condition just a single time.

* core/execute: reformat exec_context_named_iofds() for legibility

* core/execute.c: check asprintf return value in the usual fashion

This is unlikely to fail, but we cannot rely on asprintf return value
on failure, so let's just be correct here.

CID #1368227.

* core/timer: use (void)

CID #1368234.

* journal-file: check asprintf return value in the usual fashion

This is unlikely to fail, but we cannot rely on asprintf return value
on failure, so let's just be correct here.

CID #1368236.

* shared/cgroup-show: use (void)

CID #1368243.

* cryptsetup: do not return uninitialized value on error

CID #1368416.

7 years agonspawn: Print attempted execv() path on failure (#5199)
Philip Withnall [Wed, 1 Feb 2017 13:36:16 +0000 (13:36 +0000)]
nspawn: Print attempted execv() path on failure (#5199)

The failure message is typically currently:
   execv() failed: No such file or directory
which is not very useful because it doesn’t tell you which file or
directory it was trying to exec.

7 years agoMerge pull request #5166 from keszybz/gcc7
Evgeny Vereshchagin [Wed, 1 Feb 2017 09:02:50 +0000 (12:02 +0300)]
Merge pull request #5166 from keszybz/gcc7

Fixes for gcc 7 and new µhttpd & glibc warnings

7 years agoMerge pull request #5146 from ssahani/ifname-alias
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 01:36:20 +0000 (20:36 -0500)]
Merge pull request #5146 from ssahani/ifname-alias

networkd: Allow ':' in label

This reverts a341dfe563 and takes a slightly different approach: anything is
allowed in network interface labels, but network interface names are verified
as before (i.e. amongst other things, no colons are allowed there).

7 years agonss-util: silence warning about deprecated RES_USE_INET6
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 00:55:33 +0000 (19:55 -0500)]
nss-util: silence warning about deprecated RES_USE_INET6

src/nss-resolve/nss-resolve.c: In function ‘_nss_resolve_gethostbyname_r’:
src/nss-resolve/nss-resolve.c:680:13: warning: RES_USE_INET6 is deprecated
 NSS_GETHOSTBYNAME_FALLBACKS(resolve);
             ^~~~~~~~~~~~~~~~~~~~~~~~~

In glibc bz #19582, RES_USE_INET6 was deprecated. This might make sense for
clients, but they didn't take into account nss module implementations which
*must* continue to support the option. glibc internally defines
DEPRECATED_RES_USE_INET6 which can be used without emitting a warning, but
it's not exported publicly. Let's do the same, and just copy the definition
to our header.

7 years agoMurmurHash: all /* fall through */ comments
Zbigniew Jędrzejewski-Szmek [Wed, 1 Feb 2017 00:35:04 +0000 (19:35 -0500)]
MurmurHash: all /* fall through */ comments

7 years agocryptsetup: do not return uninitialized value on error
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 19:01:53 +0000 (14:01 -0500)]
cryptsetup: do not return uninitialized value on error

CID #1368416.

7 years agojournal/lookup3: silence gcc 7 implicit-fallthrough warning
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jan 2017 06:08:08 +0000 (01:08 -0500)]
journal/lookup3: silence gcc 7 implicit-fallthrough warning

This file doesn't include any of our headers, so just use the pragma
without defining it in macros.h

7 years agotree-wide: adjust fall through comments so that gcc is happy
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jan 2017 05:50:10 +0000 (00:50 -0500)]
tree-wide: adjust fall through comments so that gcc is happy

gcc 7 adds -Wimplicit-fallthrough=3 to -Wextra. There are a few ways
we could deal with that. After we take into account the need to stay compatible
with older versions of the compiler (and other compilers), I don't think adding
__attribute__((fallthrough)), even as a macro, is worth the trouble. It sticks
out too much, a comment is just as good. But gcc has some very specific
requiremnts how the comment should look. Adjust it the specific form that it
likes. I don't think the extra stuff we had in those comments was adding much
value.

(Note: the documentation seems to be wrong, and seems to describe a different
pattern from the one that is actually used. I guess either the docs or the code
will have to change before gcc 7 is finalized.)

7 years agonspawn: fix clobbering of selinux context arg
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jan 2017 05:45:38 +0000 (00:45 -0500)]
nspawn: fix clobbering of selinux context arg

First bug fixed by gcc 7. Yikes.

7 years agopid1: remove duplicate const attribute
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jan 2017 05:25:20 +0000 (00:25 -0500)]
pid1: remove duplicate const attribute

gcc 7 started warning about this.

7 years agomicrohttpd-util: silence warnings about deprecated options
Zbigniew Jędrzejewski-Szmek [Fri, 27 Jan 2017 05:15:07 +0000 (00:15 -0500)]
microhttpd-util: silence warnings about deprecated options

7 years agocore: fix copy paste error (s/source/destination/) (#5197)
Evgeny Vereshchagin [Tue, 31 Jan 2017 18:04:01 +0000 (21:04 +0300)]
core: fix copy paste error (s/source/destination/) (#5197)

```
-bash-4.3# systemd-run --property BindPaths=/etc:tmp/hey sh -c 'ls /tmp/hey'
```
prints
`Destination path tmp/hey is not absolute.`
instead of
`Destination path /etc is not absolute.`

CID #1368239

7 years agoshared/cgroup-show: use (void)
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 16:39:04 +0000 (11:39 -0500)]
shared/cgroup-show: use (void)

CID #1368243.

7 years agojournal-file: check asprintf return value in the usual fashion
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 16:36:08 +0000 (11:36 -0500)]
journal-file: check asprintf return value in the usual fashion

This is unlikely to fail, but we cannot rely on asprintf return value
on failure, so let's just be correct here.

CID #1368236.

7 years agocore/timer: use (void)
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 16:33:56 +0000 (11:33 -0500)]
core/timer: use (void)

CID #1368234.

7 years agocore/execute.c: check asprintf return value in the usual fashion
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 16:31:47 +0000 (11:31 -0500)]
core/execute.c: check asprintf return value in the usual fashion

This is unlikely to fail, but we cannot rely on asprintf return value
on failure, so let's just be correct here.

CID #1368227.

7 years agocore/execute: reformat exec_context_named_iofds() for legibility
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 16:23:10 +0000 (11:23 -0500)]
core/execute: reformat exec_context_named_iofds() for legibility

7 years agocoredump: really extract container cmdline (#5167)
Evgeny Vereshchagin [Tue, 31 Jan 2017 16:04:20 +0000 (19:04 +0300)]
coredump: really extract container cmdline (#5167)

Fixes:
```
root# systemd-nspawn -D ./cont/ --register=no /bin/sh -c '/bin/sh -c "kill -ABRT \$\$"'
...
Container cont failed with error code 134.

root# journalctl MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1 -o verbose | grep -i container_cmdline
...prints nothing...
...should be COREDUMP_CONTAINER_CMDLINE=systemd-nspawn -D ./cont/ --register=no /bin/sh -c /bin/sh -c "kill -ABRT \$\$"
```

Also, fixes CID #1368263
```
==352== 130 bytes in 1 blocks are definitely lost in loss record 1 of 2
==352==    at 0x4C2ED5F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==352==    by 0x4ED8581: greedy_realloc (alloc-util.c:57)
==352==    by 0x4ECAAD5: get_process_cmdline (process-util.c:147)
==352==    by 0x10E385: get_process_container_parent_cmdline (coredump.c:645)
==352==    by 0x112949: process_kernel (coredump.c:1240)
==352==    by 0x113003: main (coredump.c:1297)
==352==
```

7 years agoMerge pull request #5168 from ddstreet/apply_format_helper
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 15:56:09 +0000 (10:56 -0500)]
Merge pull request #5168 from ddstreet/apply_format_helper

simplify udev_event_apply_format().

7 years agoMerge pull request #5177 from M0Rf30/master
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 15:51:56 +0000 (10:51 -0500)]
Merge pull request #5177 from M0Rf30/master

hwdb: quirk for kionix accelerometer on Asus TP500LB

7 years agoMerge pull request #5192 from keszybz/systemctl-ignore-sigterm
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 15:36:30 +0000 (10:36 -0500)]
Merge pull request #5192 from keszybz/systemctl-ignore-sigterm

Fix for initrd-switch-root failing and causing emergency.target to be started.

7 years agoutil-lib: Fix chase_symlinks() with absolute symlinks (#5185)
3chas3 [Tue, 31 Jan 2017 13:21:15 +0000 (08:21 -0500)]
util-lib: Fix chase_symlinks() with absolute symlinks (#5185)

If chase_symlinks() encouters an absolute symlink, it resets the todo
buffer to just the newly discovered symlink and discards any of the
remaining previous symlink path.  Regardless of whether or not the
symlink is absolute or relative, we need to preserve the remainder of
the path that has not yet been resolved.

7 years agobasic: check strdup result in khash_dup (#5176)
Evgeny Vereshchagin [Tue, 31 Jan 2017 07:27:14 +0000 (10:27 +0300)]
basic: check strdup result in khash_dup (#5176)

Fixes CID #1368249

7 years agoMerge pull request #5175 from keszybz/hostname-fallback
Martin Pitt [Tue, 31 Jan 2017 07:26:42 +0000 (08:26 +0100)]
Merge pull request #5175 from keszybz/hostname-fallback

Allow distributions to override the "localhost" fallback

7 years agoman: mention ConditionFirstBoot= in systemd-firstboot(1) (#5186)
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 07:25:19 +0000 (02:25 -0500)]
man: mention ConditionFirstBoot= in systemd-firstboot(1) (#5186)

7 years agounits: restore Before dependencies for systemd-vconsole-setup.service
Zbigniew Jędrzejewski-Szmek [Tue, 31 Jan 2017 05:34:33 +0000 (00:34 -0500)]
units: restore Before dependencies for systemd-vconsole-setup.service

When the service is run in the initramfs, it is possible for it to get started
and not be fast enough to exit before the root switch happens. It is started
multiple times (depending on the consoles being detected), and runs
asynchronously, so this is quite likely. It'll then get killed by killall(),
and systemd will consider the service failed. To avoid all this, just wait
for the service to terminate on it's own.

Before=initrd-switch-root.target should be good for the initramfs, and
Before=shutdown.tuarget should be good for the real system, although it's
unlikely to make any difference there.

7 years agosystemctl: ignore SIGTERM after switch root
Zbigniew Jędrzejewski-Szmek [Mon, 30 Jan 2017 18:06:10 +0000 (13:06 -0500)]
systemctl: ignore SIGTERM after switch root

https://bugzilla.redhat.com/show_bug.cgi?id=1414904#c14 and #c15.

7 years agounits: drop KillMode= from initrd-switch-root.service
Zbigniew Jędrzejewski-Szmek [Sun, 29 Jan 2017 17:45:51 +0000 (12:45 -0500)]
units: drop KillMode= from initrd-switch-root.service

The service already has DefaultDeps disabled, so systemd should not try to stop
it. And if it *does* get stopped, we don't want the zombie process around.
KillMode=none does not change anything in the killall() phase, and we already
use argv[0][0] = '@' to protect against that anyway. KillMode=none should not
be useful in normal operation, so let's leave it out.

7 years agosystemctl: always avoid being killed when doing switch-root
Zbigniew Jędrzejewski-Szmek [Sun, 29 Jan 2017 02:18:31 +0000 (21:18 -0500)]
systemctl: always avoid being killed when doing switch-root

The same logic as described in acc28e2e3037d689d6481e applies to any time we are
switching root, to just set the flag unconditionally.

7 years agopid1: rewrite check in ignore_proc() to not check condition twice
Zbigniew Jędrzejewski-Szmek [Sun, 29 Jan 2017 02:09:08 +0000 (21:09 -0500)]
pid1: rewrite check in ignore_proc() to not check condition twice

It's harmless, but it seems nicer to evaluate a condition just a single time.

7 years agoboot: fix two typos
Zbigniew Jędrzejewski-Szmek [Sat, 28 Jan 2017 04:06:57 +0000 (23:06 -0500)]
boot: fix two typos

7 years agologind: trivial simplification
Zbigniew Jędrzejewski-Szmek [Sat, 28 Jan 2017 02:50:06 +0000 (21:50 -0500)]
logind: trivial simplification

free_and_strdup() handles NULL arg, so make use of that.

7 years agojournal-gatewayd: return -EINVAL if ARG_TRUST and HAVE_GNUTLS (#5181)
Yi EungJun [Mon, 30 Jan 2017 15:24:06 +0000 (00:24 +0900)]
journal-gatewayd: return -EINVAL if ARG_TRUST and HAVE_GNUTLS (#5181)

This bug was introduced by 1aa1e59.

7 years agojournal-gatewayd: actually recognize -D as a synonym for --directory (#5180)
Ivan Shapovalov [Sun, 29 Jan 2017 19:33:37 +0000 (23:33 +0400)]
journal-gatewayd: actually recognize -D as a synonym for --directory (#5180)

7 years agohwdb: Asus TP500LB accelerometer support
M0Rf30 [Sat, 28 Jan 2017 22:48:55 +0000 (23:48 +0100)]
hwdb: Asus TP500LB accelerometer support

7 years agohwdb: references added to hwdb rules format, needed to write syntax-correctly rules
M0Rf30 [Sat, 28 Jan 2017 22:48:15 +0000 (23:48 +0100)]
hwdb: references added to hwdb rules format, needed to write syntax-correctly rules

7 years agohwdb: use -y option to udevadm trigger to correctly do sysname-match
M0Rf30 [Sat, 28 Jan 2017 12:49:40 +0000 (13:49 +0100)]
hwdb: use -y option to udevadm trigger to correctly do sysname-match

7 years agobuild-sys,hostnamed: allow distributions to override the "localhost" fallback
Zbigniew Jędrzejewski-Szmek [Sat, 28 Jan 2017 04:36:01 +0000 (23:36 -0500)]
build-sys,hostnamed: allow distributions to override the "localhost" fallback

A configure param is added to make this easy to change if distributions want
to differentiate on that. The default remains unchanged.

https://bugzilla.redhat.com/show_bug.cgi?id=1392925#c10

7 years agoconfigure: use lowercase for "nobody" and "system"
Zbigniew Jędrzejewski-Szmek [Sat, 28 Jan 2017 04:18:29 +0000 (23:18 -0500)]
configure: use lowercase for "nobody" and "system"

No reason to capitalize words which are not names. And "nobody" is
a user name, traditionally lowercase.

7 years agoudev-event: use in-place whitespace replacement
Dan Streetman [Thu, 26 Jan 2017 19:18:10 +0000 (14:18 -0500)]
udev-event: use in-place whitespace replacement

Instead of using a temp buffer to replace whitespace in variable
substitutions, just allow util_replace_whitespace to replace in-place.
Add a comment to util_replace_whitespace indicating it is used to replace
in-place, to prevent accidental future breakage.

7 years agoudev-event: refactor udev_event_apply_format
Dan Streetman [Thu, 26 Jan 2017 01:06:54 +0000 (20:06 -0500)]
udev-event: refactor udev_event_apply_format

Move the large case statement into its own function

7 years agozsh-completion: _journalctl fixes (#5165)
llua [Fri, 27 Jan 2017 12:50:40 +0000 (07:50 -0500)]
zsh-completion: _journalctl fixes (#5165)

allow _journalctl to work when the rcquotes option is set, broken in ba89f80620d619867b4838973785d529c5a959f6.
allow the completion of --file multiple times, which ba89f80620d619867b4838973785d529c5a959f6 claims is true.

Fixes #4842

7 years agotests: add tests for SYMLINK containing whitespace in variable (#5158)
Dan Streetman [Thu, 26 Jan 2017 01:24:52 +0000 (20:24 -0500)]
tests: add tests for SYMLINK containing whitespace in variable (#5158)

add udev-test.pl tests for whitespace in a substituted variable,
to verify the variable whitespace is replaced with underscores.

Tests for the change made by commit 0a10235ed453 ("udev-rules:
perform whitespace replacement for symlink subst values")

7 years agohwdb: add Razer DeathAdder Black Edition (#5157)
clearyf [Thu, 26 Jan 2017 01:20:17 +0000 (02:20 +0100)]
hwdb: add Razer DeathAdder Black Edition (#5157)

7 years agoMerge pull request #5152 from keszybz/strv-free
Evgeny Vereshchagin [Wed, 25 Jan 2017 13:31:11 +0000 (16:31 +0300)]
Merge pull request #5152 from keszybz/strv-free

Use strv_free where appropriate

7 years agobash-completion: add support for --now (#5155)
Jan Synacek [Wed, 25 Jan 2017 12:44:04 +0000 (13:44 +0100)]
bash-completion: add support for --now (#5155)

7 years agoresolve: fix strv memleak
Zbigniew Jędrzejewski-Szmek [Wed, 25 Jan 2017 03:27:21 +0000 (22:27 -0500)]
resolve: fix strv memleak

sd_bus_message_read_strv() returns a normal strv...

7 years agocore/execute: fix strv memleak
Zbigniew Jędrzejewski-Szmek [Wed, 25 Jan 2017 03:24:07 +0000 (22:24 -0500)]
core/execute: fix strv memleak

compile_read_write_paths() returns a normal strv from strv_copy(), and
setup_namespace() uses it read-only, so we should use strv_free to deallocate.

7 years agocore/dbus: fix two strv memleaks
Zbigniew Jędrzejewski-Szmek [Wed, 25 Jan 2017 03:21:16 +0000 (22:21 -0500)]
core/dbus: fix two strv memleaks

job_dbus_path and unit_dbus_path both allocate new strings, so we should use
strv_free.

7 years agocore: fix memleak in bus_exec_context_set_transient_property (#5143)
Evgeny Vereshchagin [Wed, 25 Jan 2017 02:53:50 +0000 (05:53 +0300)]
core: fix memleak in bus_exec_context_set_transient_property (#5143)

Fixes:
```sh
systemd-run --property EnvironmentFile=/some/environment/file /bin/sleep 30
```
```
 23 bytes in 1 blocks are definitely lost in loss record 1 of 7
    at 0x4C2DB9D: malloc (vg_replace_malloc.c:299)
    by 0x4E85488: malloc_multiply (alloc-util.h:70)
    by 0x4E85F19: strjoin_real (string-util.c:252)
    by 0x1AF741: bus_exec_context_set_transient_property (dbus-execute.c:1418)
    by 0x1A907C: bus_service_set_property (dbus-service.c:330)
    by 0x1A66DD: bus_unit_set_properties (dbus-unit.c:1456)
    by 0x19CF93: transient_unit_from_message (dbus-manager.c:892)
    by 0x19D388: method_start_transient_unit (dbus-manager.c:980)
    by 0x4F60544: method_callbacks_run (bus-objects.c:418)
    by 0x4F62D9D: object_find_and_run (bus-objects.c:1255)
    by 0x4F633CE: bus_process_object (bus-objects.c:1371)
    by 0x4F2CE1D: process_message (sd-bus.c:2563)
```
Closes: #5142

7 years agopo: Fix invalid date in Croatian translation (#5147)
Jakub Wilk [Wed, 25 Jan 2017 02:45:58 +0000 (03:45 +0100)]
po: Fix invalid date in Croatian translation (#5147)

7 years agotree-wide: remove consecutive duplicate words in comments (#5148)
Stefan Schweter [Wed, 25 Jan 2017 02:45:30 +0000 (03:45 +0100)]
tree-wide: remove consecutive duplicate words in comments (#5148)

7 years agovirt: update url to hypervisor top-level functional specification (#5149)
Stefan Schweter [Wed, 25 Jan 2017 02:44:59 +0000 (03:44 +0100)]
virt: update url to hypervisor top-level functional specification (#5149)

7 years agocatalog: make support URL to show in shipped catalog entries configurable (#5150)
Stefan Schweter [Wed, 25 Jan 2017 02:44:19 +0000 (03:44 +0100)]
catalog: make support URL to show in shipped catalog entries configurable (#5150)

7 years agojournal-file, journalctl: provide better hint about unsupported features
Zbigniew Jędrzejewski-Szmek [Wed, 25 Jan 2017 00:19:33 +0000 (19:19 -0500)]
journal-file, journalctl: provide better hint about unsupported features

https://bugzilla.redhat.com/show_bug.cgi?id=1416201

$ journalctl -b
Journal file /var/log/journal/ad18f69b80264b52bb3b766240742383/system@0005467d92e23784-a6571c8b69d09124.journal~ uses an unsupported feature, ignoring file.
Use SYSTEMD_LOG_LEVEL=debug journalctl --file=/var/log/journal/ad18f69b80264b52bb3b766240742383/system@0005467d92e23784-a6571c8b69d09124.journal~ to see the details.
-- No entries --

$ journalctl --file=/var/log/journal/ad18f69b80264b52bb3b766240742383/system@0005467d92e23784-a6571c8b69d09124.journal~
Journal file /var/log/journal/ad18f69b80264b52bb3b766240742383/system@0005467d92e23784-a6571c8b69d09124.journal~ uses incompatible flag lz4-compressed disabled at compilation time.
Failed to open journal file /var/log/journal/ad18f69b80264b52bb3b766240742383/system@0005467d92e23784-a6571c8b69d09124.journal~: Protocol not supported
mmap cache statistics: 0 hit, 1 miss
Failed to open files: Protocol not supported

7 years agojournal-file: factor out helper function
Zbigniew Jędrzejewski-Szmek [Wed, 25 Jan 2017 00:00:23 +0000 (19:00 -0500)]
journal-file: factor out helper function

In preparation for later changes.

7 years agonetworkd: Allow ':' in label
Susant Sahani [Tue, 24 Jan 2017 18:37:52 +0000 (00:07 +0530)]
networkd: Allow ':' in label

IFA_LABEL does not need much of a validation except the length
that is IFNAMSIZ as seen from kernel code.

7 years agosocket-utils: revert f1811313f42dc7ddaed3c47edc834c2bfd1309b2
Susant Sahani [Tue, 24 Jan 2017 18:24:34 +0000 (23:54 +0530)]
socket-utils: revert f1811313f42dc7ddaed3c47edc834c2bfd1309b2

':' in not a a valid interface name.

7 years agocore: don't load dropin data multiple times for the same unit (#5139)
Franck Bui [Tue, 24 Jan 2017 13:29:57 +0000 (14:29 +0100)]
core: don't load dropin data multiple times for the same unit (#5139)

When an alias is loaded, we resolve this alias to its final unit first to load
the dropin data.

However if the final unit was already loaded, there's no point in reloading the
dropin data a second time.

This patch optimizes this case.

Also this allows the dropin loading code to assume that only units not yet
loaded are passed down. This assumption is not yet used but might be in the
future.

[zj: invert the condition in the if]

7 years agonetwork: accept colons in network interface names, normally used for alias interfaces...
peoronoob [Tue, 24 Jan 2017 03:26:41 +0000 (04:26 +0100)]
network: accept colons in network interface names, normally used for alias interfaces (#5117)

7 years agocore: improve error message when RefuseManualStart(Stop) is hit (#5132)
Jan Synacek [Tue, 24 Jan 2017 03:06:05 +0000 (04:06 +0100)]
core: improve error message when RefuseManualStart(Stop) is hit (#5132)

7 years agoload-fragment: fix comment to reflect changes made in 43eb109 (#5138)
Michal Sekletar [Tue, 24 Jan 2017 02:18:40 +0000 (03:18 +0100)]
load-fragment: fix comment to reflect changes made in 43eb109 (#5138)

7 years agoREADME: document CONFIG_USER_NS requirement for PrivateUsers (#5140)
Lucas Werkmeister [Tue, 24 Jan 2017 02:18:07 +0000 (03:18 +0100)]
README: document CONFIG_USER_NS requirement for PrivateUsers (#5140)

7 years agosd-network: fix memleak in dhcp6_lease_set_domains (#5113)
Evgeny Vereshchagin [Tue, 24 Jan 2017 02:12:58 +0000 (05:12 +0300)]
sd-network: fix memleak in dhcp6_lease_set_domains (#5113)

The simplest way to reproduce:
```diff
diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c
index bd289fa..4e14d8f 100644
--- a/src/libsystemd-network/test-dhcp6-client.c
+++ b/src/libsystemd-network/test-dhcp6-client.c
@@ -286,6 +286,8 @@ static int test_advertise_option(sd_event *e) {
                         assert_se(optlen == 11);
                         assert_se(dhcp6_lease_set_domains(lease, optval,
                                                           optlen) >= 0);
+                        assert_se(dhcp6_lease_set_domains(lease, optval,
+                                                          optlen) >= 0);
                         break;

                 case SD_DHCP6_OPTION_SNTP_SERVERS:
```

Fixes:
```
==27369==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 10 byte(s) in 1 object(s) allocated from:
    #0 0x7f90e7d21160 in strdup (/lib64/libasan.so.3+0x5a160)
    #1 0x7f90e7467f69 in strv_extend src/basic/strv.c:552
    #2 0x5612fcc19379 in dhcp6_option_parse_domainname src/libsystemd-network/dhcp6-option.c:399
    #3 0x5612fcc1acdf in dhcp6_lease_set_domains src/libsystemd-network/sd-dhcp6-lease.c:225
    #4 0x5612fcc06b95 in test_advertise_option src/libsystemd-network/test-dhcp6-client.c:287
    #5 0x5612fcc0a987 in main src/libsystemd-network/test-dhcp6-client.c:761
    #6 0x7f90e6d46400 in __libc_start_main (/lib64/libc.so.6+0x20400)

SUMMARY: AddressSanitizer: 10 byte(s) leaked in 1 allocation(s).
```

7 years agosd-network: fix memleak in dhcp6_option_parse_domainname (#5114)
Evgeny Vereshchagin [Tue, 24 Jan 2017 02:11:59 +0000 (05:11 +0300)]
sd-network: fix memleak in dhcp6_option_parse_domainname (#5114)

The simplest way to reproduce:
```diff
diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c
index bd289fa..7b0a5ef 100644
--- a/src/libsystemd-network/test-dhcp6-client.c
+++ b/src/libsystemd-network/test-dhcp6-client.c
@@ -168,7 +168,7 @@ static uint8_t msg_advertise[198] = {
         0x00, 0x17, 0x00, 0x10, 0x20, 0x01, 0x0d, 0xb8,
         0xde, 0xad, 0xbe, 0xef, 0x00, 0x00, 0x00, 0x00,
         0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x0b,
-        0x03, 0x6c, 0x61, 0x62, 0x05, 0x69, 0x6e, 0x74,
+        0x01, 0x6c, 0x01, 0x62, 0x00, 0x0a, 0x6e, 0x74,
         0x72, 0x61, 0x00, 0x00, 0x1f, 0x00, 0x10, 0x20,
         0x01, 0x0d, 0xb8, 0xde, 0xad, 0xbe, 0xef, 0x00,
         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
@@ -338,9 +338,7 @@ static int test_advertise_option(sd_event *e) {
         assert_se(!memcmp(addrs, &msg_advertise[124], r * 16));

         r = sd_dhcp6_lease_get_domains(lease, &domains);
-        assert_se(r == 1);
-        assert_se(!strcmp("lab.intra", domains[0]));
-        assert_se(domains[1] == NULL);
+        assert_se(r == -ENOENT);

         r = sd_dhcp6_lease_get_ntp_addrs(lease, &addrs);
         assert_se(r == 1);
```

Fixes:
```
=================================================================
==15043==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x7f13c8564160 in strdup (/lib64/libasan.so.3+0x5a160)
    #1 0x7f13c7caaf69 in strv_extend src/basic/strv.c:552
    #2 0x55f775787230 in dhcp6_option_parse_domainname src/libsystemd-network/dhcp6-option.c:399
    #3 0x55f775788b96 in dhcp6_lease_set_domains src/libsystemd-network/sd-dhcp6-lease.c:225
    #4 0x55f775774b95 in test_advertise_option src/libsystemd-network/test-dhcp6-client.c:287
    #5 0x55f77577883e in main src/libsystemd-network/test-dhcp6-client.c:759
    #6 0x7f13c7589400 in __libc_start_main (/lib64/libc.so.6+0x20400)

Direct leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x7f13c8564160 in strdup (/lib64/libasan.so.3+0x5a160)
    #1 0x7f13c7caaf69 in strv_extend src/basic/strv.c:552
    #2 0x55f775787230 in dhcp6_option_parse_domainname src/libsystemd-network/dhcp6-option.c:399
    #3 0x55f775788b96 in dhcp6_lease_set_domains src/libsystemd-network/sd-dhcp6-lease.c:225
    #4 0x55f775781348 in client_parse_message src/libsystemd-network/sd-dhcp6-client.c:807
    #5 0x55f775781ba2 in client_receive_advertise src/libsystemd-network/sd-dhcp6-client.c:895
    #6 0x55f775782453 in client_receive_message src/libsystemd-network/sd-dhcp6-client.c:994
    #7 0x7f13c7e447f4 in source_dispatch src/libsystemd/sd-event/sd-event.c:2268
    #8 0x7f13c7e471b0 in sd_event_dispatch src/libsystemd/sd-event/sd-event.c:2627
    #9 0x7f13c7e47ab3 in sd_event_run src/libsystemd/sd-event/sd-event.c:2686
    #10 0x7f13c7e47c21 in sd_event_loop src/libsystemd/sd-event/sd-event.c:2706
    #11 0x55f77577863c in test_client_solicit src/libsystemd-network/test-dhcp6-client.c:737
    #12 0x55f77577884b in main src/libsystemd-network/test-dhcp6-client.c:760
    #13 0x7f13c7589400 in __libc_start_main (/lib64/libc.so.6+0x20400)

SUMMARY: AddressSanitizer: 8 byte(s) leaked in 2 allocation(s).
```

7 years agohwdb: mark Wacom touchpads as external (#5115)
Peter Hutterer [Tue, 24 Jan 2017 02:10:33 +0000 (12:10 +1000)]
hwdb: mark Wacom touchpads as external (#5115)

Wacom doesn't have any internal touchpads.

7 years agoMerge pull request #5112 from yuwata/fix-5105
Zbigniew Jędrzejewski-Szmek [Tue, 24 Jan 2017 01:20:13 +0000 (20:20 -0500)]
Merge pull request #5112 from yuwata/fix-5105

core: add missing unit_add_to_load_queue() to mount_setup_new_unit()

7 years agocore: add missing unit_add_to_load_queue() to mount_setup_new_unit()
Yu Watanabe [Fri, 20 Jan 2017 00:46:47 +0000 (09:46 +0900)]
core: add missing unit_add_to_load_queue() to mount_setup_new_unit()

unit_add_to_load_queue was present in the code before 03b8cfede9ff3441b1ec8ff5cdf6876294846aa4,
and was inadvertently dropped.

Fixes #5105

7 years agocore: minor error handling fix in mount_setup_new_unit()
Yu Watanabe [Fri, 20 Jan 2017 00:45:58 +0000 (09:45 +0900)]
core: minor error handling fix in mount_setup_new_unit()

The function mount_setup_new_unit() should return -ENOMEM
if at least one of `strdup` calls are failed.