Commit Graph

2083 Commits

Author SHA1 Message Date
Evgeny Vereshchagin 68a8f17775 tests: add basic rlimits test 2015-11-28 16:47:56 +00:00
Lennart Poettering 6b25959dfa util-lib: move nss-util.h from shared/ to basic/
The header file defines some helpers for GLIBC NSS and doesn't include
anything else but glibc headers, hence there's little reason to keep it
in shared/.

See: #2008
2015-11-27 19:23:29 +01:00
Lennart Poettering 4afd3348c7 tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easy
GLIB has recently started to officially support the gcc cleanup
attribute in its public API, hence let's do the same for our APIs.

With this patch we'll define an xyz_unrefp() call for each public
xyz_unref() call, to make it easy to use inside a
__attribute__((cleanup())) expression. Then, all code is ported over to
make use of this.

The new calls are also documented in the man pages, with examples how to
use them (well, I only added docs where the _unref() call itself already
had docs, and the examples, only cover sd_bus_unrefp() and
sd_event_unrefp()).

This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we
tend to call our destructors these days.

Note that this defines no public macro that wraps gcc's attribute and
makes it easier to use. While I think it's our duty in the library to
make our stuff easy to use, I figure it's not our duty to make gcc's own
features easy to use on its own. Most likely, client code which wants to
make use of this should define its own:

       #define _cleanup_(function) __attribute__((cleanup(function)))

Or similar, to make the gcc feature easier to use.

Making this logic public has the benefit that we can remove three header
files whose only purpose was to define these functions internally.

See #2008.
2015-11-27 19:19:36 +01:00
Lennart Poettering d353a16d1f Merge pull request #1937 from evverx/fix-stdout-parsing
Fix stdout stream parsing
2015-11-27 14:03:49 +01:00
Lennart Poettering a51c10485a resolved: add a generic DnsSearchDomain concept
With this change, we add a new object to resolved, "DnsSearchDomain="
which wraps a search domain. This is then used to introduce a global
search domain list, in addition to the existing per-link search domain
list which is reword to make use of this new object too.

This is preparation for implement proper unicast DNS search domain
support.
2015-11-25 21:58:38 +01:00
Lennart Poettering f8dc7e343d resolved: split out all code dealing with /etc/resolv.conf into its own .c file
No functional changes.
2015-11-25 21:58:37 +01:00
Daniel Mack 9e6a4d57b6 Merge pull request #1996 from eworm-de/editorconfig
add editorconfig configuration
2015-11-23 18:17:57 +01:00
Christian Hesse db787e7926 add editorconfig configuration
We want indention with spaces, so specify in editorconfig.
http://editorconfig.org/
2015-11-23 12:32:59 +01:00
Evgeny Vereshchagin ceb2840951 build: install bash completion for systemd-path
This is a follow-up for commit e50e53876f
2015-11-21 07:19:12 +00:00
Tom Gundersen c665ffa9b1 Merge pull request #1962 from mbiebl/install-completion-networkctl
build: install bash completion for networkctl
2015-11-20 04:04:24 +01:00
Michael Biebl e7035a4779 build: install bash completion for networkctl
This is a follow-up for commit e4f246b1b5.
2015-11-19 17:41:41 +01:00
David Herrmann dd050decb6 build: bump version numbers
Prepare for v228 release and bump version numbers.
2015-11-18 08:59:06 +01:00
Evgeny Vereshchagin 1c36b4a73b tests: add basic journal test 2015-11-17 23:46:31 +00:00
Lennart Poettering 233f353a22 Merge pull request #1909 from keszybz/filetriggers-v2
Move daemon-reload from package %post scripts to file triggers
2015-11-17 12:30:44 +01:00
Zbigniew Jędrzejewski-Szmek 873e413323 Move daemon-reload from package %post scripts to file triggers
This uses new functionality added in rpm 4.13. Instead of doing
one daemon-reload per packages, we do just one or two
(When both installing and uninstalling packages, we do
two. Unfortunately this also includes the common case of upgrades.
When only installing or when only installing, we do just one.)

New file triggers.systemd can be built, but the contents have
to be copied into the rpm spec file by hand. Using %{load} does
not seem to work. It can serve as documentation.
2015-11-15 18:38:37 -05:00
Kay Sievers eee15abcdb hwdb: update 2015-11-14 09:54:17 +01:00
Lennart Poettering 0ec0deaa30 install: follow unit file symlinks in /usr, but not /etc when looking for [Install] data
Some distributions use alias unit files via symlinks in /usr to cover
for legacy service names. With this change we'll allow "systemctl
enable" on such aliases.

