[systemd-devel] [PATCH 1/2] build-sys: move python helpers to tools directory

2014-02-10 Thread Karel Zak
Note that make-man-rules.py is missing in EXTRA_DIST=, this patch
fixes this mistake too.
---
 Makefile.am   |  13 +-
 make-directive-index.py   | 320 --
 make-man-index.py | 136 --
 make-man-rules.py | 113 ---
 tools/make-directive-index.py | 320 ++
 tools/make-man-index.py   | 136 ++
 tools/make-man-rules.py   | 113 +++
 tools/xml_helper.py   |  41 ++
 xml_helper.py |  41 --
 9 files changed, 617 insertions(+), 616 deletions(-)
 delete mode 100755 make-directive-index.py
 delete mode 100755 make-man-index.py
 delete mode 100644 make-man-rules.py
 create mode 100755 tools/make-directive-index.py
 create mode 100755 tools/make-man-index.py
 create mode 100644 tools/make-man-rules.py
 create mode 100644 tools/xml_helper.py
 delete mode 100644 xml_helper.py

diff --git a/Makefile.am b/Makefile.am
index 4f5e036..e3c1145 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -610,16 +610,16 @@ XML_GLOB = $(wildcard $(top_srcdir)/man/*.xml 
$(top_builddir)/man/*.xml)
 NON_INDEX_XML_FILES = $(filter-out man/systemd.index.xml,$(XML_FILES))
 SOURCE_XML_FILES = $(filter-out 
man/systemd.directives.xml,$(NON_INDEX_XML_FILES))
 
-update-man-list: make-man-rules.py $(XML_GLOB)
+update-man-list: $(top_srcdir)/tools/make-man-rules.py $(XML_GLOB)
$(AM_V_GEN)$(PYTHON) $^  $(top_srcdir)/Makefile-man.tmp
$(AM_V_at)mv $(top_srcdir)/Makefile-man.tmp 
$(top_srcdir)/Makefile-man.am
@echo Makefile-man.am has been regenerated
 
-man/systemd.index.xml: make-man-index.py $(NON_INDEX_XML_FILES)
+man/systemd.index.xml: $(top_srcdir)/tools/make-man-index.py 
$(NON_INDEX_XML_FILES)
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(PYTHON) $ $@ $(filter-out $,$^)
 
-man/systemd.directives.xml: make-directive-index.py $(SOURCE_XML_FILES)
+man/systemd.directives.xml: $(top_srcdir)/tools/make-directive-index.py 
$(SOURCE_XML_FILES)
$(AM_V_at)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)$(PYTHON) $ $@ $(filter-out $,$^)
 
@@ -641,9 +641,10 @@ EXTRA_DIST += \
$(HTML_FILES) \
$(HTML_ALIAS) \
$(man_MANS) \
-   make-man-index.py \
-   make-directive-index.py \
-   xml_helper.py
+   tools/make-man-index.py \
+   tools/make-directive-index.py \
+   tools/make-man-rules.py \
+   tools/xml_helper.py
 
 # 
--
 noinst_LTLIBRARIES += \
diff --git a/make-directive-index.py b/make-directive-index.py
deleted file mode 100755
index 2ff304f..000
--- a/make-directive-index.py
+++ /dev/null
@@ -1,320 +0,0 @@
-#  -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
-#
-#  This file is part of systemd.
-#
-#  Copyright 2012-2013 Zbigniew J??drzejewski-Szmek
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-#
-#  systemd is distributed in the hope that it will be useful, but
-#  WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public License
-#  along with systemd; If not, see http://www.gnu.org/licenses/.
-
-import sys
-import collections
-import re
-from xml_helper import *
-from copy import deepcopy
-
-TEMPLATE = '''\
-refentry id=systemd.directives conditional=HAVE_PYTHON
-
-refentryinfo
-titlesystemd.directives/title
-productnamesystemd/productname
-
-authorgroup
-author
-contribDeveloper/contrib
-firstnameZbigniew/firstname
-surnameJ??drzejewski-Szmek/surname
-emailzbys...@in.waw.pl/email
-/author
-/authorgroup
-/refentryinfo
-
-refmeta
-refentrytitlesystemd.directives/refentrytitle
-manvolnum7/manvolnum
-/refmeta
-
-refnamediv
-refnamesystemd.directives/refname
-refpurposeIndex of configuration directives/refpurpose
-/refnamediv
-
-refsect1
-titleUnit directives/title
-
-paraDirectives for configuring units, used in unit
-files./para
-
-variablelist id='unit-directives' /
-/refsect1
-
-refsect1
-titleOptions on the kernel command line/title
-
-paraKernel boot options for configuring the behaviour of the
-   

[systemd-devel] [PATCH 2/2] build-sys: add check-includes build target and script

2014-02-10 Thread Karel Zak
---
 Makefile.am |  8 
 tools/check-includes.pl | 23 +++
 2 files changed, 31 insertions(+)
 create mode 100755 tools/check-includes.pl

diff --git a/Makefile.am b/Makefile.am
index e3c1145..09a827b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4937,6 +4937,14 @@ CLEANFILES += \
 check-api-unused: defined undefined exported
( cat exported undefined ) | sort -u  | diff -u - defined | grep ^+ | 
grep -v ^+++ | cut -c2-
 
+.PHONY: check-includes
+check-includes: $(top_srcdir)/tools/check-includes.pl
+   $(AM_V_GEN) find * -name '*.[hcS]' -type f -print | sort -u \
+   | xargs $(top_srcdir)/tools/check-includes.pl
+
+EXTRA_DIST += \
+   $(top_srcdir)/tools/check-includes.pl
+
 # Stupid test that everything purported to be exported really is
 
 define generate-sym-test
diff --git a/tools/check-includes.pl b/tools/check-includes.pl
new file mode 100755
index 000..bf23929
--- /dev/null
+++ b/tools/check-includes.pl
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+#
+# checkincludes: Find files included more than once in (other) files.
+# Copyright abandoned, 2000, Niels Kristian Bech Jensen n...@image.dk.
+
+foreach $file (@ARGV) {
+   open(FILE, $file) or die Cannot open $file: $!.\n;
+
+   my %includedfiles = ();
+
+   while (FILE) {
+   if (m/^\s*#\s*include\s*[](\S*)[]/o) {
+   ++$includedfiles{$1};
+   }
+   }
+   foreach $filename (keys %includedfiles) {
+   if ($includedfiles{$filename}  1) {
+   print $file: $filename is included more than once.\n;
+   }
+   }
+
+   close(FILE);
+}
-- 
1.8.5.3

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


Re: [systemd-devel] [PATCH] nspawn: require /etc/os-release only for init

2014-02-10 Thread Tom Gundersen
On Sun, Feb 9, 2014 at 10:49 AM, Vincent Batts vba...@redhat.com wrote:
 /etc/os-release is expected for the case for booting a full system, and
 need not be required for thin container execution.

Applied manually, so please verify that it is as expected. Thanks for the patch!

Cheers,

Tom

  src/nspawn/nspawn.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
 index f904ebe..cf03a40 100644
 --- a/src/nspawn/nspawn.c
 +++ b/src/nspawn/nspawn.c
 @@ -1200,7 +1200,7 @@ int main(int argc, char *argv[]) {
  goto finish;
  }
  -if (path_is_os_tree(arg_directory) = 0) {
 +if (arg_boot  path_is_os_tree(arg_directory) = 0) {
  log_error(Directory %s doesn't look like an OS root
 directory (/etc/os-release is missing). Refusing., arg_directory);
  goto finish;
  }
 --
 1.8.4


 ___
 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] [PATCH] fstab-generator: Create fsck-root symlink with correct path

2014-02-10 Thread Tom Gundersen
On Sun, Feb 9, 2014 at 1:07 PM, Colin Guthrie co...@mageia.org wrote:


 Not sure if this should really check for /etc... units, but other generators
 e.g. the rc-local doesn't do that so I presume it's OK like this.


Looks good to me like this. Applied. Thanks!

Cheers,

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


Re: [systemd-devel] [PATCH v2 0/7] logind: close races on user and session states

2014-02-10 Thread Djalal Harouni
On Sat, Feb 08, 2014 at 05:00:57PM +0100, Djalal Harouni wrote:
 On Sat, Feb 08, 2014 at 12:39:25AM +0100, Zbigniew Jędrzejewski-Szmek wrote:
  On Thu, Feb 06, 2014 at 09:37:13PM +0100, Djalal Harouni wrote:
   Summary:
   Currently logind will not clear sessions on logout. The bug is confirmed
   for getty and ssh logins. This series is preparation for next patches to
   address that bug, it does not fix it.
   However, this series also fixe real races on user and session states.
   This ensures that user_save() and session_save() functions will write the
   correct user and session state to the state files.
   
   
   The logind bug was already discussed here:
   http://lists.freedesktop.org/archives/systemd-devel/2014-January/015968.html
  
  So, I did some testing with current git (ba978d7). And this bug
  appears to be only partially gone. After my second user logs out, loginctl
  stops showing the session. But the manager *remains*.
 I confirm this, I've identified the problem, please see below.
 
  Hm, the manager remains, but /run/user/uid/systemd/ gets nuked.
  So when the user logins in a second time, communication with user manager
  is broken.
 I also confirm, I didn't have time to debug this one.
Ok this one was also fixed by the same patch:
http://lists.freedesktop.org/archives/systemd-devel/2014-February/016754.html

I guess, the runtime dir will be removed on logout in user_finalize(),
but user_stop() was never called so the service is still active. During
next loggin, the service unit which is still active will prevent creating
the private dbus socket... anyway it works now, we'll see what Lennart
thinks.

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


[systemd-devel] [PATCH] sd-bus: export sd_bus_call{, _async, _async_cancel}

2014-02-10 Thread David Herrmann
The .sym file somehow lacks these declarations, so add these. You have to
run make clean to make sure the sym-test runs fine afterwards.
---
Hi

No idea whether these were intentionally left out. If not, I can push this patch
myself. A short ACK/NACK is enough.

Thanks
David

 src/libsystemd/libsystemd.sym | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/libsystemd/libsystemd.sym b/src/libsystemd/libsystemd.sym
index a5aa1d1..b4e4af1 100644
--- a/src/libsystemd/libsystemd.sym
+++ b/src/libsystemd/libsystemd.sym
@@ -112,6 +112,9 @@ global:
 sd_bus_get_name;
 sd_bus_send;
 sd_bus_send_to;
+sd_bus_call;
+sd_bus_call_async;
+sd_bus_call_async_cancel;
 sd_bus_get_fd;
 sd_bus_get_events;
 sd_bus_get_timeout;
-- 
1.8.5.4

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


[systemd-devel] [BUG] sd-bus: ObjectManager.InterfacesAdded() and fdo.DBus interfaces

2014-02-10 Thread David Herrmann
Hi

I stumbled over this when trying to use the ObjectManager interface
with sd-bus. Whenever I add new objects, I'm supposed to advertise
them with all supported interfaces. However, sd-bus implements the
org.freedesktop.DBus.XY interfaces internally so I cannot add vtables
for it. This means, sd_bus_emit_interfaces_added() cannot take these
into account. For sd_bus_emit_interfaces_removed() this works as it is
just a shallow wrapper.

I tried fixing that but it's not very easy.
sd_bus_emit_interfaces_added() is also used whenever an existing
object *gains* additional interfaces. So we cannot set the standard
interfaces by default.

I'm now stuck trying to fix it. I have a few ideas:

1) add sd_bus_emit_object_added() which is exactly the same as
sd_bus_emit_interfaces_added() but automatically adds the
org.freedesktop.DBus.XY interfaces supported on the object.

2) make sd_bus_emit_interfaces_added() add the default interfaces
*all* the time. This might work well but will send the
interface-entries uselessly on every call.

3) ignore them. Anyone using ObjectManager() has to use Properties
anyway. I don't know how well this works with gdbus, though. And we'd
also have to add the Introspectable and Peer interfaces there.

Ideas? Or should I just ignore this? I don't really care as I use
interfaces explicitly and not implicitly. But these fancy
language-bindings might care. No idea..

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


[systemd-devel] [PATCH] 60-persistent-storage.rules: add NVMe disks and partitions

2014-02-10 Thread harald
From: Harald Hoyer har...@redhat.com

Although NVMe PCIe SSD are not named sd*, they can be queried with
scsi_id and handled equally.
---
 rules/60-persistent-storage.rules | 5 +
 1 file changed, 5 insertions(+)

diff --git a/rules/60-persistent-storage.rules 
b/rules/60-persistent-storage.rules
index 154ffd9..8d46f24 100644
--- a/rules/60-persistent-storage.rules
+++ b/rules/60-persistent-storage.rules
@@ -42,6 +42,11 @@ KERNEL==cciss*, ENV{DEVTYPE}==disk, 
ENV{ID_SERIAL}!=?*, IMPORT{program}=s
 KERNEL==sd*|sr*|cciss*, ENV{DEVTYPE}==disk, ENV{ID_SERIAL}==?*, 
SYMLINK+=disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}
 KERNEL==sd*|cciss*, ENV{DEVTYPE}==partition, ENV{ID_SERIAL}==?*, 
SYMLINK+=disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n
 
+# NVMe
+KERNEL==nvme?n?, ENV{ID_SERIAL}!=?*, IMPORT{program}=scsi_id --export 
--whitelisted -d $devnode, ENV{ID_BUS}=scsi
+KERNEL==nvme?n?, ENV{DEVTYPE}==disk, ENV{ID_SERIAL}==?*, 
SYMLINK+=disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}
+KERNEL==nvme?n?*, ENV{DEVTYPE}==partition, ENV{ID_SERIAL}==?*, 
SYMLINK+=disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n
+
 # firewire
 KERNEL==sd*[!0-9]|sr*, ATTRS{ieee1394_id}==?*, 
SYMLINK+=disk/by-id/ieee1394-$attr{ieee1394_id}
 KERNEL==sd*[0-9], ATTRS{ieee1394_id}==?*, 
SYMLINK+=disk/by-id/ieee1394-$attr{ieee1394_id}-part%n
-- 
1.8.4.2

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


Re: [systemd-devel] systemd-networkd + VLANs problems

2014-02-10 Thread Tom Gundersen
On Sat, Feb 8, 2014 at 8:39 AM, Oleksii Shevchuk alx...@gmail.com wrote:
 So, I try to use VLANs feature introduced to systemd-networkd/git two
 weeks ago (54abf461d6b10dc270c4bb2aeac65f240ff1c5cd).

 I want to have next layout:

 Links:

 1. Eth
 1.1 Vlan1
 1.2 Vlan2 (Ring1)
 2. Bridge (Ring0)
 2.1 Vlan2

 Networks:

 1. Vlan1
 2. Bridge

 So, I try next configs:

 cat Ring0.netdev
 [NetDev]
 Name=br0
 Kind=bridge

 cat Ring1.netdev
 [NetDev]
 Name=vlan2
 Kind=vlan

 [VLAN]
 Id=2

 cat LocalLink.network
 [Match]
 Name=vlan2

 [Network]
 Bridge=br0

 .. and some other .network configs with IP configuration.

 At this point, nothing works -- no vlan links were created. So, I grep
 sources, and find out the Network.VLAN option (note - missing in man
 page). So I add some more configs:

 cat Switch1.network
 [Match]
 Name=net1

 [Network]
 VLAN=vlan1

 cat Switch2.network
 [Match]
 Name=net1

 [Network]
 VLAN=vlan2

 At this point I have successfully running/configured vlan1, but not
 vlan2.

 Then I manually create and up vlan2 with iproute2. At this point device
 were up, but systemd-networkd didn't put it to bridge.

 So, the question is: how should I configure this layout with two vlans
 on one ethernet, where one of vlans is bridged?

Hi Oleksii,

Thanks for the report.

I have just fixed a bug causing networkd not to allow more than one
vlan on a given device. You'll want a configuration file like:

 cat Switch1.network
 [Match]
 Name=net1

 [Network]
 VLAN=vlan1
 VLAN=vlan2

The problem with having two .network files is that only the first one
(in alphabetical order) will be applied to your link (which is by
design).

I have not yet tested your full setup with the bridge as I'm at a
conference, but I'll get back to that in a coulpe of days.

Cheers,

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


Re: [systemd-devel] [PATCH] sd-bus: export sd_bus_call{, _async, _async_cancel}

2014-02-10 Thread David Herrmann
Hi

On Mon, Feb 10, 2014 at 4:46 PM, David Herrmann dh.herrm...@gmail.com wrote:
 The .sym file somehow lacks these declarations, so add these. You have to
 run make clean to make sure the sym-test runs fine afterwards.
 ---
 Hi

 No idea whether these were intentionally left out. If not, I can push this 
 patch
 myself. A short ACK/NACK is enough.

Ok, pushed.

Cheers
David

 Thanks
 David

  src/libsystemd/libsystemd.sym | 3 +++
  1 file changed, 3 insertions(+)

 diff --git a/src/libsystemd/libsystemd.sym b/src/libsystemd/libsystemd.sym
 index a5aa1d1..b4e4af1 100644
 --- a/src/libsystemd/libsystemd.sym
 +++ b/src/libsystemd/libsystemd.sym
 @@ -112,6 +112,9 @@ global:
  sd_bus_get_name;
  sd_bus_send;
  sd_bus_send_to;
 +sd_bus_call;
 +sd_bus_call_async;
 +sd_bus_call_async_cancel;
  sd_bus_get_fd;
  sd_bus_get_events;
  sd_bus_get_timeout;
 --
 1.8.5.4

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


Re: [systemd-devel] [PATCH] 60-persistent-storage.rules: add NVMe disks and partitions

2014-02-10 Thread Kay Sievers
On Mon, Feb 10, 2014 at 5:01 PM,  har...@redhat.com wrote:

 Although NVMe PCIe SSD are not named sd*, they can be queried with
 scsi_id and handled equally.

 +# NVMe
 +KERNEL==nvme?n?, ENV{ID_SERIAL}!=?*, IMPORT{program}=scsi_id --export 
 --whitelisted -d $devnode, ENV{ID_BUS}=scsi

nvme?n? seems wrong for %d fields, they seem not be be limited to 1 digit.

This is not ID_BUS=scsi, they just fake the data for scsi queries,
nothing should pretend any other SCSI properties here.

scsi_id is about to get removed and for real scsi devices be replaced
by tools from sg3utils.

We should find out what to do for nvme before we add any new users of
the scsi_id.

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


Re: [systemd-devel] [PATCH] sd-bus: export sd_bus_call{, _async, _async_cancel}

2014-02-10 Thread Zbigniew Jędrzejewski-Szmek
On Mon, Feb 10, 2014 at 04:46:22PM +0100, David Herrmann wrote:
 The .sym file somehow lacks these declarations, so add these.

 You have to
 run make clean to make sure the sym-test runs fine afterwards.
That's a bit surprising.

test-libsystemd-sym has test-libsystemd-sym.c in sources,
which in turn has src/libsystemd/libsystemd.sym as prerequisite,
so the tests should be rebuilt when .sym is modified. And indeed,
when I do that, .c gets regenerated and the test is rebuilt.

Zbyszek


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


[systemd-devel] [PATCH] pager: remove --no-init setting from LESS options

2014-02-10 Thread Jason A. Donenfeld
I use konsole. It has a nice feature that when the scrollbars have been
disabled -- like in the case of a full-console app like vim or less --
it makes the mouse wheel send up and down key strokes, so that
scrolling happens. It's really nice. I open up less, and then I can
scroll through it using the mouse wheel.

This doesn't work with systemd's pager, however, because systemd passes
--no-init to less. This patch removes this X flag.
---
 src/shared/pager.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/shared/pager.c b/src/shared/pager.c
index 72a29f2..2155713 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -89,9 +89,9 @@ int pager_open(bool jump_to_end) {
 close_pipe(fd);
 
 if (jump_to_end)
-setenv(LESS, FRSXMK+G, 1);
+setenv(LESS, FRSMK+G, 1);
 else
-setenv(LESS, FRSXMK, 1);
+setenv(LESS, FRSMK, 1);
 
 /* Make sure the pager goes away when the parent dies */
 if (prctl(PR_SET_PDEATHSIG, SIGTERM)  0)
-- 
1.8.5.3

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


Re: [systemd-devel] [PATCH] pager: remove --no-init setting from LESS options

2014-02-10 Thread Andrey Borzenkov
On Tue, Feb 11, 2014 at 9:15 AM, Mantas Mikulėnas graw...@gmail.com wrote:
 On Feb 11, 2014 7:02 AM, Jason A. Donenfeld ja...@zx2c4.com wrote:

 I use konsole. It has a nice feature that when the scrollbars have been
 disabled -- like in the case of a full-console app like vim or less --
 it makes the mouse wheel send up and down key strokes, so that
 scrolling happens. It's really nice. I open up less, and then I can
 scroll through it using the mouse wheel.

 This doesn't work with systemd's pager, however, because systemd passes
 --no-init to less. This patch removes this X flag.

 On the one hand, scrolling like that is convenient, in gnome-terminal as
 well – on the other hand, removing -X causes `less` open the alt screen
 mode even for really short outputs, which can become annoying quickly…


Should not it simply respect existing LESS value? Or, for that matter,
SYSTEMD_LESS if someone thinks of a good reason to have different
settings?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel