[systemd-devel] [PATCH] missing va_end

2012-09-21 Thread Lukáš Nykrýn
Hello,
coverity scan 189-190 only complained about three missing va_ends.
See attached patches.

Regards
Lukas
From 8b5667702257bc561ba7a67301080f0092538333 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn lnyk...@redhat.com
Date: Fri, 21 Sep 2012 10:22:46 +0200
Subject: [PATCH 1/2] shared: call va_end in all cases

---
 src/shared/log.c  |2 +-
 src/shared/util.c |4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/shared/log.c b/src/shared/log.c
index 7b0a914..b618458 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -719,7 +719,6 @@ int log_struct_internal(
 
 format = va_arg(ap, char *);
 }
-va_end(ap);
 
 zero(mh);
 mh.msg_iov = iovec;
@@ -731,6 +730,7 @@ int log_struct_internal(
 r = 1;
 
 finish:
+va_end(ap);
 for (i = 1; i  n; i += 2)
 free(iovec[i].iov_base);
 
diff --git a/src/shared/util.c b/src/shared/util.c
index be94515..97f766c 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5024,8 +5024,10 @@ char *strjoin(const char *x, ...) {
 break;
 
 n = strlen(t);
-if (n  ((size_t) -1) - l)
+if (n  ((size_t) -1) - l) {
+va_end(ap);
 return NULL;
+}
 
 l += n;
 }
-- 
1.7.6.5

From 2f0091c2b0991e6d689fb9ea83a310874b2c0467 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn lnyk...@redhat.com
Date: Fri, 21 Sep 2012 10:23:08 +0200
Subject: [PATCH 2/2] core: call va_end in all cases

---
 src/core/selinux-access.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/core/selinux-access.c b/src/core/selinux-access.c
index 8a84071..8513634 100644
--- a/src/core/selinux-access.c
+++ b/src/core/selinux-access.c
@@ -276,6 +276,7 @@ static int log_callback(int type, const char *fmt, ...)
 vsnprintf(buf, sizeof(buf), fmt, ap);
 audit_log_user_avc_message(audit_fd, AUDIT_USER_AVC,
buf, NULL, NULL, NULL, 0);
+va_end(ap);
 return 0;
 }
 #endif
-- 
1.7.6.5

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] missing va_end

2012-09-21 Thread Lennart Poettering
On Fri, 21.09.12 10:47, Lukáš Nykrýn (lnyk...@redhat.com) wrote:

 Hello,
 coverity scan 189-190 only complained about three missing va_ends.
 See attached patches.

Applied! Thanks!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 3/3] journalctl: add SIGWINCH handler in --follow mode

2012-09-21 Thread Lennart Poettering
On Mon, 17.09.12 19:47, Dave Reisner (dreis...@archlinux.org) wrote:

 Recalculate the terminal size on SIGWINCH to make sure we take in to
 the account the new real estate.

Hmpf. this a bit dangerous as this code means accessing environ[] from
the signal handler, which might not safe in some cases where the main
program might be updating environ[] in some way at the point where the
signal handler is invoked.

I'd prefer if this could be reworked to simply unset the cache variable
so that the next invocation of columns() from the main context would
invoke the getenv(), not the signal handler.