Previously, our rule was that symlinks are user configuration that
"systemctl enable" + "systemctl disable" creates and removes, while unit
files is where the instructions to do so are store. As a result of the
rule we'd never read install information through symlinks, since that
would mix enablement state with installation instructions.

Now, the new rule is that only symlinks inside of /etc are
configuration. Unit files, and symlinks in /usr are now valid for
installation instructions.

This patch is quite a rework of the whole install logic, and makes the
following addional changes:

- Adds a complete test "test-instal-root" that tests the install logic
  pretty comprehensively.

- Never uses canonicalize_file_name(), because that's incompatible with
  operation relative to a specific root directory.

- unit_file_get_state() is reworked to return a proper error, and
  returns the state in a call-by-ref parameter. This cleans up confusion
  between the enum type and errno-like errors.

- The new logic puts a limit on how long to follow unit file symlinks:
  it will do so only for 64 steps at max.

- The InstallContext object's fields are renamed to will_process and
  has_processed (will_install and has_installed) since they are also
  used for deinstallation and all kinds of other operations.

- The root directory is always verified before use.

- install.c is reordered to place the exported functions together.

- Stricter rules are followed when traversing symlinks: the unit suffix
  must say identical, and it's not allowed to link between regular units
  and templated units.

- Various modernizations

- The "invalid" unit file state has been renamed to "bad", in order to
  avoid confusion between UNIT_FILE_INVALID and
  _UNIT_FILE_STATE_INVALID. Given that the state should normally not be
  seen and is not documented this should not be a problematic change.
  The new name is now documented however.

Fixes #1375, #1718, #1706
2015-11-12 17:57:04 +01:00
Michal Sekletar 100582b8cc build-sys: fix dependencies
update-man-list needs man/custom-entities.ent. Bug is nicely reproducible when
running make update-man-list.
2015-11-12 14:07:41 +01:00
Filipe Brandenburger 4c80d201ac test-execute: Add tests for new PassEnvironment= directive
Check the base case, plus erasing the list, listing the same variable
name more than once and when variables are absent from the manager
execution environment.

Confirmed that `sudo ./test-execute` passes and that modifying the test
cases (or the values of the set variables in test-execute.c) is enough
to make the test cases fail.
2015-11-11 07:55:23 -08:00
Zbigniew Jędrzejewski-Szmek 36b4a7ba55 Remove snapshot unit type
Snapshots were never useful or used for anything. Many systemd
developers that I spoke to at systemd.conf2015, didn't even know they
existed, so it is fairly safe to assume that this type can be deleted
without harm.

The fundamental problem with snapshots is that the state of the system
is dynamic, devices come and go, users log in and out, timers fire...
and restoring all units to some state from the past would "undo"
those changes, which isn't really possible.

Tested by creating a snapshot, running the new binary, and checking
that the transition did not cause errors, and the snapshot is gone,
and snapshots cannot be created anymore.

New systemctl says:
Unknown operation snapshot.
Old systemctl says:
Failed to create snapshot: Support for snapshots has been removed.

IgnoreOnSnaphost settings are warned about and ignored:
Support for option IgnoreOnSnapshot= has been removed and it is ignored

http://lists.freedesktop.org/archives/systemd-devel/2015-November/034872.html
2015-11-10 19:33:06 -05:00
Evgeny Vereshchagin 5c404f1ab8 tests: various fixes
* remove journal flushing (systemd-journal-flush.service runs journalctl --flush on boot)
* use sh -c and PATH instead of @SYSTEMCTL@ expansion
* remove unnecessary semicolons etc
2015-11-10 18:01:15 +00:00
Tom Gundersen 0f8980e48b sd-pppoe: drop
It is really unclear if we want to / have the resources to support this fully, so drop it
for now. It can easily be brought back if a killer usecase emerges.

Note that this code was never hooked up, so this does not remove any features.
2015-11-03 16:14:12 +01:00
Lennart Poettering 9fe4ea21be string-util: rework memory_erase() so that it cannot be optimized away
memory_erase() so far just called memset(), which the compiler might
optimize away under certain conditions if it feels there's benefit in
it. C11 knows a new memset_s() call that is like memset(), but may not
be optimized away. Ideally, we'd just use that call, but glibc currently
does not support it. Hence, implement our own simplistic version of it.

