summaryrefslogtreecommitdiff
path: root/src/import
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: drop missing.hYu Watanabe2019-10-312-2/+1
|
* tree-wide: say "ratelimit" not "rate_limit"Zbigniew Jędrzejewski-Szmek2019-09-204-12/+12
| | | | | | "ratelimit" is a real word, so we don't need to use the other form anywhere. We had both forms in various places, let's standarize on the shorter and more correct one.
* Drop RATELIMIT macrosZbigniew Jędrzejewski-Szmek2019-09-205-9/+5
| | | | | Using plain structure initialization is both shorter _and_ more clearer. We get type safety for free.
* tree-wide: get rid of strappend()Lennart Poettering2019-07-121-1/+1
| | | | | It's a special case of strjoin(), so no need to keep both. In particular as typing strjoin() is even shoert than strappend().
* importd: Avoid need for fd translation tableDave Reisner2019-07-092-51/+5
| | | | | | | Make use of curl_multi_assign to associate each IO sd_event_source with a CURL object. This means we always get passed the right event source and don't need to worry about looking up the associated CURL object, particularly in the case where the FD has been closed on a REMOVE event.
* tree-wide: replace strjoina() with prefix_roota()Yu Watanabe2019-06-253-3/+3
|
* tree-wide: use _cleanup_ attribute and strv_consume() + TAKE_PTR()Yu Watanabe2019-06-241-5/+3
|
* Merge pull request #12836 from yuwata/tree-wide-replace-strjoinLennart Poettering2019-06-221-1/+1
|\ | | | | tree-wide: replace strjoin() with path_join()
| * tree-wide: replace strjoin() with path_join()Yu Watanabe2019-06-211-1/+1
| |
* | util: introduce format_bytes_full()Yu Watanabe2019-06-192-1/+2
|/ | | | And move it into format-util.c.
* Use sd_event_source_disable_unref()Zbigniew Jędrzejewski-Szmek2019-05-101-2/+1
|
* Merge pull request #12420 from mrc0mmand/coccinelle-tweaksLennart Poettering2019-04-301-1/+1
|\ | | | | Coccinelle improvements
| * tree-wide: code improvements suggested by CoccinelleFrantisek Sumsal2019-04-301-1/+1
| |
* | codespell: fix spelling errorsBen Boeckel2019-04-292-2/+2
|/
* basic: add new helper call empty_or_dash_to_null()Lennart Poettering2019-04-084-20/+10
| | | | | We have a function like this at two places already. Let's unify it in one generic location and let's port a number of users over.
* tree-wide: introduce empty_or_dash() helperLennart Poettering2019-04-084-10/+10
| | | | | At quite a few places we check isempty() || streq(…, "-"), let's add a helper to simplify that, and replace that by a single function call.
* util-lib: when copying files make sure to apply some chattrs early, some lateLennart Poettering2019-03-282-2/+2
| | | | | | | Some chattrs only work sensible if you set them right after opening a file for create (think: FS_NOCOW_FL). Others only work when they are applied when the file is fully written (think: FS_IMMUTABLE_FL). Let's take that into account when copying files and applying a chattr to them.
* tree-wide: (void)ify a few unlink() and rmdir()Lennart Poettering2019-03-272-4/+4
| | | | | | Let's be helpful to static analyzers which care about whether we knowingly ignore return values. We do in these cases, since they are usually part of error paths.
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-278-1/+13
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* import: do not try to set selinux related attributes if selinux is disabledYu Watanabe2019-03-111-2/+11
| | | | Closes #11940.
* copy: don't synthesize a 'user.crtime_usec' xattr on copy unless explicitly ↵Lennart Poettering2019-03-013-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | requested Previously, when we'd copy an individual file we'd synthesize a user.crtime_usec xattr with the source's creation time if we can determine it. As the creation/birth time was until recently not queriable form userspace this effectively just propagated the same xattr on the source to the same xattr on the destination. However, current kernels now allow to query the birthtime using statx() and we do make use of that now. Which means that suddenly we started synthesizing these xattrs much more regularly. Doing this actually does make sense, but only in very few cases: not for the typical regular files we copy, but certainly when dealing with disk images. Hence, let's keep this kind of propagation, but let's make it a flag and default to off. Then turn it on whenever we deal with disk images, and leave it off otherwise. This is particularly relevant as overlayfs combining a real fs, and a tmpfs on top will result in EOPNOTSUPP when it is attempted to open a file with xattrs for writing, as tmpfs does not support xattrs, and hence the copy-up cannot work. Hence, let's avoid synthesizing this needlessly, to increase compat with overlayfs.
* curl-util: fix use after freeYu Watanabe2019-02-061-1/+1
| | | | This fixes a bug introduced by c3e658004a66115fa09abcf602d573e65e577aa9.
* pull: fix invalid error checkYu Watanabe2019-02-061-1/+1
| | | | This fixes a bug introduced by 0d94088e4e9e00f5ca9afdb8e68c94558fe23268.
* meson: generate version tag from gitZbigniew Jędrzejewski-Szmek2018-12-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ build/systemctl --version systemd 239-3555-g6178cbb5b5 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid $ git tag v240 -m 'v240' $ ninja -C build ninja: Entering directory `build' [76/76] Linking target fuzz-unit-file. $ build/systemctl --version systemd 240 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid This is very useful during development, because a precise version string is embedded in the build product and displayed during boot, so we don't have to guess answers for questions like "did I just boot the latest version or the one from before?". This change creates an overhead for "noop" builds. On my laptop, 'ninja -C build' that does nothing goes from 0.1 to 0.5 s. It would be nice to avoid this, but I think that <1 s is still acceptable. Fixes #7183. PACKAGE_VERSION is renamed to GIT_VERSION, to make it obvious that this is the more dynamically changing version string. Why save to a file? It would be easy to generate the version tag using run_command(), but we want to go through a file so that stuff gets rebuilt when this file changes. If we just defined an variable in meson, ninja wouldn't know it needs to rebuild things.
* Merge pull request #10935 from poettering/rlimit-nofile-safeZbigniew Jędrzejewski-Szmek2018-12-061-0/+3
|\ | | | | | | Merged by hand to resolve a trivial conflict in TODO.
| * tree-wide: invoke rlimit_nofile_safe() before various exec{v,ve,l}() invocationsLennart Poettering2018-12-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever we invoke external, foreign code from code that has RLIMIT_NOFILE's soft limit bumped to high values, revert it to 1024 first. This is a safety precaution for compatibility with programs using select() which cannot operate with fds > 1024. This commit adds the call to rlimit_nofile_safe() to all invocations of exec{v,ve,l}() and friends that either are in code that we know runs with RLIMIT_NOFILE bumped up (which is PID 1 and all journal code for starters) or that is part of shared code that might end up there. The calls are placed as early as we can in processes invoking a flavour of execve(), but after the last time we do fd manipulations, so that we can still take benefit of the high fd limits for that.
* | util-lib: split out all temporary file related calls into tmpfiles-util.cLennart Poettering2018-12-028-7/+9
|/ | | | | | | | This splits out a bunch of functions from fileio.c that have to do with temporary files. Simply to make the header files a bit shorter, and to group things more nicely. No code changes, just some rearranging of source files.
* import: properly fail if tar exited non-zero, not just when it segfaulted or ↵Lennart Poettering2018-11-261-0/+2
| | | | such
* export-tar: check tar result as wellLennart Poettering2018-11-261-2/+22
| | | | | Let's make sure we properly notice when tar doesn't actually work: let's propagate the error.
* importd: immediately validate whether fd is of right type when receiving itLennart Poettering2018-11-261-0/+13
| | | | Just some paranoia.
* import: drop logic of setting up /var/lib/machines as btrfs loopback mountLennart Poettering2018-11-267-54/+3
| | | | | | | | | | | | | | | | | | | Let's simplify things and drop the logic that /var/lib/machines is setup as auto-growing btrfs loopback file /var/lib/machines.raw. THis was done in order to make quota available for machine management, but quite frankly never really worked properly, as we couldn't grow the file system in sync with its use properly. Moreover philosophically it's problematic overriding the admin's choice of file system like this. Let's hence drop this, and simplify things. Deleting code is a good feeling. Now that regular file systems provide project quota we could probably add per-machine quota support based on that, hence the btrfs quota argument is not that interesting anymore (though btrfs quota is a bit more powerful as it allows recursive quota, i.e. that the machine pool gets an overall quota in addition to per-machine quota).
* import: rerrange tarball/fs imports that have a single top-level directory ↵Lennart Poettering2018-11-264-0/+119
| | | | | | | | | | containing the OS tree Let's handle tarball imports nicer that have a single top-level directory containing the OS tree: let's move everything down during import, so that the OS tree is ready to use automatically. Fixes: #2116
* machine: add support for importing containers from plain directoriesLennart Poettering2018-11-264-8/+452
| | | | | | | | | Fixes: #2728 This is also supposed to be preparation for doing #10234 eventually, where a very similar operation is requested: instead of importing a tree to /var/lib/machines it would need to be imported into /var/lib/portables/.
* polkit: add missing method callsLennart Poettering2018-11-261-0/+16
| | | | These were missing, hence the polkit hook-up for them never worked...
* import: use parse_percent() where appropriateLennart Poettering2018-11-261-5/+4
|
* import: prefer fd_get_path() over readlink_malloc() where applicableLennart Poettering2018-11-262-4/+4
|
* tree-wide: fix a few missing includesLennart Poettering2018-11-261-0/+2
|
* import: tiny modernization/simplificationLennart Poettering2018-11-261-9/+4
| | | | Less indentation and fewer {} are always a good thing.
* import: use generic word 'transfer' instead of 'import'Lennart Poettering2018-11-261-5/+4
| | | | After all, these lines are also printed for exports/pulls...
* import: downgrade log message to LOG_WARNING, because we ignore the failureLennart Poettering2018-11-261-1/+1
|
* import: use structured initializersYu Watanabe2018-11-2410-86/+141
|
* import: use _cleanup_ attribute for CURL objectYu Watanabe2018-11-241-22/+9
|
* coccinelle: make use of SYNTHETIC_ERRNOZbigniew Jędrzejewski-Szmek2018-11-225-52/+36
| | | | | | | | | | | Ideally, coccinelle would strip unnecessary braces too. But I do not see any option in coccinelle for this, so instead, I edited the patch text using search&replace to remove the braces. Unfortunately this is not fully automatic, in particular it didn't deal well with if-else-if-else blocks and ifdefs, so there is an increased likelikehood be some bugs in such spots. I also removed part of the patch that coccinelle generated for udev, where we returns -1 for failure. This should be fixed independently.
* log: introduce new helper call log_setup_service()Lennart Poettering2018-11-201-3/+1
| | | | | Let's reduce the common boilerplate and have a single setup function used by all service code to setup logging.
* util-lib: move main() definition macros to its own header fileLennart Poettering2018-11-194-0/+4
| | | | | | | | | This way, we can extend the macro a bit with stuff pulled in from other headers without this affecting everything which pulls in macro.h, which is one of our most basic headers. This is just refactoring, no change in behaviour, in prepartion for later changes.
* import: define mains through macroZbigniew Jędrzejewski-Szmek2018-11-174-35/+25
|
* curl-util: fix error code check from curl_multi_socket_actionDave Reisner2018-10-271-1/+1
| | | | | | After curl 7.20.0, this function never returns negative error codes. Make this consistent with the other call to this function and only compare against CURLM_OK.
* import: include error cause in log messageYu Watanabe2018-10-201-2/+2
|
* tree-wide: introduce setsockopt_int() helper and make use of it everywhereLennart Poettering2018-10-181-2/+3
| | | | | | As suggested by @heftig: https://github.com/systemd/systemd/commit/6d5e65f6454212cd400d0ebda34978a9f20cc26a#commitcomment-30938667
* tree-wide: add a single version of "static const int one = 1"Lennart Poettering2018-10-151-2/+1
| | | | | | | | | | All over the place we define local variables for the various sockopts that take a bool-like "int" value. Sometimes they are const, sometimes static, sometimes both, sometimes neither. Let's clean this up, introduce a common const variable "const_int_one" (as well as one matching "const_int_zero") and use it everywhere, all acorss the codebase.