(yes, this is unlikely to be a real problem in journalctl, but I'd
prefer to write correct code...)

 ---
  src/journal/journalctl.c | 6 ++
  1 file changed, 6 insertions(+)
 
 diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
 index 8e52dd5..a04bb05 100644
 --- a/src/journal/journalctl.c
 +++ b/src/journal/journalctl.c
 @@ -29,6 +29,7 @@
  #include sys/poll.h
  #include time.h
  #include getopt.h
 +#include signal.h
  #include sys/stat.h
  #include sys/ioctl.h
  #include linux/fs.h
 @@ -78,6 +79,10 @@ static enum {
  ACTION_DISK_USAGE,
  } arg_action = ACTION_SHOW;
  
 +static recalc_columns(int _unused_ signum) {
 +columns_uncached();
 +}
 +
  static int help(void) {
  
  printf(%s [OPTIONS...] [MATCH]\n\n
 @@ -175,6 +180,7 @@ static int parse_argv(int argc, char *argv[]) {
  
  case 'f':
  arg_follow = true;
 +signal(SIGWINCH, recalc_columns);
  break;
  
  case 'o':


Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 2/3] bash-completion: fix whitespace

2012-09-21 Thread Lennart Poettering
On Mon, 17.09.12 19:47, Dave Reisner (dreis...@archlinux.org) wrote:

 Use spaces for indentation instead of tabs.

These two look good to me, please commit (you should have commite access
now, after all, please test!)

 ---
  bash-completion/systemd-bash-completion.sh | 12 ++--
  1 file changed, 6 insertions(+), 6 deletions(-)
 
 diff --git a/bash-completion/systemd-bash-completion.sh 
 b/bash-completion/systemd-bash-completion.sh
 index 39ef165..db5636b 100644
 --- a/bash-completion/systemd-bash-completion.sh
 +++ b/bash-completion/systemd-bash-completion.sh
 @@ -143,16 +143,16 @@ _systemctl () {
  elif __contains_word $verb ${VERBS[STARTABLE_UNITS]}; then
  comps=$( __filter_units_by_property CanStart yes \
$( __get_inactive_units \
 - | while read -r line; do \
 - [[ $line =~ \.(device|snapshot)$ ]] || printf 
 %s\n $line; \
 - done ))
 +| while read -r line; do \
 +[[ $line =~ \.(device|snapshot)$ ]] || 
 printf %s\n $line; \
 +done ))
  
  elif __contains_word $verb ${VERBS[RESTARTABLE_UNITS]}; then
  comps=$( __filter_units_by_property CanStart yes \
$( __get_all_units \
 - | while read -r line; do \
 - [[ $line =~ \.(device|snapshot|socket|timer)$ 
 ]] || printf %s\n $line; \
 - done ))
 +| while read -r line; do \
 +[[ $line =~ 
 \.(device|snapshot|socket|timer)$ ]] || printf %s\n $line; \
 +done ))
  
  elif __contains_word $verb ${VERBS[STOPPABLE_UNITS]}; then
  comps=$( __filter_units_by_property CanStop yes \


Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Arch: default to FONT=

2012-09-21 Thread Tom Gundersen
Forgot to cc as always...

On Fri, Sep 21, 2012 at 12:27 PM, Tom Gundersen t...@jklm.no wrote:
 On Thu, Sep 13, 2012 at 7:29 AM, Lennart Poettering
 lenn...@poettering.net wrote:
 Hmm, so I am tempted to make this change for everybody instead of just
 Arch.

 I'll submit patch.

 But before I do that, I have one question: the default kernel font, does
 that do the usual UTF-8 subset that LatArCyrHeb-16 does? If so, then
 there is indeed no point in loading a font from userspace, indeed,
 especially given that setfont is so awfully slow...

 By usual UTF-8 subset I mean box chars (i want QR codes on the
 console! ;-)) and the range that iso8859-15 covers I guess.

 Both do the box chars. Neither do the full iso8859-15, but both do
 iso8859-1 (and LatArCyrHeb has a few extra characters from iso8859-15
 which the kernel default lacks).

 The major difference is obviously the lack of Arabic, Cyrillic and
 Hebrew from the kernel default font. Though if you want a non-US
 locale, you need to change that anyway, so being able to set a
 different font might be a reasonable expectation?

 Cheers,

 Tom
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] vconsole: default to the kernel compiled-in font

2012-09-21 Thread Tom Gundersen
No longer override the default kernel font if nothing is specified in
vconsole.conf.

The default kernel font[0] provides ISO-8859-1 and box characters. Users
of Arabic, Cyrilic or Hebrew must set a different font manually as these
character sets were provided by the old default font [1], but are not
any longer.

Rationale:

 * it is counter-intuitive that an empty vconsole.conf file is different
   from adding FONT=;
 * the version of the default font shipped with Arch (which is the
   upstream one) behaves very badly during early boot[2] (which should
   admittedly be fixed in the font itself);
 * the kernel already supplies a default font, it seems reasonable to
   use that unless anything else is specified;
 * This also avoids a needless slow call to setfont; and
 * We don't want to work around problems in the kernel (in case the
   compiled-in font is not acceptable for whatever reason).

[0]: https://dev.archlinux.org/~tomegun/kernel.bdf
[1]: https://dev.archlinux.org/~tomegun/latarcyrheb.bdf
[2]: http://i.imgur.com/J2tM4.jpg
---
 Makefile.am   | 19 ++-
 man/vconsole.conf.xml |  4 +---
 src/vconsole/vconsole-setup.c |  5 ++---
 3 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 5da132c..717e325 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -160,43 +160,36 @@ AM_LDFLAGS = $(OUR_LDFLAGS)
 if TARGET_GENTOO
 AM_CPPFLAGS += \
