Re: [systemd-devel] systemd-nspawn: cannot join existing macvlan

2015-05-30 Thread Kai Krakow
Lennart Poettering lenn...@poettering.net schrieb:

 On Mon, 25.05.15 16:26, Kai Krakow (hurikha...@gmail.com) wrote:
 
 Lennart Poettering lenn...@poettering.net schrieb:
 
  On Fri, 08.05.15 20:53, Kai Krakow (hurikha...@gmail.com) wrote:
  
   # systemd-nspawn -b --link-journal=try-guest
   # --network-macvlan=enp4s0 --
   bind=/usr/portage --bind-ro=/usr/src --machine=test
   Spawning container test on /var/lib/machines/test.
   Press ^] three times within 1s to kill container.
   Failed to add new macvlan interfaces: File exists
   
   I still don't think that systemd-nspawn should insist on creating
   the host- side macvlan bridge and fail, if it cannot. It should just
   accept that it is already there.
  
  My findings show that it actually does accept this case. But I had to
  explicitly order the machines after network.target to successfully
  start at boot time.
  
  I changed git now to order nspawn units by default after
  network.target now. In the long run we should replace this by calling
  into networkd though, without waiting for all networking, for
  whatever that means...
 
 Well, now, with v220, we are back to the original problem:
 
 machines # systemd-nspawn --boot --link-journal=try-guest --machine=test
 -- network-macvlan=enp5s0
 Spawning container test on /var/lib/machines/test.
 Press ^] three times within 1s to kill container.
 Failed to add new macvlan interfaces: File exists
 
 If mv-enp5s0 is already there (maybe by means of another machine), it no
 longer starts any other machine on the same macvlan. I don't think this
 is how it should work.
 
 Well, there can only be one machine with the same name, and we use
 that name in the macvlan interface name. Please assign different names
 to your containers so that they will also get differently named
 macvlan names, and all should be good.

But what is the purpose of macvlan if you cannot merge different containers 
into the same LAN segment? One feature of macvlan is that all virtual MAC 
addresses can communicate with each other. That's why I also joined my host 
machine into that macvlan (by creating it with networkd).

The next issue with your argument is: AFAIR nspawn doesn't create a macvlan 
interface based on the machine name. You have to pass the name of a physical 
interface which transports this macvlan. The man page at least states that 
you use an existing physical interface:

--network-macvlan=
Create a macvlan interface of the specified Ethernet network
interface and add it to the container. A macvlan interface is a
virtual interface that adds a second MAC address to an existing
physical Ethernet link. The interface in the container will be named
after the interface on the host, prefixed with mv-. Note that
--network-macvlan= implies --private-network. This option may be
used more than once to add multiple network interfaces to the
container.

Trying to nspawn a macvlan without giving a physical device results in no 
such device:

# systemd-nspawn --boot --link-journal=try-guest --machine=gentoo-mysql-base 
--network-macvlan=
systemd-nspawn: option '--network-macvlan' requires an argument

# systemd-nspawn --boot --link-journal=try-guest --machine=test --network-
macvlan=test
Spawning container test on /var/lib/machines/test.
Press ^] three times within 1s to kill container.
Failed to resolve interface test: No such device

So your assumption about macvlan seems to be incorrect. The other network 
types may be based off the machine name but it doesn't work this way with 
macvlan.

So I wonder what the purpose of macvlan is if you can only create one 
machine using macvlan on my single physical link - and that's it?

I think the logic is wrong here in systemd-nspawn. Instead of trying to 
create the host-side macvlan itself it should insist of it being there 
already (to have one well-defined state to start with, and only optionally 
create it by itself). Then, it can join multiple machines to the same 
macvlan.

I'm using the following networkd config on the host to define this well-
defined state, enabling the host to also communicate through macvlan:

# cat /etc/systemd/network/10-macvlan.{netdev,network}
[NetDev]
Name=mv-enp5s0
Kind=macvlan

[MACVLAN]
Mode=bridge
#
[Match]
Name=en*

