summaryrefslogtreecommitdiff
path: root/src/tmpfiles/tmpfiles.c
AgeCommit message (Collapse)Author
2015-07-22tmpfiles: downgrade errors when a file system does not support file attributesLennart Poettering
This downgrades errors from setting file attributes via tmpfiles to warnings and makes them non-fatal. Also, as a special case, if a file system does not support file attributes at all, then the message is downgraded to debug, so that it is not seen at all. With this change reiserfs should not see any messages at all anymore (since it apparently does not implement file attributes at all), but XFS will still get a warning but no failure. The warning is something the XFS kernel folks should fix though, by adjusting their file attributes behaviour to be identical to ext234's. Fixes #560.
2015-06-17tmpfiles: only root-owned aquota.* files are specialZbigniew Jędrzejewski-Szmek
Fixes #188.
2015-06-15tmpfiles: make sure "R" lines also remove subvolumesLennart Poettering
2015-05-15tmpfiles: use lstat() instead of stat() when checking whether a file system ↵Lennart Poettering
object already exists
2015-05-15tmpfiles: don't fail if we cannot create a subvolume because a file system ↵Lennart Poettering
is read-only but a dir already exists anyway https://bugs.freedesktop.org/show_bug.cgi?id=90281
2015-05-13util: add generic calls for prefixing a root directory to a pathLennart Poettering
So far a number of utilities implemented their own calls for this, unify them in prefix_root() and prefix_roota(). The former uses heap memory, the latter allocates from the stack via alloca(). Port over most users of a --root= logic.
2015-05-06tmpfiles: try to handle read-only file systems gracefullyMichael Olbrich
On read-only filesystems trying to create the target will not fail with EEXIST but with EROFS. Handle EROFS by checking if the target already exists, and if empty when truncating. This avoids reporting errors if tmpfiles doesn't actually needs to do anything. [zj: revert condition to whitelist rather then blacklisting, and add goto to avoid stat'ting twice.]
2015-04-22tmpfiles: use an ordered hashmap for the tmpfiles itemsLennart Poettering
We should try to execute them in the same order they appear in the configuration files, as it is documented. Hence move to an ordered hashmap. (Note though, that this still doesn't execute them completely in order: we will still apply non-glob lines before glob-lines, and reorder lines prefixing each other and that apply to the same paths). http://lists.freedesktop.org/archives/systemd-devel/2015-March/029055.html
2015-04-21tmpfiles: consider an argument of "-" as non-specifiedLennart Poettering
2015-04-13tmpfiles: don't follow symlinks when adjusting ACLs, fille attributes, ↵Lennart Poettering
access modes or ownership
2015-04-12tmpfiles: use qsort_safeZbigniew Jędrzejewski-Szmek
2015-04-10shared: add formats-util.hRonny Chevalier
2015-04-10tmpfiles: fix build with clangThomas Hindoe Paaboel Andersen
Clang is not happy about using the cleanup attribute in switches
2015-04-10tmpfiles: add specifier expansion for L and C lines, tooLennart Poettering
2015-04-10tmpfiles: enforce ordering when executing linesLennart Poettering
Always create files first, and then adjust their ACLs, xattrs, file attributes, never the opposite. Previously the order was not deterministic, thus possibly first adjusting ACLs/xattrs/file attributes before actually creating the items.
2015-04-10tmpfiles: eat up empty columnsLennart Poettering
2015-04-10tmpfiles: substitute % specifiers in arguments for writing files and xattrsLennart Poettering
2015-04-10tmpfiles: warn if we get an argument on lines that don't take anyLennart Poettering
2015-04-10tmpfiles: mostly revert 71044f609b829d802e0eb81270e13b4f55d76476Lennart Poettering
Add a comment why returning a positive error is OK and intended in this case. (It's still a nasty hack to do this though!)
2015-04-10util: unify how we parse mode_t stringsLennart Poettering
2015-04-09tmpfiles: properly return error code from path_set_acl()Lennart Poettering
2015-04-09tmpfiles: add file attribute calls to list of glob needing commandsLennart Poettering
2015-04-08tmpfiles: rework file attribute codeLennart Poettering
- Stick to one type for the flags field: unsigned. This appears to be what the kernel uses, and there's no point in using something else. - compress the flags array by avoiding sparse entries - extend some error messages to not use abbreviated words - avoid TTOCTTOU issues by invoking fstat() after open() when applying file flags - add explanation why we need to check the file type with fstat(). - don't needlessly abbreviate "attribute" as "attrib", in particually as "chattr" abbreviates it as "attr" rather than "attrib".
2015-04-08util: merge change_attr_fd() and chattr_fd()Lennart Poettering
2015-04-07util: rework cunescape(), improve error handlingLennart Poettering
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.
2015-04-06util: rework rm_rf() logicLennart Poettering
- Move to its own file rm-rf.c - Change parameters into a single flags parameter - Remove "honour sticky" logic, it's unused these days
2015-03-26util: rework word parsing and c unescaping codeLennart Poettering
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.
2015-03-26tmpfiles: minor simplificationLennart Poettering
2015-03-24tmpfiles: avoid out of bounds readThomas Hindoe Paaboel Andersen
Otherwise this will go wrong for 'v'.
2015-03-19Allow systemd-tmpfiles to set the file/directory attributesGoffredo Baroncelli
Allow systemd-tmpfiles to set the file/directory attributes, like chattr(1) does. Two more commands are added: 'H' and 'h' to set the attributes, recursively and not.
2015-03-14tmpfiles: remove redundant debug messageZbigniew Jędrzejewski-Szmek
Mar 13 19:48:30 adam.happyassassin.net systemd-tmpfiles[970]: "/var/lib/machines" has right mode 40700 Mar 13 19:48:30 adam.happyassassin.net systemd-tmpfiles[970]: /var/lib/machines created successfully.
2015-03-13tree-wide: there is no ENOTSUP on linuxDavid Herrmann
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
2015-03-10tmpfiles: port to unquote_many_words()daurnimator
2015-03-05tmpfiles: Fix handling of duplicate linesMartin Pitt
Commit 3f93da987 accidentally dropped the "return 0" after detection of a duplicate line. Put it back, to get back the documented and intended "first match wins" behaviour. https://launchpad.net/bugs/1428540
2015-03-03tmpfiles: quietly ignore ACLs on unsupported filesystemsHans-Peter Deifel
A warning is printed if ACLs cannot be retrieved for any reason other than -ENOSYS. For -ENOSYS, debug log is printed.
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen
This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
2015-02-17tmpfiles: Fix parse_acl error messageMartin Pitt
parse_acl() returns the error instead of setting errno.
2015-02-03tmpfiles: fix compilation without acl supportZbigniew Jędrzejewski-Szmek
2015-02-03partial revert of fed6df8Thomas Hindoe Paaboel Andersen
This one was acutally used to free xattr
2015-02-02remove unused variablesThomas Hindoe Paaboel Andersen
2015-02-02tmpfiles: let's always use DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING() ↵Lennart Poettering
instead of defining our own string tables
2015-02-01tmpfiles: accurately report creation resultsZbigniew Jędrzejewski-Szmek
2015-02-01tmpfiles: remove dead branchZbigniew Jędrzejewski-Szmek
In the test, p is a path to a directory, always absolute. dent->d_name is a single path component, so they cannot be equal. The comparison was wrong also for other reasons: D type supports globs, so direct comparisons using streq are not enough.
2015-01-27tmpfiles: fix help textZbigniew Jędrzejewski-Szmek
The help text, apart from being too long, did not describe what the options really do.
2015-01-26tmpfiles: use casts instead of warning suppressionZbigniew Jędrzejewski-Szmek
This warning got its own name only in gcc5, so the suppression does not work in gcc4, and generates a warning of its own. Use a cast, which is ugly too, but less so.
2015-01-24tmpfiles: do not bump access times of directories we are cleaning upZbigniew Jędrzejewski-Szmek
Both plain opendir() and glob() will bump access time. Privileged option O_NOATIME can be used to prevent the access time from being updated. We already used it for subdirectories of the directories which we were cleaning up. But for the directories specified directly in the config files, we wouldn't do that. This means that, paradoxically, our own temporary directories for PrivateTmp would stay around forever, as long as one let systemd-tmpfiles-clean.service run regularly, because they had their own glob patterns specified. https://bugzilla.redhat.com/show_bug.cgi?id=1183684
2015-01-24tmpfiles: add debug statements for all actionsZbigniew Jędrzejewski-Szmek
systemd-tmpfiles can be used by users, but it can be quite hard to figure out the logic it follows, especially since the logic is in some places rather torturous. Hopefuly this will make it easier for users to understand what is happening.
2015-01-23tmpfiles: minor simplificationZbigniew Jędrzejewski-Szmek
2015-01-22shared/acl-util: add mask only when needed, always add base ACLsZbigniew Jędrzejewski-Szmek
For ACLs to be valid, a set of entries for user, group, and other must be always present. Always add those entries. While at it, only add the mask ACL if it is actually required, i.e. when at least on ACL for non-owner group or user exists.
2015-01-22tmpfiles: implement augmenting of existing ACLsZbigniew Jędrzejewski-Szmek
This is much more useful in practice (equivalent to setfacl -m).