summaryrefslogtreecommitdiffstats
path: root/src/test/test-load-fragment.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* Revert "basic/env-util: (mostly) follow POSIX for what variable names are ↵Zbigniew Jędrzejewski-Szmek2020-10-231-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | allowed" This reverts commit b45c068dd8fac7661a15e99e7cf699ff06010b13. I think the idea was generally sound, but didn't take into account the limitations of show-environment and how it is used. People expect to be able to eval systemctl show-environment output in bash, and no escaping syntax is defined for environment *names* (we only do escaping for *values*). We could skip such problematic variables in 'systemctl show-environment', and only allow them to be inherited directly. But this would be confusing and ugly. The original motivation for this change was that various import operations would fail. a4ccce22d9552dc74b6916cc5ec57f2a0b686b4f changed systemctl to filter invalid variables in import-environment. https://gitlab.gnome.org/GNOME/gnome-session/-/issues/71 does a similar change in GNOME. So those problematic variables should not cause failures, but just be silently ignored. Finally, the environment block is becoming a dumping ground. In my gnome session 'systemctl show-environment --user' includes stuff like PWD, FPATH (from zsh), SHLVL=0 (no idea what that is). This is not directly related to variable names (since all those are allowed under the stricter rules too), but I think we should start pushing people away from running import-environment and towards importing only select variables. https://github.com/systemd/systemd/pull/17188#issuecomment-708676511
* basic/env-util: (mostly) follow POSIX for what variable names are allowedZbigniew Jędrzejewski-Szmek2020-10-121-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was some confusion about what POSIX says about variable names: names shall not contain the character '='. For values to be portable across systems conforming to POSIX.1-2008, the value shall be composed of characters from the portable character set (except NUL and as indicated below). i.e. it allows almost all ASCII in variable names (without NUL and DEL and '='). OTOH, it says that *utilities* use a smaller set of characters: Environment variable names used by the utilities in the Shell and Utilities volume of POSIX.1-2008 consist solely of uppercase letters, digits, and the <underscore> ( '_' ) from the characters defined in Portable Character Set and do not begin with a digit. When enforcing variable names in environment blocks, we need to use this first definition, so that we can propagate all valid variables. I think having non-printable characters in variable names is too much, so I took out the whitespace stuff from the first definition. OTOH, when we use *shell syntax*, for example doing variable expansion, it seems enough to support expansion of variables that the shell would allow. Fixes #14878, https://bugzilla.redhat.com/show_bug.cgi?id=1754395, https://bugzilla.redhat.com/show_bug.cgi?id=1879216.
* core/load-fragment: don't treat "; ;" as "/usr/bin/;"Zbigniew Jędrzejewski-Szmek2020-09-181-4/+3
| | | | | | | | We had a special test case that the second semicolon would be interpreted as an executable name. We would then try to find the executable and rely on ";" not being found to cause ENOEXEC to be returned. I think that's just crazy. Let's treat the second semicolon as a separator and ignore the whole thing as we would whitespace.
* tree-wide: define iterator inside of the macroZbigniew Jędrzejewski-Szmek2020-09-081-2/+1
|
* test: Test memory limit parsingMichal Koutný2020-06-241-0/+60
| | | | | This covers parsing from configuration files only. Properties set via DBus have separate code path whose testing would require DBus setup.
* shared/conf-parser: remove unnecessary whitespace skippingZbigniew Jędrzejewski-Szmek2019-11-271-1/+1
| | | | | | | | The conf-parser machinery already removed whitespace before and after "=", no need to repeat this step. The test is adjusted to pass. It was testing an code path that doesn't happen normally, no point in doing that.
* tests: modify enter_cgroup_subroot() to return the new pathZbigniew Jędrzejewski-Szmek2019-11-111-1/+1
|
* tests: get rid of test-helper.[ch] completelyZbigniew Jędrzejewski-Szmek2019-11-111-1/+0
| | | | | I don't think there's any particular reason to keep those functions in a separate file.
* tests: make manager_skip_test() not a macro and move to tests.hZbigniew Jędrzejewski-Szmek2019-11-111-2/+2
| | | | There is nothing magic in it.
* tree-wide: drop capability.h when capability-util.h is includedYu Watanabe2019-11-031-1/+0
|
* tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2019-11-031-1/+0
|
* Rename test-unit-file to test-load-fragmentZbigniew Jędrzejewski-Szmek2019-07-191-0/+801
This file was testing a mix of functions from src/core/load-fragment.c and some from src/shared/install.c. Let's name it more appropriately. I want to add tests for the new unit-file.c too.