[Network]
MACVLAN=mv-enp5s0
LinkLocalAddressing=no
DHCP=no

If I remove this I am able to start one of the containers, but not two or 
more. If I use this I am not able to start any macvlan container.

-- 
Replies to list only preferred.

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


Re: [systemd-devel] What does udevd do

2015-05-30 Thread Tomasz Torcz
On Sat, May 30, 2015 at 09:53:36PM +0800, cee1 wrote:
 Hi all,
 
 If a service wants to be notified when a device is plugged in, it
 invokes routines of libudev which actually:
 * Receive notifications from the kernel via NETLINK socket.
 * Query the detailed info from /sys/...
 
 Am I right?
 
 Then udevd is only responsible for
 1) Making nodes, and doing other device initialization stuffs.

  udev does not make device nodes.  It parses rules, makes symlinks,
changes permissions etc.
  udev also maintains database with device informations.

 2) Notifying systemd, let systemd start related daemons.

-- 
Tomasz Torcz   72-|   80-|
xmpp: zdzich...@chrome.pl  72-|   80-|

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


Re: [systemd-devel] Questions about socket activated services

2015-05-30 Thread Andrei Borzenkov
В Sat, 30 May 2015 21:36:02 +0800
cee1 fykc...@gmail.com пишет:

 Hi all,
 
 Which service type should a socket activated service be?
 1. For systemd-udevd.service and systemd-journald.service, they are notify 
 type
 2. For dbus.service, it is simple type
 

It can be any type. notify is always preferred if started program
supports it.

 Does socket activation handles the timeout case?
 E.g. A.service connects to B.socket, but B.service spends a long time
 to be ready, may cause A.service receives ETIMEDOUT?
 

I suppose it is possible with Accept=false. With Accept=true connection
is accepted by systemd itself.

 When the service is activated, systemd will still listen to the socket
 but do nothing for incoming data, right?
 

Yes for Accept=false. For Accept=true it is always systemd which accepts
connection.

 BTW, netstat -lp shows only systemd is listening to a socket, but not
 show the one who also is listening to the socket, e.g.
 
 unix  2  [ ACC ] SEQPACKET  LISTENING 326  1/systemd
  /run/udev/control
 
 Curious why?
 

I think it is more netstat issue, apparently it shows the first process
it finds.

 
 

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


[systemd-devel] [PATCH] build-sys: Normalize paths of configure options

2015-05-30 Thread Filipe Brandenburger
From: Michael Biebl bi...@debian.org

Strip trailing slashes from options such as --with-rootprefix, so that building
with rootprefix=/ results in paths like /lib instead of //lib.

Also handle paths such as /usr/ gracefully.

Use m4/ax_normalize_path.m4 from the autoconf-archive project, which is now
included in our tree as per usual practices in using autoconf-archive macros.

Tested with the following configure options:
  ./configure \
--with-rootprefix=/ \
--with-rootlibdir=/lib64/ \
--prefix=/usr/ \
--libdir=/lib/ \
--with-bashcompletiondir=/bash-completion/completions/

(The prefix and libdir are already automatically normalized by Autoconf,
this command is testing the others.)

Compared the config.log and resulting trees (in particular man pages) to
confirm double slashes were not present in the latter.

Also tested that a configuration using default options is not affected and that
`make distcheck` still works as expected.
---
 configure.ac|   9 
 m4/ax_normalize_path.m4 | 115 
 2 files changed, 124 insertions(+)
 create mode 100644 m4/ax_normalize_path.m4

diff --git a/configure.ac b/configure.ac
index 92654a6..78d52e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1370,16 +1370,19 @@ AC_ARG_WITH([dbuspolicydir],
 AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
 [],
 [with_dbuspolicydir=${sysconfdir}/dbus-1/system.d])
+AX_NORMALIZE_PATH([with_dbuspolicydir])
 
 AC_ARG_WITH([dbussessionservicedir],
 AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session 
service directory]),
 [],
 [with_dbussessionservicedir=${datadir}/dbus-1/services])