-DKBD_LOADKEYS=\/usr/bin/loadkeys\ \
-   -DKBD_SETFONT=\/usr/bin/setfont\ \
-   -DDEFAULT_FONT=\LatArCyrHeb-16\
+   -DKBD_SETFONT=\/usr/bin/setfont\
 else
 if TARGET_ARCH
 AM_CPPFLAGS += \
-DKBD_LOADKEYS=\/usr/bin/loadkeys\ \
-   -DKBD_SETFONT=\/usr/bin/setfont\ \
-   -DDEFAULT_FONT=\LatArCyrHeb-16\
+   -DKBD_SETFONT=\/usr/bin/setfont\
 else
 if TARGET_FRUGALWARE
 AM_CPPFLAGS += \
-DKBD_LOADKEYS=\/usr/bin/loadkeys\ \
-   -DKBD_SETFONT=\/usr/bin/setfont\ \
-   -DDEFAULT_FONT=\LatArCyrHeb-16\
+   -DKBD_SETFONT=\/usr/bin/setfont\
 else
 if TARGET_MANDRIVA
 AM_CPPFLAGS += \
-DKBD_LOADKEYS=\/bin/loadkeys\ \
-   -DKBD_SETFONT=\/bin/setfont\ \
-   -DDEFAULT_FONT=\LatArCyrHeb-16\
+   -DKBD_SETFONT=\/bin/setfont\
 else
 if TARGET_ANGSTROM
 AM_CPPFLAGS += \
-DKBD_LOADKEYS=\/usr/bin/loadkeys\ \
-   -DKBD_SETFONT=\/usr/bin/setfont\ \
-   -DDEFAULT_FONT=\LatArCyrHeb-16\
+   -DKBD_SETFONT=\/usr/bin/setfont\
 else
 if TARGET_MAGEIA
 AM_CPPFLAGS += \
-DKBD_LOADKEYS=\/bin/loadkeys\ \
-   -DKBD_SETFONT=\/bin/setfont\ \
-   -DDEFAULT_FONT=\LatArCyrHeb-16\
+   -DKBD_SETFONT=\/bin/setfont\
 else
 AM_CPPFLAGS += \
-DKBD_LOADKEYS=\/bin/loadkeys\ \
-DKBD_SETFONT=\/bin/setfont\ \
-   -DDEFAULT_FONT=\latarcyrheb-sun16\
 endif
 endif
 endif
diff --git a/man/vconsole.conf.xml b/man/vconsole.conf.xml
index e23a980..258c82b 100644
--- a/man/vconsole.conf.xml
+++ b/man/vconsole.conf.xml
@@ -112,9 +112,7 @@
 
 listitemparaConfigures the console
 font, the console map and the unicode
-font map. varnameFONT=/varname
-defaults to
-
literallatarcyrheb-sun16/literal./para/listitem
+font map./para/listitem
 /varlistentry
 
 /variablelist
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index 62d9c8d..1227b04 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -215,10 +215,9 @@ int main(int argc, char **argv) {
 utf8 = is_locale_utf8();
 
 vc_keymap = strdup(us);
-vc_font = strdup(DEFAULT_FONT);
 
-if (!vc_keymap || !vc_font) {
-log_error(Failed to allocate strings.);
+if (!vc_keymap) {
+log_error(Failed to allocate string.);
 goto finish;
 }
 
-- 
1.7.12.1

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] tmpfiles: allow Age to be set to 0d

2012-09-21 Thread Tom Gundersen
On Tue, Sep 11, 2012 at 12:52 AM, Lennart Poettering
lenn...@poettering.net wrote:
 What is the intended behaviour of an age setting of 0?

Not sure I understand your question.

For all intents and purposes 0s is the same as 1us (or something else
sufficiently small). I.e., the file is cleaned up every time
systemd-tmpfiles --clean is called. This is probably not something you
want during normal operation (though some obviously do). However, it
is useful when testing systemd-tmpfiles, and surprising that it does
not work.

 if we add this we
 probably should document that?

What did you have in mind for documentation? The way I read the
manpage 0s is valid and this patch gives the correct behavior. Am I
missing something?

Cheers,

Tom
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] systemctl: fix misleading warning message

2012-09-21 Thread Michal Sekletar
From: Michal Sekletar sekleta...@gmail.com