We use a GCC pragma to turn off optimization for this call, and also use
the "volatile" keyword on the pointers to ensure that gcc will use the
pointers as-is. According to a variety of internet sources, either one
does the trick. However, there are also reports that at least the
volatile thing isn't fully correct, hence let's add some snake oil and
employ both techniques.

https://news.ycombinator.com/item?id=4711346
2015-11-02 23:07:20 +01:00
Ronny Chevalier aa8e00da54 test-path: move all related test files to a specific directory
To avoid polluting test/
2015-10-31 15:07:19 +01:00
Ronny Chevalier ac40081621 test-execute: move all files related to a specific directory
To avoid polluting test/
2015-10-31 15:07:19 +01:00
Ronny Chevalier 7d0f09a932 build-sys: add missing test files to EXTRA_DIST 2015-10-31 15:07:19 +01:00
Ronny Chevalier a622675862 test-execute: add tests for IOSchedulingClass 2015-10-31 15:07:19 +01:00
Ronny Chevalier c388dfea5a test-execute: add tests for OOMScoreAdjust 2015-10-31 15:07:19 +01:00
Ronny Chevalier 03bd70dd01 test-execute: add test for EnvironmentFile 2015-10-31 15:07:19 +01:00
Ronny Chevalier 63447f1153 test-execute: add test for PrivateNetwork 2015-10-31 15:07:19 +01:00
Filipe Brandenburger bb269eed0e 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.
2015-10-28 08:17:10 -07:00
Filipe Brandenburger 23a3c91617 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.
2015-10-28 08:16:00 -07:00
Boyuan Yang e0c7a4e07d l10n: add zh_CN translation. 2015-10-28 16:40:41 +08:00
Lennart Poettering b5efdb8af4 util-lib: split out allocation calls into alloc-util.[ch] 2015-10-27 13:45:53 +01:00
Lennart Poettering 7d50b32a12 util-lib: split out globbing related calls into glob-util.[ch] 2015-10-27 13:25:58 +01:00
Lennart Poettering 15a5e95075 util-lib: split out printf() helpers to stdio-util.h 2015-10-27 13:25:57 +01:00
Lennart Poettering 49cf4170d0 util-lib: move web-related calls into web-util.[ch] 2015-10-27 13:25:57 +01:00
Lennart Poettering 7ccbd1ae84 util-lib: split out syslog-related calls into syslog-util.[ch] 2015-10-27 13:25:57 +01:00
Lennart Poettering 4e731273ed util-lib: move /proc/cmdline parsing code to proc-cmdline.[ch] 2015-10-27 13:25:57 +01:00
Lennart Poettering 430f0182b7 src/basic: rename audit.[ch] → audit-util.[ch] and capability.[ch] → capability-util.[ch]
The files are named too generically, so that they might conflict with
the upstream project headers. Hence, let's add a "-util" suffix, to
clarify that this are just our utility headers and not any official
upstream headers.
2015-10-27 13:25:57 +01:00
Lennart Poettering affb60b1ef util-lib: split out umask-related code to umask-util.h 2015-10-27 13:25:56 +01:00
Lennart Poettering 8b43440b7e util-lib: move string table stuff into its own string-table.[ch] 2015-10-27 13:25:56 +01:00
Lennart Poettering 8fcde01280 util-lib: split stat()/statfs()/stavfs() related calls into stat-util.[ch] 2015-10-27 13:25:56 +01:00
Lennart Poettering f4f15635ec util-lib: move a number of fs operations into fs-util.[ch] 2015-10-27 13:25:56 +01:00
Lennart Poettering c8b3094de5 util-lib: split out file attribute calls to chattr-util.[ch] 2015-10-27 13:25:56 +01:00
Lennart Poettering 89a5a90cb0 util-lib: split xattr-related calls into xattr-util.[ch] 2015-10-27 13:25:56 +01:00
Lennart Poettering a09561746f util-lib: introduce dirent-util.[ch] for directory entry calls
Also, move a couple of more path-related functions to path-util.c.
2015-10-27 13:25:56 +01:00
Lennart Poettering 78f22b973f util-lib: split out resource limits related calls into rlimit-util.[ch] 2015-10-27 13:25:56 +01:00
Lennart Poettering 4349cd7c1d util-lib: move mount related utility calls to mount-util.[ch] 2015-10-27 13:25:55 +01:00
Lennart Poettering e4e73a6325 util-lib: split out hex/dec/oct encoding/decoding into its own file 2015-10-27 13:25:55 +01:00