+AX_NORMALIZE_PATH([with_dbussessionservicedir])
 
 AC_ARG_WITH([dbussystemservicedir],
 AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system 
service directory]),
 [],
 [with_dbussystemservicedir=${datadir}/dbus-1/system-services])
+AX_NORMALIZE_PATH([with_dbussystemservicedir])
 
 AC_ARG_WITH([bashcompletiondir],
 AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions 
directory]),
@@ -1389,29 +1392,35 @@ AC_ARG_WITH([bashcompletiondir],
 ] , [
 with_bashcompletiondir=${datadir}/bash-completion/completions
 ])])
+AX_NORMALIZE_PATH([with_bashcompletiondir])
 
 AC_ARG_WITH([zshcompletiondir],
 AS_HELP_STRING([--with-zshcompletiondir=DIR], [Zsh completions 
directory]),
 [], [with_zshcompletiondir=${datadir}/zsh/site-functions])
+AX_NORMALIZE_PATH([with_zshcompletiondir])
 
 AC_ARG_WITH([rootprefix],
 AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for 
config files and kernel modules]),
 [], [with_rootprefix=${ac_default_prefix}])
+AX_NORMALIZE_PATH([with_rootprefix])
 
 AC_ARG_WITH([rootlibdir],
 AS_HELP_STRING([--with-rootlibdir=DIR], [Root directory for libraries 
necessary for boot]),
 [],
 [with_rootlibdir=${libdir}])
+AX_NORMALIZE_PATH([with_rootlibdir])
 
 AC_ARG_WITH([pamlibdir],
 AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]),
 [],
 [with_pamlibdir=${with_rootlibdir}/security])
+AX_NORMALIZE_PATH([with_pamlibdir])
 
 AC_ARG_WITH([pamconfdir],
 AS_HELP_STRING([--with-pamconfdir=DIR], [Directory for PAM 
configuration]),
 [],
 [with_pamconfdir=${sysconfdir}/pam.d])
+AX_NORMALIZE_PATH([with_pamconfdir])
 
 AC_ARG_ENABLE([split-usr],
 AS_HELP_STRING([--enable-split-usr], [Assume that /bin, /sbin aren\'t 
symlinks into /usr]),
diff --git a/m4/ax_normalize_path.m4 b/m4/ax_normalize_path.m4
new file mode 100644
index 000..e8f9973
--- /dev/null
+++ b/m4/ax_normalize_path.m4
@@ -0,0 +1,115 @@
+# ===
+# http://www.gnu.org/software/autoconf-archive/ax_normalize_path.html
+# ===
+#
+# SYNOPSIS
+#
+#   AX_NORMALIZE_PATH(VARNAME, [REFERENCE_STRING])
+#
+# DESCRIPTION
+#
+#   Perform some cleanups on the value of $VARNAME (interpreted as a path):
+#
+# - empty paths are changed to '.'
+# - trailing slashes are removed
+# - repeated slashes are squeezed except a leading doubled slash '//'
+#   (which might indicate a networked disk on some OS).
+#
+#   REFERENCE_STRING is used to turn '/' into '\' and vice-versa: if
+#   REFERENCE_STRING contains some backslashes, all slashes and backslashes
+#   are turned into backslashes, otherwise they are all turned into slashes.
+#
+#   This makes processing of DOS filenames quite easier, because you can
+#   turn a filename to the Unix notation, make your processing, and turn it
+#   back to original notation.
+#
+# filename='A:\FOO\\BAR\'
+# old_filename=$filename
+# # Switch to the unix notation
+# AX_NORMALIZE_PATH([filename], [/])
+# 

Re: [systemd-devel] [PATCH 1/2] configure.ac: strip off trailing slashed from $rootprefix

2015-05-30 Thread Filipe Brandenburger
Hi,

On Fri, May 29, 2015 at 6:04 PM, Michael Biebl mbi...@gmail.com wrote:
 I we assume, autconf-archive is installed, the resulting patch would
 look like the attached diff.
 For convenience sake, we could also ship a copy of
 /usr/share/aclocal/ax_normalize_path.m4 in our m4/ directory.

Yep... indeed autoconf-archive is the way to go.

I tested your patch with some configure options and confirmed it works
as expected. I also checked that it doesn't break distcheck or
anything, so I think it's good to go...

I'll resend it here including the embedded autoconf-archive file in a
format that's ready for git am.

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


Re: [systemd-devel] Questions about socket activated services

2015-05-30 Thread Tom Gundersen
On Sat, May 30, 2015 at 3:36 PM, cee1 fykc...@gmail.com wrote:
 Which service type should a socket activated service be?
 1. For systemd-udevd.service and systemd-journald.service, they are notify 
 type
 2. For dbus.service, it is simple type

A service can be of type 'simple' if all that other services care
about that order themselves after it is that the sockets are available
(which they will always be as they are started by PID1 early on).
However, if the service in question does more work at startup that
other services want to wait for, then it needs to be of type 'notify',
and notify PID1 once it is ready. In the case of udev the work it
needs to do at startup is to apply permission to static device nodes
(you want to guarantee that this has finished before starting
follow-up services), if it had not been for that udev too could have
been of type 'simple'.

HTH,

Tom

 Does socket activation handles the timeout case?
 E.g. A.service connects to B.socket, but B.service spends a long time
 to be ready, may cause A.service receives ETIMEDOUT?

 When the service is activated, systemd will still listen to the socket
 but do nothing for incoming data, right?

 BTW, netstat -lp shows only systemd is listening to a socket, but not
 show the one who also is listening to the socket, e.g.
 
 unix  2  [ ACC ] SEQPACKET  LISTENING 326  1/systemd
  /run/udev/control
 
 Curious why?



 --
 Regards,

 - cee1
 ___
 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] What does udevd do

