b26fa1a2fbcfee7d03b0c8fd15ec3aa64ae70b9f |
|
10-Feb-2016 |
Daniel Mack <daniel@zonque.org> |
tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file. |
d7671a3efdaef690b4316a03011038f731f2eea9 |
|
29-Jan-2016 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
resolved: add alignment to base64
We try to fit the lengthy key data into available space. If the other
fields take less than half of the available columns, we use align everything
in the remaining columns. Otherwise, we put everything after a newline,
indented with 8 spaces.
This is similar to dig and other tools do.
$ COLUMNS=78 ./systemd-resolve -t any .
. IN SOA a.root-servers.net nstld.verisign-grs.com 2016012701 1800 900 604800 86400
. IN RRSIG SOA RSASHA256 0 86400 20160206170000 20160127160000 54549
S1uhUoBAReAFi5wH/KczVDgwLb+B9Zp57dSYj9aX4XxBhKuzccIducpg0wWXhjCRAWuzY
fQ/J2anm4+C4BLUTdlytPIemd42SUffQk2WGuuukI8e67nkrNF3WFtoeXQ4OchsyO24t2
rxi682Zo9ViqmXZ+MSsjWKt1jdem4noaY=
. IN NS h.root-servers.net
. IN NS k.root-servers.net
. IN NS e.root-servers.net
. IN NS c.root-servers.net
. IN NS b.root-servers.net
. IN NS g.root-servers.net
. IN NS d.root-servers.net
. IN NS f.root-servers.net
. IN NS i.root-servers.net
. IN NS j.root-servers.net
. IN NS m.root-servers.net
. IN NS a.root-servers.net
. IN NS l.root-servers.net
. IN RRSIG NS RSASHA256 0 518400 20160206170000 20160127160000 54549
rxhmTVKUgs72G3VzL+1JRuD0nGLIrPM+ISfmUx0eYUH5wZD5XMu2X+8PfkAsEQT1dziPs
ac+zK1YZPbNgr3yGI5H/wEbK8S7DmlvO+/I9WKTLp/Zxn3yncvnTOdjFMZxkAqHbjVOm+
BFz7RjQuvCQlEJX4PQBFphgEnkiOnmMdI=
. IN NSEC aaa ( NS SOA RRSIG NSEC DNSKEY )
. IN RRSIG NSEC RSASHA256 0 86400 20160206170000 20160127160000 54549
HY49/nGkUJJP1zLmH33MIKnkNH33jQ7bsAHE9itEjvC4wfAzgq8+Oh9fjYav1R1GDeJ2Z
HOu3Z2uDRif10R8RsmZbxyZXJs7eHui9KcAMot1U4uKCCooC/5GImf+oUDbvaraUCMQRU
D3mUzoa0BGWfxgZEDqZ55raVFT/olEgG8=
. IN DNSKEY 257 3 RSASHA256 AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0
O8gcCjFFVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0
NfnfL2MTJRkxoXbfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL4
96M/QZxkjf5/Efucp2gaDX6RS6CXpoY68LsvPVjR0ZSwzz1ap
AzvN9dlzEheX7ICJBBtuA6G3LQpzW5hOA2hzCTMjJPJ8LbqF6
dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relSQageu+ipAdTTJ2
5AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulqQxA+Uk1
ihz0=
. IN DNSKEY 256 3 RSASHA256 AwEAAbr/RV0stAWYbmKOldjShp4AOQGOyY3ATI1NUpP4X1qBs
6lsXpc+1ABgv6zkg02IktjZrHnmD0HsElu3wqXMrT5KL1W7Sp
mg0Pou9WZ8QttdTKXwrVXrASsaGI2z/pLBSnK8EdzqUrTVxY4
TEGZtxV519isM06CCMihxTn5cfFBF
. IN RRSIG DNSKEY RSASHA256 0 172800 20160204235959 20160121000000 19036
XYewrVdYKRDfZptAATwT+W4zng04riExV36+z04kok09W0RmOtDlQrlrwHLlD2iN/zYpg
EqGgDF5T2xlrQdNpn+PFHhypHM7NQAgLTrwmiw6mGbV0bsZN3rhFxHwW7QVUFAvo9eNVu
INrjm+sArwxq3DnPkmA+3K4ikKD2iiT/jT91VYr9SHFqXXURccLjI+nmaE7m31hXcirX/
r5i3J+B4Fx4415IavSD72r7cmruocnCVjcp+ZAUKeMyW+RwigzevLz3oEcCZ4nrTpGLEj
wFaVePYoP+rfdmfLfTdmkkm4APRJa2My3XOdGFlgNS1pW1pH4az5LapLE2vMO7p1aQ==
-- Information acquired via protocol DNS in 14.4ms.
-- Data is authenticated: no |
c573dcfeb1abd390cd4c4288056df97752ef18f0 |
|
03-Nov-2015 |
Evgeny Vereshchagin <evvers@ya.ru> |
proc-cmdline: add runlevel to target mapping |
bb269eed0e447a2f973677246959b403d480ed63 |
|
28-Oct-2015 |
Filipe Brandenburger <filbranden@google.com> |
test-parse-util: Move parse-util tests into their own test case
Tests for the functions defined in src/basic/parse-util.c. Reorder them
to match the order in which the functions are defined in the source
file. Adjusted the list of include files to remove the ones no longer
needed in test-util.c.
Tested that `make check` still passes as expected. Also checked the
number of lines removed from test-util.c matches the expected, as an
additional verification that no tests were dropped or duplicated in the
move. |
23a3c916179873d755b863d14b14c6e7f4d0f2de |
|
28-Oct-2015 |
Filipe Brandenburger <filbranden@google.com> |
test-extract-word: Move extract-word tests into their own test case
Tests for the functions defined in src/basic/extract-word.c.
Tested that `make check` still passes as expected. |
a26662ce9b25c400ead61854ed7be636f186fdb0 |
|
28-Oct-2015 |
Filipe Brandenburger <filbranden@google.com> |
cpu-set-util: Support ranges in parse_cpu_set_and_warn
Tested CPUAffinity ranges on both a service unit and in system.conf and
confirmed they work as expected (by inspecting /proc/PID/status, for the
main pid of the service and for pid 1). Also mixed ranges with both
spaces, commas, trailing commas and spaces.
Added new tests to increase coverage of ranges and prevent regressions. |
28cb17ef0281efc3a46e5d0e702b0b0ddeaafaa4 |
|
28-Oct-2015 |
Filipe Brandenburger <filbranden@google.com> |
parse-util: Introduce new parse_range function
This function will be useful for CPUAffinity settings that involve
ranges of CPUs.
Make it generic and include test coverage to prevent regressions. |
4fc66acb93d6f0002263e2dfaefa46e272ae0c9c |
|
28-Oct-2015 |
Filipe Brandenburger <filbranden@google.com> |
cpu-set-util: Accept commas as separators in parse_cpu_set_and_warn
Tested CPUAffinity settings on both a service unit and in system.conf
and confirmed they work as expected.
Added a new test to confirm that trailing commas and spaces work and to
prevent any regressions in that area. |
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out allocation calls into alloc-util.[ch] |
7d50b32a129e781401cf897475f388f682de1368 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out globbing related calls into glob-util.[ch] |
49cf4170d0b586551527ebf4297f8a3fe6bd71a3 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move web-related calls into web-util.[ch] |
4e731273edfe852a3eee2949cd20f49fd5b4f6d7 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move /proc/cmdline parsing code to proc-cmdline.[ch] |
8fcde01280adcbd07e8205b91ac52b06305b6208 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split stat()/statfs()/stavfs() related calls into stat-util.[ch] |
f4f15635ec05293ffcc83a5b39f624bbabbd8fd0 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move a number of fs operations into fs-util.[ch] |
89a5a90cb0935cdad84a0b98d41789ad879d0d83 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split xattr-related calls into xattr-util.[ch] |
bb15fafe9cd815fe5bf9eae84c08aead2eb98fd7 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util: move filename_is_valid() and path_is_safe() to path-util.[ch] |
6550203eb471595e41e27f46e5d0a00a4c0e47bb |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: move fstab_node_to_udev_node() to fstab-util.[ch] |
e4e73a632524c382139034d4271f53b6089ab4cb |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out hex/dec/oct encoding/decoding into its own file |
6bedfcbb2970e06a4d3280c8fb62083d252ede73 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split string parsing related calls from util.[ch] into parse-util.[ch] |
b1d4f8e154bf61b5de1b27461ef8e9c8c5e838a1 |
|
26-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out user/group/uid/gid calls into user-util.[ch] |
c004493cdefc1f43a3956ca529e8070f8d70be56 |
|
26-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out IO related calls to io-util.[ch] |
3ffd4af22052963e7a29431721ee204e634bea75 |
|
25-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over. |
07630cea1f3a845c09309f197ac7c4f11edd3b62 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.
This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.
Also touches a few unrelated include files. |
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util: split out escaping code into escape.[ch]
This really deserves its own file, given how much code this is now. |
9e44f56b4ecfa47e27380165b834bd71aa403b78 |
|
22-Oct-2015 |
Evgeny Vereshchagin <evvers@ya.ru> |
util: allow unbalanced double quote in EXTRACT_QUOTES|EXTRACT_RELAX mode
extract_first_word understands "\'string" but doesn't understand "\"string"
fixed this inconsistency. |
df241a67c0d5311dd15e227162d7e886541da16c |
|
02-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util: rework fgetxattrat_fake() to use O_PATH
That way, we don't ever open the file, thus leave the atime untouched,
and this works even when unprivileged. |
618234a5258768359cb1086b152c5f08aaf89754 |
|
30-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
basic: split out cpu set specific APIs into cpu-set-util.[ch] |
765d143b5fc8dcb44f5fbd391ef36d0835793e7c |
|
30-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util: rename parse_cpu_set() to parse_cpu_set_and_warn()
It's pretty untypical for our parsing functions to log on their own.
Clarify in the name that this one does. |
5f05235f13ab0ba6b7555f0a632d82a316ee869c |
|
25-Sep-2015 |
Filipe Brandenburger <filbranden@google.com> |
util: Add test for parse_cpu_set |
59f448cf15f94bc5ebfd5b254de6f2441d02fbec |
|
10-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: never use the off_t unless glibc makes us use it
off_t is a really weird type as it is usually 64bit these days (at least
in sane programs), but could theoretically be 32bit. We don't support
off_t as 32bit builds though, but still constantly deal with safely
converting from off_t to other types and back for no point.
Hence, never use the type anymore. Always use uint64_t instead. This has
various benefits, including that we can expose these values directly as
D-Bus properties, and also that the values parse the same in all cases. |
348637b28a6253591a5899665d3cde6d8d71d118 |
|
04-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
test: add one more test case for parse_pid() |
ef5c570edfd8afb20e3b04d3711e111a1dea0548 |
|
04-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
util: document why parse_uid() returns ENXIO
parse_uid() returns EINVAL for invalid strings, but ENXIO for the
(uid_t) -1 user ids in order to distinguish these two cases. Document
this. |
21e5a0bea08243ba230e889f6af261ff96145f1f |
|
25-Aug-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
test-util: fix a memleak |
61ee6939819963b7845c101485e188ca2a8119c6 |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
util: Add shell_escape
This is for shell-style \ escaping rather than quoting, which while it
has the same effect in produced shell commands, is not exclusively
useful for shell commands.
shell_escape would be useful for producing sed commands, as you would be
able to \ escape the normal special characters, plus whichever argument
separator was chosen; or it could be used to escape arguments passed to
the overlayfs mount command. |
206644aedeb8859801051ac170ec562c6a113a79 |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
util: Allow non-separator coalescing parsing in extract_first_word
If EXTRACT_DONT_COALESCE_SEPARATORS is passed, then leading separators,
trailing separators and spans of multiple separators aren't skipped, and
empty arguments from before, after or between separators may be extracted. |
12ba2c44dde4d7cfc0e531dbc3cbd0581c323637 |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
util: Don't interpret quotes by default in extract_first_word
This adds an EXTRACT_QUOTES option to allow the previous behaviour, of
not interpreting any character inside ' or " quotes as separators. |
6868560773ada8ea31d1f86422be6bf026a1f660 |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
util: change unquote_*_word to extract_*_word
It now takes a separators argument, which defaults to WHITESPACE if NULL
is passed. |
4b1c17535115b70f4ddf4bf5850049b885a40173 |
|
07-Aug-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
Convert unquote_*_word users to expect isempty(p) after the last entry
This is so that, when called in a loop, unquote_first_word can
distinguish between reaching the end of a string because it has consumed
all the input before the end, and consuming all the input.
This is important because we later add a flag that allows
char *in = "";
char *out;
unquote_first_word(&in, &out, flags);
To put "" in out, and set in = NULL, so the trailing empty string of the
input can be consumed, and mark that the input has been consumed. |
8fb494435889dcb9e1c09b8c7220e47bab717bf9 |
|
06-Aug-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
hostname-util: add relax parameter to hostname_is_valid
Tests are modified to check behaviour with relax and without relax.
New tests are added for hostname_cleanup().
Tests are moved a new file (test-hostname-util) because there's
now a bunch of them.
New parameter is not used anywhere, except in tests, so there should
be no observable change. |
ff9265d0898a707cb19cbc631289ff4f41974415 |
|
31-Jul-2015 |
Daniel Mack <daniel@zonque.org> |
test-util: add more tests
Add tests for safe_ato[iu]16() and some more unbase32hexmem() torture. |
97b11eedff9d2e17101ad453caf9e48b73246719 |
|
31-Jul-2015 |
David Herrmann <dh.herrmann@gmail.com> |
tree-wide: introduce mfree()
Pretty trivial helper which wraps free() but returns NULL, so we can
simplify this:
free(foobar);
foobar = NULL;
to this:
foobar = mfree(foobar); |
c030a850ba59fbcdf796abfe48b2f220933c52c0 |
|
31-Jul-2015 |
Namhyung Kim <namhyung@gmail.com> |
busctl: add and use strcmp_ptr()
In member_compare_func(), it compares interface, type and name of
members. But as it can contain NULL pointer, it needs to check them
before calling strcmp(). So make it as a separate strcmp_ptr
function (named after streq_ptr) so that it can be used by others.
Also let streq_ptr() to use it in order to make the code simpler. |
14e685c29d5b317b815e3e9f056648027852b07e |
|
24-Jul-2015 |
Richard Maw <richard.maw@codethink.co.uk> |
unquote_first_word: parse ` '' ` as an empty argument instead of no argument |
919a7f5f1c4f1a4c3e20b0dc55143b8ad70e6a70 |
|
14-Jul-2015 |
Tom Gundersen <teg@jklm.no> |
basic: util - add base32hexmem() function similar to hexmem()
This implements more of RFC4648. |
13a5d76b3277a2a499345cc24facc21eb17ccdae |
|
12-Jul-2015 |
Tom Gundersen <teg@jklm.no> |
basic: util - add base64mem() function similar to hexmem()
This implements RFC4648 for a slightly more compact representation of
binary data compared to hex (6 bits per character rather than 4). |
30494563f235b21c6583f7476b8ee35e9f5f8048 |
|
12-Jul-2015 |
Tom Gundersen <teg@jklm.no> |
basic: util - fix errorhandling in unhexmem()
We were ignoring failures from unhexchar, which meant that invalid
hex characters were being turned into garbage rather than the string
rejected.
Fix this by making unhexmem return an error code, also change the API
slightly, to return the size of the returned memory, reflecting the
fact that the memory is a binary blob,and not a string.
For convenience, still append a trailing NULL byte to the returned
memory (not included in the returned size), allowing callers to
treat it as a string without doing a second copy. |
4c1fc3e404d648c70bd2f50ac50aeac6ece8872e |
|
07-Jul-2015 |
Daniel Mack <daniel@zonque.org> |
fileio: consolidate write_string_file*()
Merge write_string_file(), write_string_file_no_create() and
write_string_file_atomic() into write_string_file() and provide a flags mask
that allows combinations of atomic writing, newline appending and automatic
file creation. Change all users accordingly. |
b59292b296ad71a20a40d7c347b6ca71df48892d |
|
17-Jun-2015 |
Filipe Brandenburger <filbranden@google.com> |
util: Introduce unquote_first_word_and_warn
It will try to unquot_first_word, but if it runs into escaping problems
it will retry it adding UNQUOTE_CUNESCAPE_RELAX to the flags. If it
succeeds on the second try, it will log a warning about it. If it fails
both times, it will log an error.
Add test cases to confirm it behaves as expected. |
d6293c070e6e4b83d8e7ec56e465b0b215d55d98 |
|
17-Jun-2015 |
Filipe Brandenburger <filbranden@google.com> |
util: New flag UNQUOTE_UNESCAPE_RELAX for unquote_first_word
The new flag UNQUOTE_UNESCAPE_RELAX preserves unrecognized escape
sequences verbatim in unquote_first_word, either when it's a trailing
backslash (similar to UNQUOTE_RELAX, but in this case keep the extra
backslash in the output) or in the middle of a sequence string.
Add unit test cases to ensure the new flag works as expected and to
prevent regressions from being introduced.
Tested with a follow up commit converting config_parse_exec() to start
using unquote_first_word, in which case this flags makes it possible to
preserve unrecognized escape sequences.
Relevant bug: https://bugs.freedesktop.org/show_bug.cgi?id=90794 |
14bcf25c8b94b5c3556ba3983028a2b35ed0572f |
|
15-Jun-2015 |
Lennart Poettering <lennart@poettering.net> |
util: when creating temporary file names, allow including extra id string in it
This adds a "char *extra" parameter to tempfn_xxxxxx(), tempfn_random(),
tempfn_ranomd_child(). If non-NULL this string is included in the middle
of the newly created file name. This is useful for being able to
distuingish the kind of temporary file when we see one.
This also adds tests for the three call.
For now, we don't make use of this at all, but port all users over. |
602ee553e40571eeb92e7a6f397550355ba0228b |
|
03-Jun-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
test-util: fix a memleak |
3b51f8ddd5408eaae06e774e40144c7788748000 |
|
03-Jun-2015 |
Daniel Mack <daniel@zonque.org> |
util: fix another cunescape() regression
Fix a regression caused by 4034a06d ("util: rework word parsing and c
unescaping code") which broke octal escape sequences.
The reason for this breakage is that cunescape_one() expects 4 characters
in an octal encoding, which is a stray left-over from the old code which
operated on different variables to make the length check.
While at it, add a test case to prevent the same thing from happening
again. |
24882e06c135584f16f31ba8a00fecde8b7f6fad |
|
29-May-2015 |
Lennart Poettering <lennart@poettering.net> |
util: split out signal-util.[ch] from util.[ch]
No functional changes. |
e136009df20f02e8f4e1dc179da58e3fbd93342c |
|
25-May-2015 |
Tom Gundersen <teg@jklm.no> |
test: hostname - test that hostname is truly initialized
Fixes CID CID 1299638 (use after free). |
139e5336286c37d9d4a2df01931ba0a86abbac69 |
|
19-May-2015 |
Martin Pitt <martin.pitt@ubuntu.com> |
hostname: Allow comments in /etc/hostname
The hostname(1) tool allows comments in /etc/hostname. Introduce a new
read_hostname_config() in hostname-util which reads a hostname configuration
file like /etc/hostname, strips out comments, whitespace, and cleans the
hostname. Use it in hostname-setup.c and hostnamed and remove duplicated code.
Update hostname manpage. Add tests.
https://launchpad.net/bugs/1053048 |
958b66ea16deddd794b3a52643bd44633e165ead |
|
18-May-2015 |
Lennart Poettering <lennart@poettering.net> |
util: split all hostname related calls into hostname-util.c |
288a74cce597f81d3ba01d8a5ca7d2ba5b654b7e |
|
11-Apr-2015 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
shared: add terminal-util.[ch] |
0b452006de98294d1690f045f6ea2f7f6630ec3b |
|
10-Apr-2015 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
shared: add process-util.[ch] |
2ff7b0a54271c8480024d6d68edff4a92e781052 |
|
10-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
util: unify how we parse mode_t strings |
8ebac1f9a681ce1c6287e7c6a1b3093b00fb0c5a |
|
10-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
util: fix unicode decoding in unquote_first_word() |
f3ee629711783333005c41e21d66841268b80f70 |
|
10-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
util: when unescaping C escape sequences support C++11 \u and \U unicode literals
We simply recode them in utf8. |
019c7fba754f74909bdb8bbbbbbe529082928a95 |
|
09-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
util: add shell_maybe_quote() call for preparing a string for shell cmdline inclusion
If necessary the passed string is enclosed in "", and all special
characters escapes.
This also ports over usage in bus-util.c and job.c to use this, instead
of a incorrect local implementation that forgets to properly escape. |
5d84c44a976794625889f3d24e57835d5de234e3 |
|
07-Apr-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
test-util: don't mix declarations and code |
527b7a421ff3927d4f3f170b1b143452e88ae1dc |
|
07-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
util: rework cunescape(), improve error handling
Change cunescape() to return a normal error code, so that we can
distuingish OOM errors from parse errors.
This also adds a flags parameter to control whether "relaxed" or normal
parsing shall be done. If set no parse failures are generated, and the
only reason why cunescape() can fail is OOM. |
c6878637502b1717a110a9a7e8bba32a8583fcdf |
|
06-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
util: rework rm_rf() logic
- Move to its own file rm-rf.c
- Change parameters into a single flags parameter
- Remove "honour sticky" logic, it's unused these days |
4034a06ddb82ec9868cd52496fef2f5faa25575f |
|
26-Mar-2015 |
Lennart Poettering <lennart@poettering.net> |
util: rework word parsing and c unescaping code
When parsing words from input files, optionally automatically unescape
the passed strings, controllable via a new flags parameter.
Make use of this in tmpfiles, and port everything else over, too.
This improves parsing quite a bit, since we no longer have to process the
same string multiple times with different calls, where an earlier call
might corrupt the input for a later call. |
76f282c636f33b41bdbc93a5b2945945ee0029bf |
|
12-Feb-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
test-util: remove superfluous const |
63c372cb9df3bee01e3bf8cd7f96f336bddda846 |
|
03-Feb-2015 |
Lennart Poettering <lennart@poettering.net> |
util: rework strappenda(), and rename it strjoina()
After all it is now much more like strjoin() than strappend(). At the
same time, add support for NULL sentinels, even if they are normally not
necessary. |
0c0cdb06c139b52ff103287f6909b3daa5b2dc54 |
|
22-Jan-2015 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
tests: use assert_se instead of assert
Otherwise they can be optimized away with -DNDEBUG |
1fa2f38f0f011010bf57522b42fcc168856a7003 |
|
22-Jan-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Assorted format fixes
Types used for pids and uids in various interfaces are unpredictable.
Too bad. |
a2e0337875addaf08225fbf9b231435ba12a88b5 |
|
20-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
util: make http url validity checks more generic, and move them to util.c |
ff6a74609b7c925834da1373d3adb9642ca51422 |
|
19-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
import-raw: when downloading raw images, generate sparse files if we can |
7f76961982e03d4d5f781e7e7113fc7eff970f82 |
|
12-Jan-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
shared/util: respect buffer boundary on incomplete escape sequences
cunescape_length_with_prefix() is called with the length as an
argument, so it cannot rely on the buffer being NUL terminated.
Move the length check before accessing the memory.
When an incomplete escape sequence was given at the end of the
buffer, c_l_w_p() would read past the end of the buffer. Fix this
and add a test. |
aac7766c107273abdc5d6f52f9a9f88d18cb14b3 |
|
12-Jan-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
test-util: make sure that masking and overriding works |
e801700e9acdde60078eb1d41b41b06369b83541 |
|
12-Jan-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Implement masking and overriding of generators
Sometimes it is necessary to stop a generator from running. Either
because of a bug, or for testing, or some other reason. The only way
to do that would be to rename or chmod the generator binary, which is
inconvenient and does not survive upgrades. Allow masking and
overriding generators similarly to units and other configuration
files.
For the systemd instance, masking would be more common, rather than
overriding generators. For the user instances, it may also be useful
for users to have generators in $XDG_CONFIG_HOME to augment or
override system-wide generators.
Directories are searched according to the usual scheme (/usr/lib,
/usr/local/lib, /run, /etc), and files with the same name in higher
priority directories override files with the same name in lower
priority directories. Empty files and links to /dev/null mask a given
name.
https://bugs.freedesktop.org/show_bug.cgi?id=87230 |
4968105790c65af58d4ab42bffa2a4bedc0be8ee |
|
12-Jan-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Simplify execute_directory()
Remove the optional sepearate opening of the directory,
it would be just too complicated with the change to
multiple directories.
Move the middle of execute_directory() to a seperate
function to make it easier to grok. |
8cb4ab0058e51f1fba93683d145ef95f97c2fa86 |
|
09-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
logind: unify how we cast between uid_t and pointers for hashmap keys |
f7ad54a301e4ae8dceab54d3ab3934e56c1134ea |
|
07-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
util: make use of kcmp() to compare fds, if it is available |
180a60bc879ab0554297bc08a7a0b9274b119b55 |
|
30-Dec-2014 |
David Herrmann <dh.herrmann@gmail.com> |
macro: add DIV_ROUND_UP()
This macro calculates A / B but rounds up instead of down. We explicitly
do *NOT* use:
(A + B - 1) / A
as it suffers from an integer overflow, even though the passed values are
properly tested against overflow. Our test-cases show this behavior.
Instead, we use:
A / B + !!(A % B)
Note that on "Real CPUs" this does *NOT* result in two divisions. Instead,
instructions like idivl@x86 provide both, the quotient and the remainder.
Therefore, both algorithms should perform equally well (I didn't verify
this, though). |
0289a5bcb5eec84783f771e634ccafe5a2e4936c |
|
25-Dec-2014 |
Filipe Brandenburger <filbranden@google.com> |
test: wait for cloned thread to exit
In test_raw_clone, make sure the cloned thread calls _exit() and in the parent
thread call waitpid(..., __WCLONE) to wait for the child thread to terminate,
otherwise there is a race condition where the child thread will log to the
console after the test process has already exited and the assertion from the
child thread might not be enforced.
The absence of this patch might also create problems for other tests that would
be added after this one, since potentially both parent and child would run
those tests as the child would continue running.
Tested by confirming that the logs from the child are printed before the test
terminates and that a false assertion in the child aborts the test with a core
dump.
[zj: also add check for the return value.] |
e50221bf1ae8bc8e14f242efa4c9d26b7a47639b |
|
25-Dec-2014 |
Filipe Brandenburger <filbranden@google.com> |
test: only use assert_se in test_raw_clone
The asserts used in the tests should never be allowed to be optimized away. |
ba774317ac7d3e67fdb9ed81663264d38859df59 |
|
19-Dec-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Treat a trailing backslash as an error
Commit a2a5291b3f5 changed the parser to reject unfinished quoted
strings. Unfortunately it introduced an error where a trailing
backslash would case an infinite loop. Of course this must fixed, but
the question is what to to instead. Allowing trailing backslashes and
treating them as normal characters would be one option, but this seems
suboptimal. First, there would be inconsistency between handling of
quoting and of backslashes. Second, a trailing backslash is most
likely an error, at it seems better to point it out to the user than
to try to continue.
Updated rules:
ExecStart=/bin/echo \\ → OK, prints a backslash
ExecStart=/bin/echo \ → error
ExecStart=/bin/echo "x → error
ExecStart=/bin/echo "x"y → error |
ee05e7795bb9ad7d1212dd49ad362f3e9603c4fd |
|
18-Dec-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
core: use raw_clone instead of fork in signal handler
fork() is not async-signal-safe and calling it from the signal handler
could result in a deadlock when at_fork() handlers are called. Using
the raw clone() syscall sidesteps that problem.
The tricky part is that raise() does not work, since getpid() does not
work. Add raw_getpid() to get the real pid, and use kill() instead of
raise().
https://bugs.freedesktop.org/show_bug.cgi?id=86604 |
ae6c3cc009a21df4b51851fb8fe3fde0b7d6d8f0 |
|
12-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
util: when using basename() for creating temporary files, verify the resulting name is actually valid
Also, rename filename_is_safe() to filename_is_valid(), since it
actually does a full validation for what the kernel will accept as file
name, it's not just a heuristic. |
0eb3cc88504b5d8f740764047ac5162b67992386 |
|
10-Dec-2014 |
Jan Synacek <jsynacek@redhat.com> |
test: fix some tests when running inside a container |
32802361561403cb6441198c82d9c499e0513863 |
|
09-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: get rid of PID starttime concept
As kdbus no longer exports this, remove all traces from sd-bus too |
c593bb360edd96fa6cd42f09e934f76c94f84473 |
|
27-Nov-2014 |
Jakub Filak <jfilak@redhat.com> |
util: add function getting proc environ
On the contrary of env, the added function returns all characters
cescaped, because it improves reproducibility. |
ad450c3e0418fe23e2896e581575cb06564ca29a |
|
21-Nov-2014 |
Jakub Filak <jfilak@redhat.com> |
util: add functions getting proc cwd and root
/proc/[pid]/cwd and /proc/[pid]/root are symliks to corresponding
directories
The added functions returns values of that symlinks. |
e1ba963fdf13f4057b9089e0c732e6c1eb69901e |
|
20-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
tests: fix minor memory leak |
f32d2db140150b9d38684a699c9875b6e24ca27c |
|
07-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
util: rework /proc/cmdline parser to use unquote_first_word() |
bdf7026e9557349cd3eeb291c01655d5f2a55db8 |
|
04-Oct-2014 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
test: only use assert_se
The asserts used in the tests should never be allowed to be
optimized away |
95d78c7e7c81a6b788f28c33ef2cafd87471a0d7 |
|
22-Sep-2014 |
David Herrmann <dh.herrmann@gmail.com> |
util: add alloca_align()
The alloca_align() helper is the alloca() equivalent of posix_memalign().
As there is no such function provided by glibc, we simply account for
additional memory and return a pointer offset into the allocated memory to
grant the alignment.
Furthermore, alloca0_align() is added, which simply clears the allocated
memory. |
eee846339d2f76f568c62b3725bf75bcee728115 |
|
22-Sep-2014 |
David Herrmann <dh.herrmann@gmail.com> |
test-util: make valgrind happy
Properly free all temporary resources to make valgrind not complain about
lost records. |
3f2e132a197ba3f5172cbbcd285e9aab021de8fc |
|
11-Sep-2014 |
David Herrmann <dh.herrmann@gmail.com> |
test: fix mem-leak in fdopen() test
We must free FILE* after function return to not leak resources. Note that
this also closes our fd as fdopen() takes ownership of it.
Reported by Philippe De Swert (via coverity). |
667a0377fb25ddb0c3efbc43d186ffd4c097ce41 |
|
28-Aug-2014 |
David Herrmann <dh.herrmann@gmail.com> |
macro: use unique variable names for math-macros
Similar to container_of(), we now use unique variable names for the bascic
math macros MAX, MIN, CLAMP, LESS_BY. Furthermore, unit tests are added to
verify they work as expected.
For a rationale, see:
commit fb835651aff79a1e7fc5795086c9b26e59a8e6ca
Author: David Herrmann <dh.herrmann@gmail.com>
Date: Fri Aug 22 14:41:37 2014 +0200
shared: make container_of() use unique variable names |
fb835651aff79a1e7fc5795086c9b26e59a8e6ca |
|
27-Aug-2014 |
David Herrmann <dh.herrmann@gmail.com> |
shared: make container_of() use unique variable names
If you stack container_of() macros, you will get warnings due to shadowing
variables of the parent context. To avoid this, use unique names for
variables.
Two new helpers are added:
UNIQ: This evaluates to a truly unique value never returned by any
evaluation of this macro. It's a shortcut for __COUNTER__.
UNIQ_T: Takes two arguments and concatenates them. It is a shortcut for
CONCATENATE, but meant to defined typed local variables.
As you usually want to use variables that you just defined, you need to
reference the same unique value at least two times. However, UNIQ returns
a new value on each evaluation, therefore, you have to pass the unique
values into the macro like this:
#define my_macro(a, b) __max_macro(UNIQ, UNIQ, (a), (b))
#define __my_macro(uniqa, uniqb, a, b) ({
typeof(a) UNIQ_T(A, uniqa) = (a);
typeof(b) UNIQ_T(B, uniqb) = (b);
MY_UNSAFE_MACRO(UNIQ_T(A, uniqa), UNIQ_T(B, uniqb));
})
This way, MY_UNSAFE_MACRO() can safely evaluate it's arguments multiple
times as they are local variables. But you can also stack invocations to
the macro my_macro() without clashing names.
This is the same as if you did:
#define my_macro(a, b) __max_macro(__COUNTER__, __COUNTER__, (a), (b))
#define __my_macro(prefixa, prefixb, a, b) ({
typeof(a) CONCATENATE(A, prefixa) = (a);
typeof(b) CONCATENATE(B, prefixb) = (b);
MY_UNSAFE_MACRO(CONCATENATE(A, prefixa), CONCATENATE(B, prefixb));
})
...but in my opinion, the first macro is easier to write and read.
This patch starts by converting container_of() to use this new helper.
Other macros may follow (like MIN, MAX, CLAMP, ...). |
684fc8927e0f83496d4384ac434e265f7cd7a87b |
|
26-Aug-2014 |
Filipe Brandenburger <filbranden@google.com> |
test-util: use assert_se() for call to safe_mkdir with side effect
Otherwise it gets optimized out when CPPFLAGS='-DNDEBUG' is used.
Tested:
- make check TESTS='test-util' CPPFLAGS='-DNDEBUG' |
40a1eebde6be7ac3f1885147fc24e06ad1da260c |
|
22-Aug-2014 |
David Herrmann <dh.herrmann@gmail.com> |
shared: add MAXSIZE() and use it in resolved
The MAXSIZE() macro takes two types and returns the size of the larger
one. It is much simpler to use than MAX(sizeof(A), sizeof(B)) and also
avoids any compiler-extensions, unlike CONST_MAX() and MAX() (which are
needed to avoid evaluating arguments more than once). This was suggested
by Daniele Nicolodi <daniele@grinta.net>.
Also make resolved use this macro instead of CONST_MAX(). This enhances
readability quite a bit. |
5d0ae62c665262c4c55536457e84e278c252cc0b |
|
20-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
CONST_MAX breaks gcc on fedora 20 with optimiztation |
7629889c86005017eb1a7f1f803c0d8e7a5bef08 |
|
19-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
sysusers: add another column to sysusers files for the home directory |
8852362bfc39a3e3bcad9a3287a61ff6587369ef |
|
18-Aug-2014 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
tests: add tests for util.c
add tests for:
- is_symlink
- pid_is_unwaited
- pid_is_alive
- search_and_fopen
- search_and_fopen_nulstr
- glob_exists
- execute_directory |
7242d7420b04132f93f1426ec713f9b09bdeba54 |
|
15-Aug-2014 |
David Herrmann <dh.herrmann@gmail.com> |
macro: add CONST_MAX() macro
The CONST_MAX() macro is similar to MAX(), but verifies that both
arguments have the same type and are constant expressions. Furthermore,
the result of CONST_MAX() is again a constant-expression.
CONST_MAX() avoids any statement-expressions and other non-trivial
expression-types. This avoids rather arbitrary restrictions in both GCC
and LLVM, which both either fail with statement-expressions inside
type-declarations or statement-expressions inside static-const
initializations.
If anybody knows how to circumvent this, please feel free to unify
CONST_MAX() and MAX(). |
926446f4aab62d5fa02840d39d661de61632292c |
|
15-Aug-2014 |
David Herrmann <dh.herrmann@gmail.com> |
test: fix strtod test for real
The "0,5" syntax was actually right. The real problem is, the test should
only run if the local system has the de_DE.UTF-8 locale. Therefore, skip
the tests if setlocale() fails. This is kinda ugly, as it is done
silently, but we cannot skip partial tests with the current
infrastructure. Should be fine this way. |
ce049dcda4a9d0c9a44667ca82bc9e21d7ea7748 |
|
15-Aug-2014 |
David Herrmann <dh.herrmann@gmail.com> |
test: fix strtod() test
One strtod() test is broken since:
commit 8e211000025940b770794abf5754de61b4add0af
Author: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Date: Mon Aug 4 23:13:31 2014 +0200
test: use fabs on doubles
The commit was right, so no reason to revert it, but the test was broken
before and only worked by coincidence. Convert "0,5" to "0.5" so we don't
depend on locales for double conversion (or well, we depend on "C" which
seems reasonable). |
8085f163c50d998f3e30a6ddfc72c73d5dc57747 |
|
14-Aug-2014 |
Dave Reisner <dreisner@archlinux.org> |
util: allow strappenda to take any number of args
This makes strappenda3 redundant, so we remove its usage and
definition. Add a few tests along the way for sanity. |
8e211000025940b770794abf5754de61b4add0af |
|
04-Aug-2014 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
test: use fabs on doubles |
b2fadec6048adb3596f2633cb7fe7a49f5937a18 |
|
31-Jul-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Properly report invalid quoted strings
$ systemd-analyze verify trailing-g.service
[./trailing-g.service:2] Trailing garbage, ignoring.
trailing-g.service lacks ExecStart setting. Refusing.
Error: org.freedesktop.systemd1.LoadFailed: Unit trailing-g.service failed to load: Invalid argument.
Failed to create trailing-g.service/start: Invalid argument |
a2a5291b3f5ab6ed4c92f51d0fd10a03047380d8 |
|
31-Jul-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Reject invalid quoted strings
String which ended in an unfinished quote were accepted, potentially
with bad memory accesses.
Reject anything which ends in a unfished quote, or contains
non-whitespace characters right after the closing quote.
_FOREACH_WORD now returns the invalid character in *state. But this return
value is not checked anywhere yet.
Also, make 'word' and 'state' variables const pointers, and rename 'w'
to 'word' in various places. Things are easier to read if the same name
is used consistently.
mbiebl_> am I correct that something like this doesn't work
mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"'
mbiebl_> systemd seems to strip of the quotes
mbiebl_> systemctl status shows
mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint
mbiebl_> which is pretty weird |
0f625d0b87139fc18cd565c9b6da05c53a0eb7ab |
|
27-Jul-2014 |
Ansgar Burchardt <ansgar@debian.org> |
parse_boolean: require exact matches
Require exact matches in all cases instead of treating strings
starting with 't' ('f') as true (false).
This is required for config_parse_protect_system to parse ProtectSystem=full
correctly: it uses parse_boolean and only tries a more specific parsing
function if that did not return a valid result. Thus "full" was treated as
"false" before. |
1cb1767a29458b3d16d6b161b4ee34dd496ff60d |
|
11-Jul-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
util: fix has cc check and add test |
e0a33e7ba619eb44f732aaf23cb249fa43d0ce8d |
|
02-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
util: when unescaping strings, don't allow smuggling in of additional NUL bytes
Better safe than sorry. |
927be00cb3dd09a911a6a4a29b5b7486c3c4c776 |
|
20-Jun-2014 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
tests: add tests to test-util
add tests for:
- filename_is_safe
- ascii_strlower
- files_same
- is_valid_documentation_url
- file_in_same_dir
- endswith
- close_nointr
- unlink_noerrno
- readlink_and_make_absolute
- read_one_char
- ignore_signals
- strshorten |
40edd23670f977f9a7f12b372733a3668ec174d0 |
|
16-Jun-2014 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
tests: unlink temp file used in test |
de0671ee7fe465e108f62dcbbbe9366f81dd9e9a |
|
15-May-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Remove unnecessary casts in printfs
No functional change expected :) |
625e870b4fb7ff4caf4d8a4614e9bda7c174b291 |
|
13-May-2014 |
David Herrmann <dh.herrmann@gmail.com> |
shared: add ALIGN_POWER2 macro
Sounds easy, turns out to be horrible to implement: ALIGN_POWER2 returns
the next higher power of 2. clz(0) is undefined, same is true for
left-shift-overflows, yey, C rocks! |
c4a7b2c56e907e39fa9a6cdb21c1970464abd44e |
|
19-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
util: add new FOREACH_STRING() macro as syntactic sugar to iterate through a number of fixed strings |
03e334a1c7dc8c20c38902aa039440763acc9b17 |
|
18-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
util: replace close_nointr_nofail() by a more useful safe_close()
safe_close() automatically becomes a NOP when a negative fd is passed,
and returns -1 unconditionally. This makes it easy to write lines like
this:
fd = safe_close(fd);
Which will close an fd if it is open, and reset the fd variable
correctly.
By making use of this new scheme we can drop a > 200 lines of code that
was required to test for non-negative fds or to reset the closed fd
variable afterwards. |
8fe90522fb74dd84ff791a7546fee70047672396 |
|
15-Mar-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
timedated: use builtins for integer log and exp |
29bfbcd675d750c0af4d7dae217722932249e435 |
|
14-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
util: add hexdump() call to create pretty hexdumps of data
This is very useful when debugging sd-bus to look at messages. |
dc36d78e116a7ce4a119a527299785025c925679 |
|
12-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
macro: make sure we can use IN_SET() also with complex function calls as first argument |
840292befd6ad78e018f5ea16bec80e83d910071 |
|
02-Mar-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Disallow sizes with increasing unit size
Things like 3B4T, 4B50B, 400 100 (meaning 4*1024**4+3, 54, and 500,
respectively) are now disallowed. It is necessary to say 4T3B, 54B,
500 instead. I think this was confusing and error prone.
As a special form, 400B 100 is allowed, i.e. "B" suffix is treated
as different from "", although they mean the same thing. |
9480794b277b5ce33e467578ed669996df576bb9 |
|
02-Mar-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Allow fractional parts in disk sizes
It seems natural to be able to say SystemMaxUsage=1.5G.
https://bugzilla.redhat.com/show_bug.cgi?id=1047568 |
5556b5fe41173107a67dbe875fbd916a46e52a02 |
|
23-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
core: clean up some confusing regarding SI decimal and IEC binary suffixes for sizes
According to Wikipedia it is customary to specify hardware metrics and
transfer speeds to the basis 1000 (SI decimal), while software metrics
and physical volatile memory (RAM) sizes to the basis 1024 (IEC binary).
So far we specified everything in IEC, let's fix that and be more
true to what's otherwise customary. Since we don't want to parse "Mi"
instead of "M" we document each time what the context used is. |
39883f622f392d8579f4428fc5a789a102efbb10 |
|
19-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
make gcc shut up
If -flto is used then gcc will generate a lot more warnings than before,
among them a number of use-without-initialization warnings. Most of them
without are false positives, but let's make them go away, because it
doesn't really matter. |
c50e4f95d8cfcd21bde2b0d1ff24b4de8fef4976 |
|
11-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
util: drop parse_user_at_host() since its unused now |
87b0284327e34a4b96c22085fa2cdb3219294991 |
|
29-Jan-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Get rid of write_safe
Current glibc implementation is safe. Kernel does this atomically,
and write is actually implemented through writev. So if write is
async-signal-safe, than writev pretty much must be too. |
2d5bdf5bc0e4714d42e5999a4e37553a6bf83575 |
|
28-Jan-2014 |
Lennart Poettering <lennart@poettering.net> |
always use the same code for creating temporary files
Let's unify our code here, and also always specifiy O_CLOEXEC. |
65b3903ff576488eaabb51d3c4fbf9c73d867d7c |
|
28-Jan-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
journal: guarantee async-signal-safety in sd_journald_sendv
signal(7) provides a list of functions which may be called from a
signal handler. Other functions, which only call those functions and
don't access global memory and are reentrant are also safe.
sd_j_sendv was mostly OK, but would call mkostemp and writev in a
fallback path, which are unsafe.
Being able to call sd_j_sendv in a async-signal-safe way is important
because it allows it be used in signal handlers.
Safety is achieved by replacing mkostemp with open(O_TMPFILE) and an
open-coded writev replacement which uses write. Unfortunately,
O_TMPFILE is only available on kernels >= 3.11. When O_TMPFILE is
unavailable, an open-coded mkostemp is used.
https://bugzilla.gnome.org/show_bug.cgi?id=722889 |
cabb78068899232c152f4585f19d023e373aa73d |
|
02-Dec-2013 |
Lennart Poettering <lennart@poettering.net> |
macro: add a macro to test whether a value is in a specified list
Introduce IN_SET() macro to nicely check whether a value a is one of a
few listed values.
This makes writing this:
if (a == 1 || a == 7 || a == 8 || a == 9)
nicer, by allowing this:
if (IN_SET(a, 1, 7, 8, 9))
This is particularly useful for state machine enums. |
28383ba18963cdedd98ced271b3425f7321119b7 |
|
21-Nov-2013 |
Lennart Poettering <lennart@poettering.net> |
bus: add API calls to escape string components of objects paths |
510b857f7d1e7e8d38912890536342dd5dd647dd |
|
09-Oct-2013 |
Lennart Poettering <lennart@poettering.net> |
tests: fix some memory leaks in tests |
893fa014de0f73337ff4a4c9c531d6789b72f5bf |
|
29-Sep-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Fix buffer overrun when enumerating files
https://bugs.freedesktop.org/show_bug.cgi?id=69887
Based-on-a-patch-by: Hans Petter Jansson <hpj@copyleft.no> |
22f5f6281fc25f43a85938e9dad2480b2595c471 |
|
17-Sep-2013 |
Dave Reisner <dreisner@archlinux.org> |
Use udev_encode_string in fstab_node_to_udev_node
Resolves a longstanding bug which caused this function to wrongly
handle (escape) valid utf8 characters. |
143bfdaf0b890fa7acadf02d1eafacaef1b696bd |
|
22-Aug-2013 |
Holger Hans Peter Freyther <holger@moiji-mobile.com> |
test: Make testing work on systems without or old systemd
* Introduce a macro to conditionally execute tests. This avoids
skipping the entire test if some parts require systemd
* Skip the journal tests when no /etc/machine-id is present
* Change test-catalog to load the catalog from the source directory
of systemd.
* /proc/PID/comm got introduced in v2.6.33 but travis is still
using v2.6.32.
* Enable make check and make distcheck on the travis build
* Use -D"CATALOG_DIR=STR($(abs_top_srcdir)/catalog)" as a STRINGIY
would result in the path '/home/ich/source/linux' to be expanded
to '/home/ich/source/1' as linux is defined to 1. |
998b087f70505decbfe55afd27fc4ade3d60ce52 |
|
15-Aug-2013 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
tests: fix indentation |
d4ac85c6f6d8547f8b835009ae431438de72df28 |
|
18-Jul-2013 |
Lennart Poettering <lennart@poettering.net> |
util: add split_pair() for splitting foo=bar strings |
b4ecc959733d9d258d8ed0e8179368ee844a5578 |
|
16-Jul-2013 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
tests: add more tests for shared/util.c |
b32ff512191bf873266ee8067f6f6c8a30c96a5e |
|
10-Jun-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Properly check for overflow in offsets |
2a371001f8d23533a339a150eeffa3215773058d |
|
26-Apr-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Use attribute(unused) in PROTECT_ERRNO
clang emits warnings about unused attribute _saved_errno_, which drown
out other—potentially useful—warnings. gcc documentation is not exactly
verbose about the effects of __attribute__((unused)) on variables, but
let's assume that it works if the unit test passes. |
d6dd604b551987b411ec8930c23bd5c9c93ef864 |
|
25-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
util: rework safe_atod() to be locale-independent
This adds some syntactic sugar with a macro RUN_WITH_LOCALE() that reset
the thread-specific locale temporarily. |
49aa47c7fb6c6cf85f2780080e89181974efdc3b |
|
16-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
util: make generation of profcs PID paths nicer |
144e51eca20b72c8177314c225d8c15c1b0b9d6b |
|
05-Apr-2013 |
Cristian Rodríguez <crrodriguez@opensuse.org> |
journal: u64log2 can be expressed just as __builtin_clzll(n) ^ 63U |
aa3c5cf8eefa36a3ae727fe136587381e590d333 |
|
22-Mar-2013 |
Lennart Poettering <lennart@poettering.net> |
util: be more picky when validating hostnames
No longer allow dots at the beginning or end of host names, Or double
dots.
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1152187/comments/14 |
dbd73f9eb41f992905def875ed64ae0cfd5cef47 |
|
07-Mar-2013 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
test-util: add more tests
Improve test coverage a bit with tests for
close_many
strappend (to cover all ways through strnappend) |
d47c78be4a2acbb631a26af11b7ce2ef57f55996 |
|
05-Mar-2013 |
Lennart Poettering <lennart@poettering.net> |
util: properly escape corner cases in bus_path_escape(), too
This follows the suggestions from:
http://lists.freedesktop.org/archives/systemd-devel/2013-March/009363.html |
44f4c86c424582caad04ea95ebf185c93d11325e |
|
26-Feb-2013 |
Daniel Buch <boogiewasthere@gmail.com> |
test-util.c: added hexchar, unhexchar, octchar, unoctchar, decchar, undecchar tests |
1ef04f0b14a5e48a822683a9e3a19233b42aecb2 |
|
25-Feb-2013 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
tests: add a few more tests to test-util.c
Add asserts on the resutls in FOREACH_WORD_QUOTED
Added tests for:
FOREACH_WORD
strstrip
delete_chars
in_charset |
8d99e5f53057f490b93d2ea9cb2b669bbee21d00 |
|
20-Feb-2013 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
tests: more tests for util.c
tests for:
test_parse_pid
test_parse_uid
test_safe_atolli
test_safe_atod |
0d585d82913f06cd6174dd8d35fe5aacc3e08719 |
|
18-Feb-2013 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
tests: add test of memdup_multiply |
8354c34e14799593c85a638ef543b378ac97c6fe |
|
11-Feb-2013 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
tests: more tests
tests for:
parse_boolean
env_name_is_valid
Also convert assert to assert_se to make sure they are run even with
optimization. (see commit 9b5d6bd909855543cba75a4469bff6f82845cf0d) |
539ad707db5361e7fbe0076615a92456fd34f7df |
|
06-Feb-2013 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
test: add a few tests and tidy up
adds test of:
strv_find
strv_find_prefix
strv_overlap
strv_sort
streq_ptr
first_word
Splits tests of util.c into own file to avoid clutter as we add more.
Removed a few prints and uses _cleanup_free_ to make the tests more focused. |