summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-11-30util-lib: add cleanup function for crypt_freeZbigniew Jędrzejewski-Szmek5-32/+45
2017-11-30util-lib: rename path_check_fstype to path_is_fs_typeZbigniew Jędrzejewski-Szmek4-11/+11
2017-11-30util-lib: rename fd_check_fstype to fd_is_fs_typeZbigniew Jędrzejewski-Szmek3-4/+4
Let's use "is" and "fs_type" for consistency with "is_fs_type". "check" is also more ambiguous than "is".
2017-11-30util-lib: use trailing slash in chase_symlinks, fd_is_mount_point, ↵Zbigniew Jędrzejewski-Szmek7-16/+113
path_is_mount_point The kernel will reply with -ENOTDIR when we try to access a non-directory under a name which ends with a slash. But our functions would strip the trailing slash under various circumstances. Keep the trailing slash, so that path_is_mount_point("/path/to/file/") return -ENOTDIR when /path/to/file/ is a file. Tests are added for this change in behaviour. Also, when called with a trailing slash, path_is_mount_point() would get "" from basename(), and call name_to_handle_at(3, "", ...), and always return -ENOENT. Now it'll return -ENOTDIR if the mount point is a file, and true if it is a directory and a mount point. v2: - use strip_trailing_chars() v3: - instead of stripping trailing chars(), do the opposite — preserve them.
2017-11-30test-string-util: add another test for stripping slashesZbigniew Jędrzejewski-Szmek1-0/+14
I wrote this for my own "strip_trailing_chars" function, which was in the meanwhile obsoleted by "delete_trailing_chars". Let's just keep the test.
2017-11-30Add a helper for /dev/block/major:minor pathsZbigniew Jędrzejewski-Szmek3-15/+17
2017-11-30Add a little helper to make /sys/dev/block/major:minor pathsZbigniew Jędrzejewski-Szmek4-46/+34
2017-11-30test-mount-util: move test_path_is_mount_point hereZbigniew Jędrzejewski-Szmek2-139/+140
path-util.c and mount-util.c are intertwined, but path_is_mount_point() is defined in mount-util.c. No functional difference.
2017-11-30core/dbus-execute: actually set PassEnvironment= (#7510)Yu Watanabe1-0/+4
Follow-up for #7444.
2017-11-30man: fix typo (#7511)Yu Watanabe1-1/+1
2017-11-30Fix SELinux labels in cgroup filesystem root directory (#7496)Krzysztof Nowicki1-1/+11
When using SELinux with legacy cgroups the tmpfs on /sys/fs/cgroup is by default labelled as tmpfs_t. This label is also inherited by the "cpu" and "cpuacct" symbolic links. Unfortunately the policy expects them to be labelled as cgroup_t, which is used for all the actual cgroup filesystems. Failure to do so results in a stream of denials. This state cannot be fixed reliably when the cgroup filesystem structure is set-up as the SELinux policy is not yet loaded at this moment. It also cannot be fixed later as the root of the cgroup filesystem is remounted read-only. In order to fix it the root of the cgroup filesystem needs to be temporary remounted read-write, relabelled and remounted back read-only.
2017-11-30core: support upgrading from DynamicUser=0 to DynamicUser=1 for unit ↵Lennart Poettering1-4/+19
directories (#7507) This makes sure we migrate /var/lib/<foo> if it exists to /var/lib/private/<foo> if DynamicUser=1 is set. This is useful to allow turning on DynamicUser= on services that previously didn't use it, and we can deal with this, and migrate the relevant directories as necessary. Note that "downgrading" from DynamicUser=1 backto DynamicUser=0 works too. However in that case we simply continue to use /var/lib/private/<foo>, which works because /var/lib/<foo> is a symlink there after all.
2017-11-30Merge pull request #7444 from poettering/dbus-no-specYu Watanabe65-919/+1703
unit writing escaping fixes + related fixes and additions
2017-11-29Merge pull request #7508 from poettering/journal-n-dropVito Caputo1-1/+1
journal: fix log message when dropping messages
2017-11-29journal: fix log message when dropping messagesLennart Poettering1-1/+1
Fixes: #7506
2017-11-29update TODOLennart Poettering1-33/+4
2017-11-29bus-unit-util: slightly tweak log output for unknown propsLennart Poettering1-1/+1
Pretty: Unknown assignment Foo=bar. Prettier: Unknown assignment: Foo=bar
2017-11-29run: rearrange error handling when adding unit propertiesLennart Poettering1-48/+53
Let's always leave logging to the call that actually added the fields to the bus message. This way we don't get duplicate logging whenver bus_append_unit_property_assignment() ends up being called, which does all its logging on its own (and probably should do, as it can output much more precise errors).
2017-11-29bus-unit-util: add proper MemorySwapMax= serializationLennart Poettering1-1/+1
Fixes: #7505
2017-11-29core: accept MemorySwapMax= properties that are scaled, tooLennart Poettering1-3/+5
Let's do what we already do for MemoryMax= and friends for MemorySwapMax= too.
2017-11-29tty-ask-password-agent: drop NULL sentinelLennart Poettering1-1/+1
found by coccinelle
2017-11-29coccinelle: add a run-coccinelle.sh script that runs all scriptsLennart Poettering1-0/+11
One day we should start running something like this as part of CI so that non-well-formed commits are not even accepted...
2017-11-29coccinelle: fix IN_SET/!IN_SET scripts, and apply some changes it foundLennart Poettering3-131/+57
IN_SET only works for constant values, hence clarify that. Moreover, we declared a statement "s" we never made use of. Drop it. Also, for both scripts, let's support 10 items. More causes spatch to die with "Stack overflow" for me.
2017-11-29Merge pull request #7493 from keszybz/revert-revertLennart Poettering2-2/+20
Revert "meson: drop rootprefix option"
2017-11-29Merge pull request #7504 from keszybz/two-mkosi-ideasLennart Poettering2-1/+2
Two mkosi tweaks
2017-11-29Merge pull request #7500 from poettering/journal-field-countLennart Poettering2-3/+12
fix journald field counts
2017-11-29Add mkosi.output/ to .gitignoreZbigniew Jędrzejewski-Szmek1-0/+1
It's not something that would ever be checked in, and mkosi along with systemd, so this directory is likely to appear.
2017-11-29mkosi: do not build man pagesZbigniew Jędrzejewski-Szmek1-1/+1
2017-11-29meson: emit a warning if rootprefix is setZbigniew Jędrzejewski-Szmek1-5/+13
It's printed at the end because it's the easiest to spot there. When meson is upgraded to 0.43.1, we'll be able to use warning() instead.
2017-11-29tree-wide: use strv_isempty() instead of strv_length() == 0Lennart Poettering5-10/+25
It's a lot faster in many cases, since it's O(1) rather than O(n).
2017-11-29bus-unit-util: properly serialize EnvironmentFile= empty assignmentLennart Poettering1-3/+6
In that case we need to generate an empty array.
2017-11-29tests: fix description of TEST-14-MACHINE-IDLennart Poettering1-1/+1
It used the same description as TEST-01, and that's hardly helpful.
2017-11-29core: use safe_fclose() where we canLennart Poettering1-5/+2
2017-11-29fileio: document why fileio-label.c and fileio.c are two different modulesLennart Poettering2-4/+13
2017-11-29documentation: add document listing all unit file settings also supported ↵Lennart Poettering1-0/+447
for transient units Unfortunately, there are far too many properties currently not accessible to transient units. The first step to opening them all up is to figure out which ones they are.
2017-11-29core: open up all ExecXYZ= fields of service units to transient unitsLennart Poettering2-5/+95
Fixes: #7400
2017-11-29core: never remove "transient" and "control" directories from unit search pathLennart Poettering3-8/+11
This changes the unit search path logic to never drop the transient and control directories from the unit search path. This is necessary as we add new entries to both during runtime, due to the "systemctl set-property" and transient unit logic. Previously, the "transient" directory was created during early boot to deal with this, but the "control" directories were not covered like that. Creating the control directories early at boot is not possible however, as /etc might be read-only then, and we do define a persistent control directory. Hence, let's create these dirs on-demand when we need them, and make sure the search path clean-up logic never drops them from the search path even if they are initially missing. (Also, always create these paths properly labelled)
2017-11-29core: don't reference rescue/emergency targets in --user modeLennart Poettering1-7/+9
They are only defined for system mode, hence let's not check for them in --user mode. Follow-up for #7433
2017-11-29core: minor simplificationLennart Poettering1-8/+4
2017-11-29path-lookup: LookupPathsFlags are a flags type, hence define it like oneLennart Poettering1-2/+2
We shouldn't rely on C's incremental assignment of values of enums for bit fields. That'll work only between the first two flags, but for everything following will break horrible. Hence, let's avoid any ambiguity here, and let's clearly define the flags as shifts of 1.
2017-11-29systemctl: reword "needs-reload" message a bitLennart Poettering1-1/+1
This message is displayed either when the unit file itself is newer than what is loaded, but also when any of the drop-ins is newer. Say so in the message, in order not to confuse the user unnecessarily.
2017-11-29core: allow changing the description for units dynamically at runtimeLennart Poettering1-2/+28
This makes "systemctl set-property foobar.service Description=waldo" work. See: #7245
2017-11-29tree-wide: generate SD_BUS_ERROR_INVALID_ARGS when we get invalid arguments ↵Lennart Poettering3-26/+26
on bus calls Let's make sure that when we return a D-Bus error, we return a native one, if we generate it ourselves, and use errno-based error synthetization only if we received an errno ourselves. Yes, this makes things slightly longer, but is highly misleading as we propagate D-Bus errors, and not errnos to the client.
2017-11-29core: add proper escaping to writing of drop-ins/transient unit filesLennart Poettering26-478/+602
This majorly refactors the transient unit file and drop-in writing logic, so that we properly C-escape and specifier-escape (% → %%) everything we write out, so that when we read it back again, specifiers are parsed that aren't supposed to be parsed. This renames unit_write_drop_in() and friends by unit_write_setting(). The name change is supposed to clarify that the functions are not only used to write drop-in files, but also transient unit files. The previous "mode" parameter to this function is replaced by a more generic "flags", which knows additional flags for implicit C-style and specifier escaping before writing things out. This can cover most properties where either form of escaping is defined. For the cases where this isn't sufficient, we add helpers unit_escape_setting() and unit_concat_strv() for escaping individual strings or strvs properly. While we are at it, we also prettify generation of transient unit files: we try to reduce the number of section headers written out: previously we'd write the right section header our for each setting. With this change we do so only if the setting lives in a different section than the one before. (This should also be considered preparation for when we add proper APIs to systemd to write normal, persistant unit files through the bus API)
2017-11-29logind: fix sysfs change trigger codeLennart Poettering1-1/+1
We can't create files in sysfs, hence don't bother. Also if we ignore the return value, do so explicitly by casting to void.
2017-11-29generators: be more careful when writing unit settings that support ↵Lennart Poettering6-33/+118
specifier expansion Let's always escape strings we receive from the user before writing them out to unit file settings that suppor specifier expansion, so that user strings are transported as-is.
2017-11-29core: enable specifier expansion for What=/Where=/Type=/SourcePath= tooLennart Poettering1-5/+5
Using specifiers in these settings isn't particularly useful by itself, but it unifies behaviour a bit. It's kinda surprising that What= in mount units resolves specifies, but Where= does not. Hence let's add that too. Also, it's surprising Where=/What= in mount units behaves differently than in automount and swap units, hence resolve specifiers there too. Then, Type= in mount units is nowadays an arbitrary, sometimes non-trivial string (think fuse!), hence let's also expand specifiers there, to match the rest of the mount settings. This has the benefit that when writing code that generates unit files, less care has to be taken to check whether escaping of specifiers is necessary or not: broadly everything that takes arbitrary user strings now does specifier expansion, while enums/numerics/booleans do not.
2017-11-29core: process C-style escapes in UnsetEnvironment=Lennart Poettering1-1/+1
We process C-style escapes in Environment=, hence we should process it in UnsetEnvironment= too, as the latter accepts assignments much like the former, including arbitrary values specified by the user.
2017-11-29core: use config_parse_unit_string_printf() for decoding RebootArgument=Lennart Poettering1-1/+1
All other cases where we accept a reboot argument are decoded with config_parse_unit_string_printf() rather than config_parse_unit_path_printf(), and that's really the only thing what makes sense here, hence adjust this here, too.
2017-11-29CODING_STYLE: document the order in which unescaping + specifier expansion ↵Lennart Poettering1-0/+5
should be done