2015-05-30 Thread cee1
2015-05-31 5:52 GMT+08:00 Lennart Poettering lenn...@poettering.net:
 Then udevd is only responsible for
 1) Making nodes, and doing other device initialization stuffs.

 udev does not create device nodes. That's the job of devtmpfs in the
 kernel. udev will however apply access modes/acls/fix ownership create
 symlinks and so on.

That means ** all ** dev nodes are there when devtmpfs is mounted?
I thought devtmpfs makes a limited number of nodes for early boot-up.



-- 
Regards,

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


Re: [systemd-devel] [ANNOUNCE] Separating gudev from systemd

2015-05-30 Thread Zbigniew Jędrzejewski-Szmek
On Wed, May 27, 2015 at 11:21:06AM +0200, Bastien Nocera wrote:
 On Wed, 2015-05-20 at 12:01 +0200, David Herrmann wrote:
  Hi
  
  On Wed, May 20, 2015 at 8:46 AM, Tom Gundersen t...@jklm.no wrote:
   On Wed, May 20, 2015 at 8:24 AM, Martin Pitt 
   martin.p...@ubuntu.com wrote:
Hey David,

David Herrmann [2015-05-19 17:06 +0200]:
 We're about to remove gudev from the systemd repository, as it 
 is in
 no way related to the systemd code-base, nor used by the 
 systemd
 project.

This makes sense indeed. gudev used to be a standalone project 
before
it was merged into udev, so the circle is complete now :-)

For those of us who already packaged gudev from systemd 219, 
would it
be possible to bump the current release to 220, so that gudev can 
be
packaged without renaming the tarball and doing ugly version 
numbers?
Monotonously increasing version numbers and all.. (Yes, there are
epochs in Debian, and I'm sure RPM has these too, but they 
might not
be available everywhere and are generally frowned upon)
   
   While you are at it, why not bump it to 225 or something (just to
   guarantee that the last systemd release with gudev has a lower 
   version
   number than gudev at that time, so people can switch over whenever
   they want without having to worry about going backwards).
  
  I intend to apply patches to systemd-git until we finally removed it
  there. Given that we had 0 patches so far this year, it'll probably
  stay that way. Hence, there's no hurry in replacing gudev from 
  systemd
  with libgudev. It'd be enough to just drop the systemd sub-package 
  and
  provide a new libgudev package, even if that might not forcefully
  update the package.
  
  However, I see no reason not to bump it, so I'll gladly follow the
  packager's demands:
  
  https://github.com/systemd
  -devs/libgudev/commit/f6203336e5b1ccf896acc506b54ec895fdae98b4
  
  @Bastien: At your convenience, can you cherry-pick this and do 
  another
  release? Should have done this right away, sorry!
 
 Could you file this in our new Bugzilla? Otherwise, I end up losing
 track of it...