When stopping multiple units at once do not print warning about
triggering units when they are stopped by the same command.
---
 src/systemctl/systemctl.c |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index cc9c775..f8bcb2c 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -1443,7 +1443,8 @@ finish:
 
 static void check_triggering_units(
 DBusConnection *bus,
-const char *unit_name) {
+const char *unit_name,
+char **args) {
 
 DBusMessage _cleanup_dbus_msg_unref_ *reply = NULL;
 DBusMessageIter iter, sub;
@@ -1503,7 +1504,8 @@ static void check_triggering_units(
 r = check_one_unit(bus, service_trigger, true);
 if (r  0)
 return;
-if (r == 0) {
+
+if (r == 0  !strv_find(args, service_trigger)) {
 if (print_warning_label) {
 log_warning(Warning: Stopping %s, but it can 
still be activated by:, unit_name);
 print_warning_label = false;
@@ -1723,10 +1725,10 @@ static int start_unit(DBusConnection *bus, char **args) 
{
  * another active unit (socket, path, timer) */
 if (!arg_quiet  streq(method, StopUnit)) {
 if (one_name)
-check_triggering_units(bus, one_name);
+check_triggering_units(bus, one_name, args + 
1);
 else
 STRV_FOREACH(name, args+1)
-check_triggering_units(bus, *name);
+check_triggering_units(bus, *name, 
args + 1);
 }
 }
 
-- 
1.7.9.6 (Apple Git-31.1)

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Various bug fixes

2012-09-21 Thread Václav Pavlín
You can find few patches for various bugs in attachement.

--
Regards

Václav Pavlín and Lukáš Nykrýn
From 55fa1c1b09933e55ce105279f2591674381c5345 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= vpav...@redhat.com
Date: Fri, 21 Sep 2012 12:04:02 +0200
Subject: [PATCH 01/18] cgtop: missing '-'

Return codes in systemd are negated and
if (r  0)  if (r == ENOENT)
was never true.
---
 src/cgtop/cgtop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index 3756328..9eb2d2f 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -300,7 +300,7 @@ static int refresh_one(
 
 r = cg_enumerate_subgroups(controller, path, d);
 if (r  0) {
-if (r == ENOENT)
+if (r == -ENOENT)
 return 0;
 
 return r;
-- 
1.7.11.4

From c8f330a8910d6d04c9c073961d3ab280a17cfd32 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= vpav...@redhat.com
Date: Fri, 21 Sep 2012 12:17:23 +0200
Subject: [PATCH 02/18] udev: check malloc return in collect/collect.c

Returns from no memory checks updated with log_oom call
---
 src/udev/collect/collect.c | 25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/udev/collect/collect.c b/src/udev/collect/collect.c
index 4162c43..47c2ddd 100644
--- a/src/udev/collect/collect.c
+++ b/src/udev/collect/collect.c
@@ -142,7 +142,7 @@ static int checkout(int fd)
 buf = calloc(1,bufsize + 1);
 if (!buf) {
 fprintf(stderr, Out of memory.\n);
-return -1;
+return log_oom();
 }
 memset(buf, ' ', bufsize);
 ptr = buf + len;
@@ -167,7 +167,16 @@ static int checkout(int fd)
 if (debug)
 fprintf(stderr, Found word %s\n, word);
 him = malloc(sizeof (struct _mate));
+if (!him) {
+free(buf);
+return log_oom();
+}
 him-name = strdup(word);
+if (!him-name) {
+free(buf);
+free(him);
+return log_oom();
+}
 him-state = STATE_OLD;
 udev_list_node_append(him-node, bunch);
 word = NULL;
@@ -276,7 +285,7 @@ static int missing(int fd)
 
 buf = malloc(bufsize);
 if (!buf)
-return -1;
+return log_oom();
 
 udev_list_node_foreach(him_node, bunch) {
 struct _mate *him = node_to_mate(him_node);
@@ -291,7 +300,7 @@ static int missing(int fd)
 tmpbuf = realloc(buf, bufsize);
 if (!tmpbuf) {
 free(buf);
-return -1;
+return log_oom();
 }
 buf = tmpbuf;
 }
@@ -431,7 +440,17 @@ int main(int argc, char **argv)
 if (debug)
 fprintf(stderr, ID %s: not in database\n, argv[i]);
 him = malloc(sizeof (struct _mate));
+if (!him) {
+ret = ENOMEM;
+goto out;
+}
+
 him-name = malloc(strlen(argv[i]) + 1);
+if (!him-name) {
+ret = ENOMEM;
+goto out;
+}
+
 strcpy(him-name, argv[i]);
 him-state = STATE_NONE;
 udev_list_node_append(him-node, bunch);
-- 
1.7.11.4

From 6497710f8a333866eb21b96816134409e69b1de4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= vpav...@redhat.com
Date: Fri, 21 Sep 2012 12:40:29 +0200
Subject: [PATCH 03/18] libudev: check return value of rename

---
 src/libudev/libudev-device-private.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/libudev/libudev-device-private.c b/src/libudev/libudev-device-private.c
index 00fa3b8..489bea8 100644
--- a/src/libudev/libudev-device-private.c
+++ b/src/libudev/libudev-device-private.c
@@ -101,6 +101,7 @@ int udev_device_update_db(struct udev_device *udev_device)
 char filename[UTIL_PATH_SIZE];
 char filename_tmp[UTIL_PATH_SIZE];
 FILE *f;
+int r;
 
 id = udev_device_get_id_filename(udev_device);
 if (id == 

[systemd-devel] Dynamic priorities for service loading using systemd ...

2012-09-21 Thread Hoyer, Marko (ADITG/SW2)
Hi all,

hope that is the right forum to raise my question.

I'm trying to realize a kind of dynamic mandatory / lazy service scenario using 
systemd.

This means in details that services are either mandatory or lazy. Mandatory 
services are started first, once all man. services have been loaded, the lazy 
ones can be started. It should not occur that a lazy service starts before the 
last mandatory one has been started.

For a static scenario I would define a mandatory target.  For all lazy services 
I would add a Requires and After dependency to this target.

But in my case, I need a more dynamic scenario. The assignment of services to 
mandatory or lazy is not fixed. It can be changed while the system is running 
or in worst case early during boot up. To my understanding I must automatically 
adapt the .services files of the services to realize such a scenario which 
looks a bit complicated to me.

Does anyone know another prettier solution for that.

Thanks in advance for help!!


Best regards

Marko Hoyer
Advanced Driver Information Technology GmbH
Software Group II (ADITG/SW1)
Robert-Bosch-Str. 200
31139 Hildesheim
Germany
Tel. +49 5121 49 6948
Fax +49 5121 49 6999
mho...@de.adit-jv.com
ADIT is a joint venture company of Robert Bosch GmbH/Robert Bosch Car 
Multimedia GmbH and DENSO Corporation
Sitz: Hildesheim, Registergericht: Amtsgericht Hildesheim HRB 3438
Geschäftsführung: Wilhelm Grabow, Katsuyoshi Maeda
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Various bug fixes

2012-09-21 Thread Lennart Poettering
On Fri, 21.09.12 15:25, Václav Pavlín (vpav...@redhat.com) wrote:

 You can find few patches for various bugs in attachement.

Thanks!

I'll let Kay merge the udev related patches. The rest I merged, with a
few exceptions:

 +r = 0;
  if (!isempty(cvtnr))
 -safe_atou32(cvtnr, vtnr);
 +r = safe_atou32(cvtnr, vtnr);
  
 -if (!isempty(display)  vtnr = 0) {
 +if (!isempty(display)  !r  vtnr = 0) {
  if (isempty(seat))
  get_seat_from_display(display, seat, vtnr);
  else if (streq(seat, seat0))

vtnr here is actually initialized to zero anyway, so if safe_atou32()
fails it will still be 0, and we'll detect this. With other words: the
missing error checking is not actually missing, I simply folded the
parse error check into the range check... To clarify this I have now
commited a patch explaining this.

 -if (mount(/etc/localtime, where, bind, MS_BIND, NULL) = 0)
 -mount(/etc/localtime, where, bind, 
 MS_BIND|MS_REMOUNT|MS_RDONLY, NULL);
 +if (mount(/etc/localtime, where, bind, MS_BIND, NULL) = 0) {
 +if (mount(/etc/localtime, where, bind, 
 MS_BIND|MS_REMOUNT|MS_RDONLY, NULL)  0)
 +log_warning(mount(%s) failed, file will be 
 writable: %m, where);
 +} else {
 +log_error(mount(%s) failed: %m, where);
 +return -errno;
 +}

Not sure about this. /etc/localtime mounting is really not that
important. Basically we do it here just to be nice, which is why I am
not generating any error messages for it. 

That all said this entire function is now broken, and should be fixed,
as /etc/localtime is now a symlink and we cannot bind mount
symlinks. I'll change it to simply sync the symlink by creating it anew.


 -if (mount(/etc/resolv.conf, where, bind, MS_BIND, NULL) = 0)
 -mount(/etc/resolv.conf, where, bind, 
 MS_BIND|MS_REMOUNT|MS_RDONLY, NULL);
 +if (mount(/etc/resolv.conf, where, bind, MS_BIND, NULL) = 0) {
 +if (mount(/etc/resolv.conf, where, bind, 
 MS_BIND|MS_REMOUNT|MS_RDONLY, NULL)  0)
 +log_warning(mount(%s) failed, file will be 
 writable: %m, where);
 +} else {
 +log_error(mount(%s) failed: %m, where);
 +return -errno;
 +}

Overmounting /etc/resolv.conf is another one of these cases where's it's
just nice to do this, but doesn't really matter, which is why we fail silently.

 +++ b/src/shared/hwclock.c
 @@ -78,7 +78,7 @@ static int rtc_open(int flags) {
  p = strjoin(/sys/class/rtc/, de-d_name, /hctosys, NULL);
  if (!p) {
  closedir(d);
 -return -ENOMEM;
 +return log_oom();
  }

Hmm, so, I don't think we should invoke log_oom() here. Library-style calls
like this one should probably not generate messages on their own, but
leave that to their callers. Returning ENOMEM is hence the right thing
here.

log_oom() is something for actual program code. The lines between
library code and program code are a bit blurry, admittedly, and
there are a couple of occasion where this currently not handled
correctly in the codebase, but we still should try to follow this rule
wherever applicable.

  r = read_one_line_file(p, v);
 @@ -94,6 +94,12 @@ static int rtc_open(int flags) {
  continue;
  
  p = strappend(/dev/, de-d_name);
 +
 +if (!p) {
 +closedir(d);
 +return log_oom();
 +}

This part is important however. so I canged this to -ENOMEM and commited
it.

 From 4f9408af71ff55aeac3b51d2fe6208c1cb8e2417 Mon Sep 17 00:00:00 2001
 From: Lukas Nykryn lnyk...@redhat.com
 Date: Fri, 21 Sep 2012 12:59:15 +0200
 Subject: [PATCH 16/18] journal: free JournalFile when *ret is null

Hmm, we shouldn't allow passing in a NULL ret here anyway. I have now
changed the sources to ensure this.

Thanks a ton for the thorough review! Much appreciated!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] vconsole: default to the kernel compiled-in font

2012-09-21 Thread Bill Nottingham
Tom Gundersen (t...@jklm.no) said: 
 No longer override the default kernel font if nothing is specified in
 vconsole.conf.
 
 The default kernel font[0] provides ISO-8859-1 and box characters. Users
 of Arabic, Cyrilic or Hebrew must set a different font manually as these
 character sets were provided by the old default font [1], but are not
 any longer.

I can see the rationale of fixing the default kernel font, but changing
the default behavior to one that explicitly excludes a large number of
configurations that had worked out of the box before is worrisome.

Also, doesn't relying on the default kernel font mean you don't know
what font you're actually getting? (I.e., if you boot with vgacon, vs
kmscon, vs vesafb, vs (other), you may get different defaults.) If so,
I think this might be a worse default than overriding it with our own.
(If I've misunderstood what happens here, I'd like to know that too.)

Bill
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Dynamic priorities for service loading using systemd ...

2012-09-21 Thread Lennart Poettering
On Fri, 21.09.12 12:37, Hoyer, Marko (ADITG/SW2) (mho...@de.adit-jv.com) wrote:

 Hi all,
 
 hope that is the right forum to raise my question.
 
 I'm trying to realize a kind of dynamic mandatory / lazy service
 scenario using systemd.
 
 This means in details that services are either mandatory or
 lazy. Mandatory services are started first, once all man. services
 have been loaded, the lazy ones can be started. It should not occur
 that a lazy service starts before the last mandatory one has been
 started.
 
 For a static scenario I would define a mandatory target.  For all lazy
 services I would add a Requires and After dependency to this target.
 
 But in my case, I need a more dynamic scenario. The assignment of
 services to mandatory or lazy is not fixed. It can be changed while
 the system is running or in worst case early during boot up. To my
 understanding I must automatically adapt the .services files of the
 services to realize such a scenario which looks a bit complicated to
 me.

My suggestion would be to use generators for this which dynamically can
extend the systemd dep tree at boot and config reload time:

http://www.freedesktop.org/wiki/Software/systemd/Generators

Whenever your dep changes you just need to invoke Reload() on the
systemd manager on the bus, and systemd will rerun these generators.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] systemctl: fix misleading warning message

2012-09-21 Thread Zbigniew Jędrzejewski-Szmek
On Mon, Sep 17, 2012 at 09:23:49PM +0200, Michal Sekletar wrote:
 From: Michal Sekletar sekleta...@gmail.com
 
 When stopping multiple units at once do not print warning about
 triggering units when they are stopped by the same command.
Hi,

is this warning actually still generated after 49111a70?

Zbyszek


 ---
  src/systemctl/systemctl.c |   10 ++
  1 file changed, 6 insertions(+), 4 deletions(-)
 
 diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
 index cc9c775..f8bcb2c 100644
 --- a/src/systemctl/systemctl.c
 +++ b/src/systemctl/systemctl.c
 @@ -1443,7 +1443,8 @@ finish:
  
  static void check_triggering_units(
  DBusConnection *bus,
 -const char *unit_name) {
 +const char *unit_name,
 +char **args) {
  
  DBusMessage _cleanup_dbus_msg_unref_ *reply = NULL;
  DBusMessageIter iter, sub;
 @@ -1503,7 +1504,8 @@ static void check_triggering_units(
  r = check_one_unit(bus, service_trigger, true);
  if (r  0)
  return;
 -if (r == 0) {
 +
 +if (r == 0  !strv_find(args, service_trigger)) {
  if (print_warning_label) {
  log_warning(Warning: Stopping %s, but it 
 can still be activated by:, unit_name);
  print_warning_label = false;
 @@ -1723,10 +1725,10 @@ static int start_unit(DBusConnection *bus, char 
 **args) {
   * another active unit (socket, path, timer) */
  if (!arg_quiet  streq(method, StopUnit)) {
  if (one_name)
 -check_triggering_units(bus, one_name);
 +check_triggering_units(bus, one_name, args + 
 1);
  else
  STRV_FOREACH(name, args+1)
 -check_triggering_units(bus, *name);
 +check_triggering_units(bus, *name, 
 args + 1);
  }
  }
  
 -- 
 1.7.9.6 (Apple Git-31.1)
 
 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel
 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] Fix compilation error due to wrong __NR_name_to_handle_at definition

2012-09-21 Thread Eelco Dolstra
__NR_name_to_handle should read __NR_name_to_handle_at.  This
fixes a compilation error on systems with older kernel headers.
---
 src/shared/missing.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/shared/missing.h b/src/shared/missing.h
index c5bb71a..14abe4e 100644
--- a/src/shared/missing.h
+++ b/src/shared/missing.h
@@ -209,12 +209,12 @@ static inline pid_t gettid(void) {
 #endif
 
 #ifdef __x86_64__
-#  ifndef __NR_name_to_handle
-#define __NR_name_to_handle 303
+#  ifndef __NR_name_to_handle_at
+#define __NR_name_to_handle_at 303
 #  endif
 #else
-#  ifndef __NR_name_to_handle
-#define __NR_name_to_handle 341
+#  ifndef __NR_name_to_handle_at
+#define __NR_name_to_handle_at 341
 #  endif
 #endif
 
-- 
1.7.11.4

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] No TTY and inability to shutdown/reboot from user session

2012-09-21 Thread Daniel J Walsh
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Seems to be SELinux patch is causing systemd-logind not to be able to send
dbus message to systemd.

In the logs I see this message

Sep 21 16:57:39 celtics systemd-logind[874]: System is powering down.
Sep 21 16:57:39 celtics systemd-logind[874]: Failed to issue method call:
Resource temporarily unavailable

Which looks like the dbus call is failing.  I believe this is the same problem.

I have to run but will continue to work on this on Monday.  Any ideas on what
could cause it?


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBc1ucACgkQrlYvE4MpobOgZQCgtOIVhfSwF6hcMuogizP+KR34
4sEAn1CGXefCBWCWr2zLUrggzuHfKrxX
=CxxD
-END PGP SIGNATURE-
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Fix compilation error due to wrong __NR_name_to_handle_at definition

2012-09-21 Thread Lennart Poettering
On Fri, 21.09.12 12:55, Eelco Dolstra (eelco.dols...@logicblox.com) wrote:

 __NR_name_to_handle should read __NR_name_to_handle_at.  This
 fixes a compilation error on systems with older kernel headers.

Applied. Thanks!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [ANNOUNCE] systemd 191

2012-09-21 Thread Lennart Poettering
Heya,

http://www.freedesktop.org/software/systemd/systemd-191.tar.xz

This is primarily a bugfix release.

CHANGES WITH 191:

* nspawn will now create a symlink /etc/localtime in the
  container environment, copying the host's timezone
  setting. Previously this has been done via a bind mount, but
  since symlinks cannot be bind mounted this has now been
  changed to create/update the appropriate symlink.

* journalctl -n's line number argument is now optional, and
  will default to 10 if omitted.

* journald will now log the maximum size the journal files may
  take up on disk. This is particularly useful if the default
  built-in logic of determining this parameter from the file
  system size is used. Use systemctl status
  systemd-journald.service to see this information.

* The multi-seat X wrapper tool has been stripped down. As X
  is now capable of enumerating graphics devices via udev in a
  seat-aware way the wrapper is not strictly necessary
  anymore. A stripped down temporary stop-gap is still shipped
  until the upstream display managers have been updated to
  fully support the new X logic. Expect this wrapper to be
  removed entirely in one of the next releases.

* HandleSleepKey= in logind.conf has been split up into
  HandleSuspendKey= and HandleHibernateKey=. The old setting
  is not available anymore. X11 and the kernel are
  distuingishing between these keys and we should too. This
  also means the inhibition lock for these keys has been split
  into two.

Changes from: Dave Airlie, Eelco Dolstra, Lennart Poettering,
Lukas Nykryn, Václav Pavlín


Lennart

-- 
Lennart Poettering - Red Hat, Inc.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] Prevent cryptsetup from logging plain-text passphrases from /etc/crypttab

2012-09-21 Thread Karel Tuma
Just got bitten by this one. Instead, just warn the user legacy syntax
is no longer supported.


password.patch
Description: Binary data
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [ANNOUNCE] systemd 191

2012-09-21 Thread Dave Reisner
On Sat, Sep 22, 2012 at 12:41:49AM +0200, Lennart Poettering wrote:
 Heya,
 
 http://www.freedesktop.org/software/systemd/systemd-191.tar.xz
 
 This is primarily a bugfix release.

This does not build from git:

make[2]: *** No rule to make target `src/journal/test-mmap-cache.c', needed by 
`src/journal/test-mmap-cache.o'.  Stop.
make[2]: *** Waiting for unfinished jobs

Did you forget to commit a file?

 CHANGES WITH 191:
 
 * nspawn will now create a symlink /etc/localtime in the
   container environment, copying the host's timezone
   setting. Previously this has been done via a bind mount, but
   since symlinks cannot be bind mounted this has now been
   changed to create/update the appropriate symlink.
 
 * journalctl -n's line number argument is now optional, and
   will default to 10 if omitted.
 
 * journald will now log the maximum size the journal files may
   take up on disk. This is particularly useful if the default
   built-in logic of determining this parameter from the file
   system size is used. Use systemctl status
   systemd-journald.service to see this information.
 
 * The multi-seat X wrapper tool has been stripped down. As X
   is now capable of enumerating graphics devices via udev in a
   seat-aware way the wrapper is not strictly necessary
   anymore. A stripped down temporary stop-gap is still shipped
   until the upstream display managers have been updated to
   fully support the new X logic. Expect this wrapper to be
   removed entirely in one of the next releases.
 
 * HandleSleepKey= in logind.conf has been split up into
   HandleSuspendKey= and HandleHibernateKey=. The old setting
   is not available anymore. X11 and the kernel are
   distuingishing between these keys and we should too. This
   also means the inhibition lock for these keys has been split
   into two.
 
 Changes from: Dave Airlie, Eelco Dolstra, Lennart Poettering,
 Lukas Nykryn, Václav Pavlín
 
 
 Lennart
 
 -- 
 Lennart Poettering - Red Hat, Inc.
 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [ANNOUNCE] systemd 190

2012-09-21 Thread Eelco Dolstra
Hi,

On 20/09/12 16:39, Lennart Poettering wrote:

 * We will now mount the cgroup controllers cpu, cpuacct,
   cpuset and the controllers net_cls, net_prio together by
   default.

Joining the cpuset controller with cpu/cpuacct caused problems on my system
(NixOS Linux): services, in particular those using Type=forking, would
randomly fail to start.  It turns out that this is because systemd uses the cpu
hierarchy to determine if a service has any running processes left, but the
addition of cpuset causes adding tasks to control groups to fail with ENOSPC:

open(/sys/fs/cgroup/cpu/system/nscd.service/control/tasks,
O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 30
write(30, 7210\n, 5)  = -1 ENOSPC (No space left on device)

Because tasks remains empty, systemd concludes that the service has no
processes left and kills it.  (For the killing it uses
/sys/fs/cgroup/systemd/system/service/cgroup.procs, which *does* have the
correct contents.)

The ENOSPC is because the attributes /sys/fs/cgroup/cpu/.../cpuset.{mems,cpus}
are not set in the per-service cgroups, as required by the cpuset controller.
Apparently setting /sys/fs/cgroup/cpu/cgroup.clone_children to 1 should cause
cpuset.{mems,cpus} to be inherited from the top-level cgroup, but as far as I
can tell, systemd doesn't set clone_children anywhere.  What is the right way to
deal with this?

Thanks,

Eelco.

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel