Magellan Linux

Annotation of /trunk/systemd/patches/systemd-217-shared-install-avoid-prematurely-rejecting-missing-u.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2524 - (hide annotations) (download)
Mon Nov 17 13:56:31 2014 UTC (9 years, 6 months ago) by niro
File size: 1684 byte(s)
-upstream fixes
1 niro 2524 From 0ffce503cd6e5a5ff5ba5cd1cc23684cfb8bb9e3 Mon Sep 17 00:00:00 2001
2     From: Dave Reisner <dreisner@archlinux.org>
3     Date: Thu, 30 Oct 2014 20:12:05 -0400
4     Subject: [PATCH] shared/install: avoid prematurely rejecting "missing" units
5    
6     f7101b7368df copied some logic to prevent enabling masked units, but
7     also added a check which causes attempts to enable templated units to
8     fail. Since we know the logic beyond this check will properly handle
9     units which truly do not exist, we can rely on the unit file state
10     comparison to suffice for expressing the intent of f7101b7368df.
11    
12     ref: https://bugs.archlinux.org/task/42616
13     ---
14     src/shared/install.c | 8 +++-----
15     1 file changed, 3 insertions(+), 5 deletions(-)
16    
17     diff --git a/src/shared/install.c b/src/shared/install.c
18     index 035b44c..cab93e8 100644
19     --- a/src/shared/install.c
20     +++ b/src/shared/install.c
21     @@ -1620,12 +1620,10 @@ int unit_file_enable(
22     STRV_FOREACH(i, files) {
23     UnitFileState state;
24    
25     + /* We only want to know if this unit is masked, so we ignore
26     + * errors from unit_file_get_state, deferring other checks.
27     + * This allows templated units to be enabled on the fly. */
28     state = unit_file_get_state(scope, root_dir, *i);
29     - if (state < 0) {
30     - log_error("Failed to get unit file state for %s: %s", *i, strerror(-state));
31     - return state;
32     - }
33     -
34     if (state == UNIT_FILE_MASKED || state == UNIT_FILE_MASKED_RUNTIME) {
35     log_error("Failed to enable unit: Unit %s is masked", *i);
36     return -ENOTSUP;
37     --
38     2.1.3
39