Hi Bastien,

do you have any plans for the package in Fedora?

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


Re: [systemd-devel] What does udevd do

2015-05-30 Thread Lennart Poettering
On Sat, 30.05.15 21:53, cee1 (fykc...@gmail.com) wrote:

 Hi all,
 
 If a service wants to be notified when a device is plugged in, it
 invokes routines of libudev which actually:
 * Receive notifications from the kernel via NETLINK socket.

Not quite. udev receives notifications from the kernel via netlink,
then augments it with some additional bits, and pushes it via netlink
to the clients. 

Normal clients will never directly get the kernel notifications, but
only the ones udev propagates.

 * Query the detailed info from /sys/...
 
 Am I right?
 
 Then udevd is only responsible for
 1) Making nodes, and doing other device initialization stuffs.

udev does not create device nodes. That's the job of devtmpfs in the
kernel. udev will however apply access modes/acls/fix ownership create
symlinks and so on.

 2) Notifying systemd, let systemd start related daemons.

systemd is more or less just a normal libudev client like any other.

Lennart

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


Re: [systemd-devel] What does udevd do

2015-05-30 Thread Greg KH
On Sun, May 31, 2015 at 10:26:46AM +0800, cee1 wrote:
 2015-05-31 5:52 GMT+08:00 Lennart Poettering lenn...@poettering.net:
  Then udevd is only responsible for
  1) Making nodes, and doing other device initialization stuffs.
 
  udev does not create device nodes. That's the job of devtmpfs in the
  kernel. udev will however apply access modes/acls/fix ownership create
  symlinks and so on.
 
 That means ** all ** dev nodes are there when devtmpfs is mounted?

Yes.

 I thought devtmpfs makes a limited number of nodes for early boot-up.

Nope, try it out and see for yourself :)

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


Re: [systemd-devel] What does udevd do

2015-05-30 Thread Andrei Borzenkov
В Sun, 31 May 2015 10:26:46 +0800
cee1 fykc...@gmail.com пишет:

 2015-05-31 5:52 GMT+08:00 Lennart Poettering lenn...@poettering.net:
  Then udevd is only responsible for
  1) Making nodes, and doing other device initialization stuffs.
 
  udev does not create device nodes. That's the job of devtmpfs in the
  kernel. udev will however apply access modes/acls/fix ownership create
  symlinks and so on.
 
 That means ** all ** dev nodes are there when devtmpfs is mounted?
 I thought devtmpfs makes a limited number of nodes for early boot-up.
 
 
 

Not as a general rule but my distribution still has e.g.

/usr/lib/tmpfiles.d/parallel-printer.conf:c/dev/lp0  0660 root lp   - 6:0
/usr/lib/tmpfiles.d/parallel-printer.conf:c/dev/lp1  0660 root lp   
- 6:1
/usr/lib/tmpfiles.d/parallel-printer.conf:c/dev/lp2  0660 root lp   
- 6:2
/usr/lib/tmpfiles.d/parallel-printer.conf:c/dev/lp3  0660 root lp   
- 6:3

But that is rather exceptional case.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] build-sys: Normalize paths of configure options

2015-05-30 Thread systemd github import bot
Patchset imported to github.
Pull request:
https://github.com/systemd-devs/systemd/compare/master...systemd-mailing-devs:1432966890-8267-1-git-send-email-filbranden%40google.com

