summaryrefslogtreecommitdiffstats
path: root/src/shared/conf-parser.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* shared/conf-parser: fix unitialized variableZbigniew Jędrzejewski-Szmek2021-03-311-1/+2
| | | | Introduced in 4f9ff96a55187927a4164a19df580329f4c6522b.
* core: fix mtime calculation of dropin filesZbigniew Jędrzejewski-Szmek2021-03-041-7/+7
| | | | | | | | | | | | | | | | | Nominally, the bug was in unit_load_dropin(), which just took the last mtime instead of calculating the maximum. But instead of adding code to wrap the loop, this patch goes in the other direction. All (correct) callers of config_parse() followed a very similar pattern to calculate the maximum mtime. So let's simplify things by making config_parse() assume that mtime is initialized and update it to the maximum. This makes all the callers that care about mtime simpler and also fixes the issue in unit_load_dropin(). config_parse_many_nulstr() and config_parse_many() are different, because it makes sense to call them just once, and current ret_mtime behaviour make sense. Fixes #17730, https://bugzilla.redhat.com/show_bug.cgi?id=1933137.
* Merge pull request #18704 from keszybz/fallback-hostame-overrideZbigniew Jędrzejewski-Szmek2021-02-231-9/+14
|\ | | | | Allow overriding of fallback hostname through envvar and os-release field
| * shared/conf-parser: allow more than one location of the main config fileZbigniew Jędrzejewski-Szmek2021-02-211-9/+14
| | | | | | | | No functional change as long as only one path is passed.
* | util: move percent/permille/permyriad parser into percent-util.[ch]Lennart Poettering2021-02-181-0/+1
|/ | | | | | | A good chunk of parse-util.[ch] has been about parsing parts per hundred/thousand/ten-thousand. Let's split that out into its own file. No code changes, just some shuffling around.
* tree-wide: use free_and_strdup_warn()Yu Watanabe2021-02-111-4/+1
|
* tree-wide: use error codes in xxx_from_string()Yu Watanabe2021-02-111-3/+3
|
* oom: rework *MemoryPressureLimit= properties to have 1/10000 precisionAnita Zhang2021-02-031-0/+1
| | | | | | | Requested in https://github.com/systemd/systemd/pull/15206#discussion_r505506657, preserve the full granularity for memory pressure limits (permyriad) instead of capping out at percent.
* string-util: imply NULL termination of strextend() argument listLennart Poettering2021-01-061-1/+1
| | | | | The trailing NULL in the argument list is now implied (similar to what we already have in place in strjoin()).
* Merge pull request #17478 from yuwata/split-network-internalYu Watanabe2020-11-271-49/+160
|\ | | | | libsystemd-network: split network-internal.c
| * conf-parser: fix indentationYu Watanabe2020-10-291-49/+56
| |
| * libsystemd-network: move config_parse_hwaddr() and config_parse_hwaddrs()Yu Watanabe2020-10-291-0/+104
| |
* | license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|/
* systemd-oomd: manager/daemonAnita Zhang2020-10-081-0/+2
|
* shared/conf-parser: drop redundant cast to booleanZbigniew Jędrzejewski-Szmek2020-09-221-1/+1
| | | | | parse_boolean returns either 0 or 1 or error, and we checked for errors earlier already.
* conf-parser: logs about OOM errorYu Watanabe2020-09-101-1/+1
|
* conf-parser: use SYNTHETIC_ERRNO() at one more placeYu Watanabe2020-09-101-4/+2
|
* network: downgrade log level in conf parsersYu Watanabe2020-07-161-35/+36
|
* core: remove support for ".include" stanzaLennart Poettering2020-06-031-30/+1
| | | | | | | | | | Six years ago we declared it obsolete and removed it from the docs (c073a0c4a5ffbf6677dd6af02e7c7d59b2b901ab) and added a note about it in NEWS. Two years ago we add warning messages about it, indicating the feature will be removed (41b283d0f1f4abd85d0bbeeb7f71bb30f87cfab9) and mentioned it in NEWS again. Let's now kill it for good.
* conf-parser: return mtime in config_parse() and friendsLennart Poettering2020-06-021-18/+34
| | | | | | | | | | | | | This is a follow-up for 9f83091e3cceb646a66fa9df89de6d9a77c21d86. Instead of reading the mtime off the configuration files after reading, let's do so before reading, but with the fd we read the data from. This is not only cleaner (as it allows us to save one stat()), but also has the benefit that we'll detect changes that happen while we read the files. This also reworks unit file drop-ins to use the common code for determining drop-in mtime, instead of reading system clock for that.
* conf-parse: fix pretty bad typoLennart Poettering2020-06-021-1/+1
|
* network: also read mtime of drop-in configsYu Watanabe2020-06-011-2/+10
| | | | Fixes #15521.
* repart: Add UUID option to config filesTobias Hunger2020-05-251-0/+30
| | | | | Add a option to provide a UUID for the partition that will get created and document that.
* network: allow setting VLAN protocol on bridgesRubens Figueiredo2020-05-141-0/+32
| | | | Signed-off-by: Rubens Figueiredo <rubens.figueiredo@bisdn.de>
* fileio: fileno() can realistically return -1Lennart Poettering2020-04-131-2/+4
| | | | | | | | | | | | | | An stdio FILE* stream usually refers to something with a file descriptor, but that's just "usually". It doesn't have to, when taking fmemopen() and similar into account. Most of our calls to fileno() assumed the call couldn't fail. In most cases this was correct, but in some cases where we didn't know whether we work on files or memory we'd use the returned fd as if it was unconditionally valid while it wasn't, and passed it to a multitude of kernel syscalls. Let's fix that, and do something reasonably smart when encountering this case. (Running test-fileio with this patch applied will remove tons of ioctl() calls on -1).
* conf-parser: fix line number in error messageYu Watanabe2020-02-271-1/+3
| | | | Fixes #14929.
* Merge pull request #14368 from poettering/repartZbigniew Jędrzejewski-Szmek2020-01-231-0/+1
|\
| * conf-parser: add parser for 32bit signed integersLennart Poettering2020-01-201-0/+1
| |
* | network,udev: use uint64_t for bit rateYu Watanabe2020-01-211-7/+3
|/ | | | Fixes #14620.
* udev: support AlternativeName= setting in .link fileYu Watanabe2019-12-161-0/+60
|
* shared/conf-parser: allow sections to be silently ignored with new -Section ↵Zbigniew Jędrzejewski-Szmek2019-11-221-1/+12
| | | | | | | | | | | | syntax If we ignore any uknown section, we will not be able to show any warning if a typo in a section name is made. Let's reverse our approach, and explicitly list sections to ignore instead. I opted to make use the same section list for this, instead of adding a second list, because this list is passed through to many functions and adding yet another parameter to the long signature would be very noisy.
* shared/conf-parser: turn CONFIG_PARSE_REFUSE_BOM flag into a local variableZbigniew Jędrzejewski-Szmek2019-11-221-3/+3
| | | | This is an internal implementation detail.
* tree-wide: drop string.h when string-util.h or friends are includedYu Watanabe2019-11-031-1/+0
|
* tree-wide: drop missing.hYu Watanabe2019-10-311-1/+1
|
* Revert "shared/conf-parser,networkd: EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE ↵Zbigniew Jędrzejewski-Szmek2019-08-191-1/+1
| | | | | | | | | | | | | | → EXTRACT_UNQUOTE" This reverts commit 8a07b4033e5d3c86931b3dd2ddbca41118c05c60. The tests are kept. test-networkd-conf is adjusted to pass. This fixes #13276. I think current rules are extremely confusing, as the case in test-networkd-conf shows. We apply some kinds of unescaping (relating to quoting), but not others (related to escaping of special characters). But fixing this is hard, because people have adjusted quoting to match our rules, and if we make the rules "better", things might break in unexpected places.
* shared/conf-parser: say "key name" not "lvalue", add dotZbigniew Jędrzejewski-Szmek2019-07-181-1/+2
| | | | "lvalue" is our internal jargon. Let's try not to confuse non-programmers.
* shared/conf-parser: emit a nicer warning for something like "======"Zbigniew Jędrzejewski-Szmek2019-07-181-0/+3
| | | | | | | | Urlich Windl wrote on the mailing list: > I noticed that a line of "=======" in "[Service]" cases the message " Unknown lvalue '' in section 'Service'". This now becomes: /etc/systemd/system/eqeqeqeq.service:3: Missing key name before '=', ignoring line.
* shared/conf-parser: be nice and ignore lines without "="Zbigniew Jędrzejewski-Szmek2019-07-181-5/+3
| | | | | | We generally don't treat syntax error as fatal, but in this case we would completely refuse to load the file. I think we should treat the the same as assignment outside of a section, or an unknown key name.
* shared/conf-parser,networkd: EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE → ↵Zbigniew Jędrzejewski-Szmek2019-07-171-1/+1
| | | | | | | | | | | | | EXTRACT_UNQUOTE It's hard to even say what exactly this combination means. Escaping is necessary when quoting to have quotes within the string. So the escaping of quote characters is inherently tied to quoting. When unquoting, it seems natural to remove escaping which was done for the quoting purposes. But with both flags we would be expected to re-add this escaping after unqouting? Or maybe keep the escaping which is not necessary for quoting but otherwise present? This all seems too complicated, let's just forbid such usage and always fully unescape when unquoting.
* Rename EXTRACT_QUOTES to EXTRACT_UNQUOTEZbigniew Jędrzejewski-Szmek2019-06-281-1/+1
| | | | | | Whenever I see EXTRACT_QUOTES, I'm always confused whether it means to leave the quotes in or to take them out. Let's say "unquote", like we say "cunescape".
* conf-parser: fix continuation handlingYu Watanabe2019-06-261-1/+2
| | | | | | | Before this commit, empty lines cannot break continuation. The bug was introduced by 9adbfeb38ac101d6f73a033bb120d63513ffb240. Closes #12883.
* util: split out nulstr related stuff to nulstr-util.[ch]Lennart Poettering2019-03-141-0/+1
|
* time-util: Introduce parse_sec_def_infinityFilipe Brandenburger2019-02-141-0/+1
| | | | | | | | | | | | | This works like parse_sec() but defaults to USEC_INFINITY when passed an empty string or only whitespace. Also introduce config_parse_sec_def_infinity, which can be used to parse config options using this function. This is useful for time options that use "infinity" for default and that can be reset by unsetting them. Introduce a test case to ensure it works as expected.
* conf-parser: accept whitespaces before commentsYu Watanabe2019-01-081-1/+1
| | | | Closes #11343.
* conf-parser: mention that unknown lvalue is ignoredYu Watanabe2019-01-081-1/+1
|
* util: drop missing.h from socket-util.hYu Watanabe2018-12-061-1/+2
|
* conf-parse: use strjoina() where appropriateLennart Poettering2018-11-171-12/+5
|
* core: remove JoinControllers= configuration settingLennart Poettering2018-11-161-115/+0
| | | | | | | | | | | | | | | | This removes the ability to configure which cgroup controllers to mount together. Instead, we'll now hardcode that "cpu" and "cpuacct" are mounted together as well as "net_cls" and "net_prio". The concept of mounting controllers together has no future as it does not exist to cgroupsv2. Moreover, the current logic is systematically broken, as revealed by the discussions in #10507. Also, we surveyed Red Hat customers and couldn't find a single user of the concept (which isn't particularly surprising, as it is broken...) This reduced the (already way too complex) cgroup handling for us, since we now know whenever we make a change to a cgroup for one controller to which other controllers it applies.
* conf-parser: ignore trailing back-slash in commentYu Watanabe2018-11-081-1/+4
| | | | Fixes #10598.
* strv: wrap strv_new() in a macro so that NULL sentinel is implicitLennart Poettering2018-10-311-1/+1
|