summaryrefslogtreecommitdiff
path: root/src/shared
AgeCommit message (Collapse)Author
2017-04-24redirect stdout/stderr back when closing the pager (#5661)Matija Skala
2017-04-21Merge pull request #5756 from keszybz/make-cleanupsMartin Pitt
Various meson-independent cleanups from the meson patchset
2017-04-21bus: include sd-{bus,messages}.h the same as other systemd headersZbigniew Jędrzejewski-Szmek
This is our own header, we should include use the local-include syntax ("" not <>), to make it clear we are including the one from the build tree. All other includes of files from src/systemd/ use this scheme.
2017-04-21libshared: fix compilation without libblkidZbigniew Jędrzejewski-Szmek
This reverts a75e27eb. a75e27eb fixed the case of libcryptsetup=no, libblkid=yes, but broke the case of libcryptsetup=no, libblkid=yes. Instead of trying to define the function only when used, which would result in too much ifdeffery, just silence the warning.
2017-04-19tree-wide: fix wrong indent (#5757)Yu Watanabe
Fixes wrong indent introduced by the commit 43688c49d1fdb585196d94e2e30bb29755fa591b.
2017-04-04shared/dissect-image: fix warning about unused function when !HAVE_BLKIDZbigniew Jędrzejewski-Szmek
2017-03-16Merge (¾ of) pull request #5596 from matijaskala/masterZbigniew Jędrzejewski-Szmek
2017-03-15base-filesystem: skip fchownat() if the previous mkdirat() on same path ↵Djalal Harouni
failed (#5548) If we are working on a path that was marked to be ignored on errors, and the mkdirat() fails then add a continue statement and skip fchownat() call. This avoids the case where UID/GID are valid and we run fchownat() on non existent path which will fail hard even on paths that we want to ignore in case of errors.
2017-03-16assigning stdout and stderr is not allowedMatija Skala
2017-03-02Avoid strict DM interface version dependencies (#5519)Michael Biebl
Compiling against the dm-ioctl.h header as provided by the Linux kernel will embed the DM interface version number. Running an older kernel can result in an error like this on shutdown: Could not detach DM dm-11: ioctl mismatch, kernel(4.34.4), user(4.35.4) Work around this by shipping a local copy of dm-ioctl.h. We need at least the version from 3.13 for DM_DEFERRED_REMOVE [1], so bump the requirements in README accordingly. [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=2c140a246dc0bc085b98eddde978060fcec1080c Fixes: #5492
2017-02-28journalctl: move access_check() to shared/Zbigniew Jędrzejewski-Szmek
The only functional change is that log_notice("No journal files were found.") is not printed any more with --quiet. log_error("No journal files were opened due to insufficient permissions.") is still printed. I wasn't quite sure where to put this function, but shared/ seems to be the right place and none of the existing files seem to fit too well. v2: rename journal_access_check to journal_access_check_and_warn.
2017-02-25Merge pull request #5449 from keszybz/blkd-error-handlingMartin Pitt
blkid error handling
2017-02-24Fix missing space in comments (#5439)AsciiWolf
2017-02-21tree-wide: simplify handling of blkid errorsZbigniew Jędrzejewski-Szmek
2017-02-21Merge pull request #5131 from keszybz/environment-generatorsLennart Poettering
Environment generators
2017-02-20environment-generator: new generator to peruse environment.dZbigniew Jędrzejewski-Szmek
Why the strange name: the prefix is necessary to follow our own advice that environment generators should have numerical prefixes. I also put -d- in the name because otherwise the name was very easy to mistake with systemd.environment-generator. This additional letter clarifies that this on special generator that supports environment.d files.
2017-02-20shared/pager: abort if we cannot set environment variablesZbigniew Jędrzejewski-Szmek
This most likely means oom, it's better to exit than to run less with incomplete settings. CID #714383.
2017-02-20firewall-util: add an assert that we're not overwriting a bufferZbigniew Jędrzejewski-Szmek
Check for CID #1368267.
2017-02-17systemctl: show extra args if defined (#5379)Adrián López
2017-02-17copy: change the various copy_xyz() calls to take a unified flags parameterLennart Poettering
This adds a unified "copy_flags" parameter to all copy_xyz() function calls, replacing the various boolean flags so far used. This should make many invocations more readable as it is clear what behaviour is precisely requested. This also prepares ground for adding support for more modes later on.
2017-02-16test: drop TEST_DATA_DIR, fold into get_testdata_dir()Martin Pitt
Drop the TEST_DATA_DIR macro as this was using alloca() within a function call which is allegedly unsafe. So add a "suffix" argument to get_testdata_dir() instead and call that directly.
2017-02-16test: show error message if $SYSTEMD_TEST_DATA does not existMartin Pitt
Rename get_exe_relative_testdata_dir() to get_testdata_dir() and move the env var check into that, so that everything interesting happens at the same place.
2017-02-16tests: look for tests relative to source dir when running from build dirZbigniew Jędrzejewski-Szmek
automake helpfully sets a few variables for during build. When our executable is in a directory underneath $(abs_top_builddir), we know that we're in the build environment $(abs_top_srcdir) contains the sources, and test data is under $(abs_top_srcdir)/test. This remains true no matter where the build directory is relative to the source directory. It also works if the test executable is invoked as ./test-whatever or .libs/test-whatever, since the relative path is not used at all. When running from outside of the build directory, we should be running from the installed location and we can look for ../testdata relative to the location of the exe file. Of course, $SYSTEMD_TEST_DATA always overrides this logic.
2017-02-16Rename $TEST_DIR to $SYSTEMD_TEST_DATA, document itZbigniew Jędrzejewski-Szmek
TEST_DIR is rather generic, and we prefix all variables used by installed executables with "SYSTEMD_".
2017-02-16test: clarify error message if test data directory does not existMartin Pitt
When trying to directly run a test executable in the build tree without setting $TEST_DIR, some tests fail with a non-obvious error message. Print an useful one instead.
2017-02-14Define clone order on ppc (#5325)Zbigniew Jędrzejewski-Szmek
This was tested on ppc64le. Assume the same is true for ppc64.
2017-02-13test: make unit tests relocatableMartin Pitt
It is useful to package test-* binaries and run them as root under autopkgtest or manually on particular machines. They currently have a built-in hardcoded absolute path to their test data, which does not work when running the test programs from any other path than the original build directory. By default, make the tests look for their data in <test_exe_directory>/testdata/ so that they can be called from any directory (provided that the corresponding test data is installed correctly). As we don't have a fixed static path in the build tree (as build and source tree are independent), set $TEST_DIR with "make check" to point to <srcdir>/test/, as we previously did with an automake variable.
2017-02-12seccomp: disable RestrictAddressFamilies= for the ABI we shall block, not ↵Lennart Poettering
the one we are compiled for (#5272) It's a difference. Not a big one, but let's be correct here.
2017-02-12Merge pull request #5276 from poettering/resolved-cnameZbigniew Jędrzejewski-Szmek
a good number of resolved fixes
2017-02-12shared: pass *unsigned_long to namespace_flag_from_string_many (#5315)Evgeny Vereshchagin
Fixes: ``` src/shared/bus-unit-util.c: In function ‘bus_append_unit_property_assignment’: src/shared/bus-unit-util.c:570:65: warning: passing argument 2 of ‘namespace_flag_from_string_many’ from incompatible pointer type [-Wincompatible-pointer-types] r = namespace_flag_from_string_many(eq, &flags); ^ In file included from src/shared/bus-unit-util.c:31:0: src/shared/nsflags.h:41:5: note: expected ‘long unsigned int *’ but argument is of type ‘uint64_t * {aka long long unsigned int *}’ int namespace_flag_from_string_many(const char *name, unsigned long *ret); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` Closes #5312
2017-02-12shared: convert unsigned long to uint64_t explicitly (#5314)Evgeny Vereshchagin
Closes #5313
2017-02-12Merge pull request #5303 from poettering/deleted-unitsZbigniew Jędrzejewski-Szmek
a small number of install and unit management related fixes
2017-02-10seccomp: order seccomp ABI list, so that our native ABI comes last (#5306)Lennart Poettering
this way, we can still call seccomp ourselves, even if seccomp() is blocked by the filter we are installing. Fixes: #5300
2017-02-10path-lookup: if $HOME can be determined but $XDG_RUNTIME_DIR can't, is itLennart Poettering
So far, if either $HOME or $XDG_RUNTIME_DIR is not set we wouldn't use either, and fail acquire_config_dirs() and acquire_control_dirs() in their entireties. With this change, let's make use of the variables we can acquire, and don't bother with the other. Specifically this means: in both acquire_config_dirs() and acquire_control_dirs() handle ENXIO from user_config_dir() and user_runtime_dir() directly, instead of propagating it up and handling it in the caller.
2017-02-10path-lookup: drop redundant strv_isempty() checkLennart Poettering
If the strv is empty, then strv_extend_strv_concat() is a NOP anyway, and hence there is no reason to guard for this explicitly.
2017-02-10path-lookup: try harder acquiring them $HOME of a userLennart Poettering
Let's use get_home_dir() for figuring out the home directory, so that there's a good chance we succeed figuring out unit locations even if $HOME isn't set. Fixes: #5260
2017-02-10install: never hit assert() when we can't figure out where to write ↵Lennart Poettering
configuration symlinks Under specific circumstances it might happen that we can't figure out where to place our symlinks, for example because we are supposed to create them in the runtime directory but $XDG_RUNTIME_DIR is not set. In this case, return -ENXIO instead of hitting an assert(). (Yeah, the error isn't very descriptive, but for now this should at least be good enough to remove the assert() being hit.)
2017-02-10install: when disabling units, do so even if the unit is missingLennart Poettering
In some cases there might be unit symlinks in .wants/ or .requires/ directories even though the unit is otherwise fully removed. In this case, don't fail removal, but still remove the symlinks. This reworks the symlink marking logic to always add unit files that we are missing to the changes list, but proceed with any symlink removal for them. This way we'll still generate useful hints that a unit is missing if you invoke "systemctl disable idontexist.service", but also still remove any link to it. Fixes: #4995
2017-02-09seccomp: add forgotten munmap() syscall to @file-system (#5291)Lennart Poettering
We added mmap() and mmap2(), but forgot munmap(). Fix that. Pointed out by @lucaswerkmeister: https://github.com/systemd/systemd/pull/4537#issuecomment-273275298
2017-02-09dropin: always initialize return parameters on successLennart Poettering
Just as a matter of coding style: whenever we return successfully, let's make sure all our return parameters are properly initialized to something.
2017-02-09dropin: let's reduce duplicate a bitLennart Poettering
After generating the template name we can shortcut things and just call unit_file_find_dirs() from inside itself, just with the new name and save a good number of duplicate lines.
2017-02-09dropin: let's prefer strjoina() over strjoin()Lennart Poettering
2017-02-09dropin: downgrade logging about paths we cannot canonicalizeLennart Poettering
After all, most units won't have drop-in dirs, hence there's no point in logging about that. Fixes: #5252
2017-02-09tree-wide: make bus_map_all_properties return a proper sd_bus_errorLennart Poettering
And then show it, to make things a bit friendlier to the user if we fail acquiring some props. In fact, this fixes a number of actual bugs, where we used an error structure for output that we actually never got an error in.
2017-02-08Merge pull request #4962 from poettering/root-directory-2Zbigniew Jędrzejewski-Szmek
Add new MountAPIVFS= boolean unit file setting + RootImage=
2017-02-08seccomp: on s390 the clone() parameters are reversedLennart Poettering
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
2017-02-08seccomp: MemoryDenyWriteExecute= should affect both mmap() and mmap2() (#5254)Lennart Poettering
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
2017-02-08Merge pull request #5231 from keszybz/mask-wantsLennart Poettering
Mask individual .wants/.requires symlinks
2017-02-07dissect: don't honour NOAUTO flags when looking for ESP (#5224)Lennart Poettering
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
2017-02-07core: drop code that is now unusedZbigniew Jędrzejewski-Szmek