--
Generated by https://github.com/haraldh/mail2git
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 1/2] configure.ac: strip off trailing slashed from $rootprefix

2015-05-30 Thread Daniel Mack
On 05/30/2015 08:50 AM, Mike Gilbert wrote:
 On Fri, May 29, 2015 at 8:05 PM, Daniel Mack dan...@zonque.org wrote:
 Make sure the variable set via --with-rootprefix= does not contain a
 trailing slash, so man pages can use entities like rootprefix;/lib
 without ending up having double slashes.
 ---
  configure.ac | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

 diff --git a/configure.ac b/configure.ac
 index 92654a6..55b73de 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -1396,7 +1396,8 @@ AC_ARG_WITH([zshcompletiondir],

  AC_ARG_WITH([rootprefix],
  AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix 
 for config files and kernel modules]),
 -[], [with_rootprefix=${ac_default_prefix}])
 +[with_rootprefix=`echo ${withval} | sed -e s,/*$,,`],
 +[with_rootprefix=${ac_default_prefix}])
 
 Why do you pipe it through sed when a simple shell parameter expansion would 
 do?
 
 with_rootprefix=${withval%/}

Isn't that's a bash'ism which we try to avoid at other places? FWIW, we
use sed to strip off trailing dashes from $host for EFI_ARCH. Also, that
one only replaces one trailing slash, not all of them.

Anyway, Michael's AX_NORMALIZE_PATH approach seems to do the right
thing, so let's go for that.


Thanks,
Daniel

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


Re: [systemd-devel] [PATCH 1/2] configure.ac: strip off trailing slashed from $rootprefix

2015-05-30 Thread Mike Gilbert
On Fri, May 29, 2015 at 8:05 PM, Daniel Mack dan...@zonque.org wrote:
 Make sure the variable set via --with-rootprefix= does not contain a
 trailing slash, so man pages can use entities like rootprefix;/lib
 without ending up having double slashes.
 ---
  configure.ac | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

 diff --git a/configure.ac b/configure.ac
 index 92654a6..55b73de 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -1396,7 +1396,8 @@ AC_ARG_WITH([zshcompletiondir],

  AC_ARG_WITH([rootprefix],
  AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for 
 config files and kernel modules]),
 -[], [with_rootprefix=${ac_default_prefix}])
 +[with_rootprefix=`echo ${withval} | sed -e s,/*$,,`],
 +[with_rootprefix=${ac_default_prefix}])

Why do you pipe it through sed when a simple shell parameter expansion would do?

with_rootprefix=${withval%/}
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 1/2] configure.ac: strip off trailing slashed from $rootprefix

2015-05-30 Thread Christian Seiler
On 05/30/2015 12:42 PM, Daniel Mack wrote:
 On 05/30/2015 12:31 PM, Christian Seiler wrote:
 Speaking of: using 'echo' for shell scripting is problematic, because
 while bash, busybox's sh, mksh, pdksh and zsh don't interpret escape
 sequences (\n, \0oo, ...) by default when using echo and invoked as
 /bin/sh, dash and ash do. (Note that e.g. dash ist default on Debian,
 so it's not like this is something theoretical.) Also, when invoked as
 their proper name (not as /bin/sh), only bash and busybox's shell do
 not interpret escape sequences by default with echo. (In short: it's a
 mess.)
 
 It's a mess indeed. Now we only need a POSIX compliant way to strip
 _all_ trailing dashes from a string, then we can get rid of that one
 occurrence of 'sed' in configure.ac :)

Define once:

# (local variables in functions are a bashism, don't use them, but
# name global variable in such a way that it won't clash with
# anything else)
strip_trailing_slashes()
{
_strip_trailing_slashes_value=$1
while [[ ${_strip_trailing_slashes_value} != 
${_strip_trailing_slashes_value%/} ]] ; do

_strip_trailing_slashes_value=${_strip_trailing_slashes_value%/}
done
printf '%s\n' ${_strip_trailing_slashes_value}
}

Later:

VAR=$(strip_trailing_slashes $VAR)

(Or, alternatively, repeat the loop each time, you're using M4
anyway, so you could AC_DEFUN the whole thing.)

It's up to you to decide what you find more appealing.

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


Re: [systemd-devel] [PATCH v3] systemctl: drop hardcoded chkconfig invocation

2015-05-30 Thread Michael Biebl
2015-05-28 15:02 GMT+02:00 Martin Pitt martin.p...@ubuntu.com:
 Lennart Poettering [2015-05-28 13:05 +0200]:
 Nah, please remove this part. We should not ship that upstream. THis
 is something that Fedora's initscripts.rpm should provide eventually,
 and should be neither shipped with systemd upstream nor systemd.rpm in
 Fedora.

 OK, done. I changed it to be an example .SKELETON script in the
 source/tarball now, but it's not installed. (Makes it easier for
 packagers to adjust).

 Also added README/NEWS now.

Nice work, I like how this turned out.


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 1/2] configure.ac: strip off trailing slashed from $rootprefix

2015-05-30 Thread Christian Seiler
On 05/30/2015 10:28 AM, Daniel Mack wrote:
 On 05/30/2015 08:50 AM, Mike Gilbert wrote:
 On Fri, May 29, 2015 at 8:05 PM, Daniel Mack dan...@zonque.org wrote:
 Make sure the variable set via --with-rootprefix= does not contain a
 trailing slash, so man pages can use entities like rootprefix;/lib
 without ending up having double slashes.
 ---
  configure.ac | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

 diff --git a/configure.ac b/configure.ac
 index 92654a6..55b73de 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -1396,7 +1396,8 @@ AC_ARG_WITH([zshcompletiondir],

  AC_ARG_WITH([rootprefix],
  AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix 
 for config files and kernel modules]),
 -[], [with_rootprefix=${ac_default_prefix}])
 +[with_rootprefix=`echo ${withval} | sed -e s,/*$,,`],
 +[with_rootprefix=${ac_default_prefix}])

 Why do you pipe it through sed when a simple shell parameter expansion would 
 do?

 with_rootprefix=${withval%/}
 
 Isn't that's a bash'ism which we try to avoid at other places? FWIW, we
 use sed to strip off trailing dashes from $host for EFI_ARCH. Also, that
 one only replaces one trailing slash, not all of them.

No, it's not a bashism, it's indeed POSIX. See:
http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02

For example:

V=aXbXc
printf '%s\n' ${V#*X}
printf '%s\n' ${V##*X}
printf '%s\n' ${V%X*}
printf '%s\n' ${V%%X*}

When using either one of bash, dash, ash, busybox's shell, mksh, pdksh
and zsh as /bin/sh, it all produces the same output:

bXc
c
aXb
a

The following are bashisms, however:

 - ${variable/pattern/subst}
 - ${!variable_variable}

Speaking of: using 'echo' for shell scripting is problematic, because
while bash, busybox's sh, mksh, pdksh and zsh don't interpret escape
sequences (\n, \0oo, ...) by default when using echo and invoked as
/bin/sh, dash and ash do. (Note that e.g. dash ist default on Debian,
so it's not like this is something theoretical.) Also, when invoked as
their proper name (not as /bin/sh), only bash and busybox's shell do
not interpret escape sequences by default with echo. (In short: it's a
mess.)

POSIX itself is ambivalent:

http://pubs.opengroup.org/onlinepubs/009695399/utilities/echo.html
| or if any of the operands contain a backslash ( '\' ) character, the
| results are implementation-defined.

But it does recommend the behavior that ash and dash currently show
and NOT bash's behavior:

| The following character sequences shall be recognized on
| XSI-conformant systems within any of the arguments:
| [ list of escape sequences ]

The only portable way (not only to other UNIX systems, but also to
Linux systems with other shells) of printing things without
interpreting escape sequences is to use printf:

printf '%s\n' $variable

This is the same as ALL POSIX-compliant shells.

See also:
http://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo

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


[systemd-devel] Questions about socket activated services

2015-05-30 Thread cee1
Hi all,

Which service type should a socket activated service be?
1. For systemd-udevd.service and systemd-journald.service, they are notify type
2. For dbus.service, it is simple type

Does socket activation handles the timeout case?
E.g. A.service connects to B.socket, but B.service spends a long time
to be ready, may cause A.service receives ETIMEDOUT?

When the service is activated, systemd will still listen to the socket
but do nothing for incoming data, right?

BTW, netstat -lp shows only systemd is listening to a socket, but not
show the one who also is listening to the socket, e.g.

unix  2  [ ACC ] SEQPACKET  LISTENING 326  1/systemd
 /run/udev/control

Curious why?



-- 
Regards,

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


[systemd-devel] What does udevd do

2015-05-30 Thread cee1
Hi all,

If a service wants to be notified when a device is plugged in, it
invokes routines of libudev which actually:
* Receive notifications from the kernel via NETLINK socket.
* Query the detailed info from /sys/...

Am I right?

Then udevd is only responsible for
1) Making nodes, and doing other device initialization stuffs.
2) Notifying systemd, let systemd start related daemons.

Is it right?



-- 
Regards,

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


Re: [systemd-devel] nspawn: No Return key in machinectl login?

2015-05-30 Thread Tobias Hunger
Lennart,

this apparently is a problem with machinectl login: If I just use

nsenter --target PID --mount --uts --ipc --net

as root the return key works fine.

TERM=xterm with nsenter (no surprise considering that I run that from
a xterm;-), while it is vt220 in machinectl.

Any ideas?

Best Regards,
Tobias


On Tue, May 26, 2015 at 9:40 PM, Tobias Hunger tobias.hun...@gmail.com wrote:
 This is stty -a from outside the container:

 speed 38400 baud; rows 46; columns 114; line = 0;
 intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?;
 eol2 = M-^?; swtch = undef; start = ^Q;
 stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
 min = 1; time = 0;
 -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
 -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl
 -ixon -ixoff -iuclc ixany imaxbel -iutf8
 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 
 ff0
 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop
 -echoprt echoctl echoke

 This is stty -a inside the nspawn-container:

 speed 38400 baud; rows 46; columns 114; line = 0;
 intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = undef;
 eol2 = undef; swtch = undef; start = ^Q;
 stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
 min = 1; time = 0;
 -parenb -parodd -cmspar cs8 hupcl -cstopb cread -clocal -crtscts
 -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
 -ixon -ixoff -iuclc -ixany -imaxbel iutf8
 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 
 ff0
 isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop
 -echoprt -echoctl echoke

 The difference is:
 eol, eol2, -icrnl -ixany -imaxbel iutf8 -iexten -echoctl

 stty -F /dev/ptmx is identical inside and outside of the container --
 but I am not sure whether that is what you were asking in the second
 part of your reply.

 I tried running stty eol ^D -F /dev/pts/0 inside the container and
 got a SIGSEGV. It works outside the container.

 Best Regards,
 Tobias


 On Tue, May 26, 2015 at 4:11 PM, Lennart Poettering
 lenn...@poettering.net wrote:
 On Sat, 23.05.15 00:09, Tobias Hunger (tobias.hun...@gmail.com) wrote:

 Hello,

 I am having a problem with one of my containers set up with
 systemd-nspawn. For some reason the return key will not work most of
 the time (19 out of 20 attemps) after doing machinectl login into that
 machine.

 This effects not all programs: bash works, fish-shell does not. Sudo
 password entry does not work either. Git is broken (but hardly ever
 requires user input, so that is not that tragic;-), vi works fine.

 I only have this one one container image, even though it is built
 based on an image that is also used by container images that work
 fine. So I think the image should have all the important bits and
 pieces in place.

 I am kind of lost that close to the termcap:-) Does somebody have any
 ideas on how I can debug this?

 What does stty -a say?

 Consider comparing stty on the pty master (host side) as well as the
 pty itself (container size) in the cases where this works, and where
 it does not.

 Lennart

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