[systemd-devel] [PATCH] sys-kernel-debug.mount: mount with mode 755

2013-10-04 Thread Ramkumar Ramachandra
Kernel hackers need access to the debugfs filesystem. For instance, see
the performance subsystem (tools/perf in the kernel tree); we should let
all users, not just root, run the perf tool to collect performance
information about their programs by default.

Cc: Lennart Poettering lenn...@poettering.net
Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 units/sys-kernel-debug.mount | 1 +
 1 file changed, 1 insertion(+)

diff --git a/units/sys-kernel-debug.mount b/units/sys-kernel-debug.mount
index 5369728..f90bfc1 100644
--- a/units/sys-kernel-debug.mount
+++ b/units/sys-kernel-debug.mount
@@ -17,3 +17,4 @@ Before=sysinit.target
 What=debugfs
 Where=/sys/kernel/debug
 Type=debugfs
+Options=mode=755
-- 
1.8.4.477.g5d89aa9

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


Re: [systemd-devel] [PATCH 2/2] vconsole-setup: setup negative conditional on uml

2013-07-22 Thread Ramkumar Ramachandra
Lennart Poettering wrote:
 So please, ask the UML guys to somehow cleanup their VT mess. It's their
 broken code, and their job to fix it.

The question is how?  Just tell me what to do, and I'll do it myself.

 I can understand if you are disappointed by this, but please try to see
 it from out side: we want clean, supportable code, and we want code that
 works correctly. Because, even if we added a work-around to systemd: the
 next thing would break soon if you try to run it on UML. Better fix UML
 than add work-around to all those projects individually.

I'm not disappointed, and there's no need to apologize: I certainly
don't want undesirable code going into systemd either.  I've already
spoken with Al Viro about this, and he has no comments on systemd's
behavior [1].  Is there some alternative that I should discuss?

[1]: http://article.gmane.org/gmane.linux.kernel/1525933
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 2/2] vconsole-setup: setup negative conditional on uml

2013-07-22 Thread Ramkumar Ramachandra
Ramkumar Ramachandra wrote:
 Got it.  So, it should have provided /dev/tum* (or something) instead
 of /dev/tty*.  But what can we do about it now?  I certainly cannot
 remove /dev/tty* and murder the users.

Wait, I think I have an idea to preserve backward compatibility.  I'll
remove the /dev/tty* devices and replace them with /dev/hvc* devices,
and deprecate the con=tty command-line option to actually connect to
/dev/hvc*.

*goes off to write patches*
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 2/2] vconsole-setup: setup negative conditional on uml

2013-07-21 Thread Ramkumar Ramachandra
Kay Sievers wrote:
 No, sorry, the same rule applies to C code as it does to unit files:
 We do not collect specific exceptions for broken hacks in exotic
 tools. Means: there will be _zero_ matches on UML strings in systemd

Um, then why do we have a detect-virt at all?  A quick grep tells me
that we do have specific workaround for specific containers and vms.

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


Re: [systemd-devel] [PATCH 2/2] vconsole-setup: setup negative conditional on uml

2013-07-21 Thread Ramkumar Ramachandra
Kay Sievers wrote:
 Where do you see any specific exceptions for broken hacks?

 We surely support different forms of virtualizations, and support
 reasonable custom behavior. But we do not support providing a tty0 and
 have no working VT. It's just madness we don't want to see anywhere,
 and we which we don't want to collect quirks for.

So it has to do with classifying uml's behavior as broken;
therefore, you want systemd to support only the general case of
broken-ness, and not the specific case of uml.

Fine.  Enough talk.  Are you happy with these? (rough, untested)

diff --git a/src/getty-generator/getty-generator.c
b/src/getty-generator/getty-generator.c
index 9c7ed1a..d9881d5 100644
--- a/src/getty-generator/getty-generator.c
+++ b/src/getty-generator/getty-generator.c
@@ -97,6 +97,7 @@ int main(int argc, char *argv[]) {
 char *active;
 const char *j;
 const char *id = NULL;
+int fd = -1;

 if (argc  1  argc != 4) {
 log_error(This program takes three or no arguments.);
@@ -112,7 +113,8 @@ int main(int argc, char *argv[]) {

 umask(0022);

-if (detect_container(NULL)  0 || (detect_vm(id)  0 
!strcmp(id, uml))) {
+fd = open_terminal(/dev/tty0, O_RDWR|O_CLOEXEC);
+if (detect_container(NULL)  0 || !is_vconsole(fd)) {
 log_debug(Automatically adding console shell.);

 if (add_symlink(console-getty.service,
console-getty.service)  0)


diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index bffc632..77d73fb 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -246,9 +246,8 @@ int main(int argc, char **argv) {
 }

 if (!is_vconsole(fd)) {
-/* uml does not do VT102 emulation */
-if (detect_vm(id)  0  !strcmp(id, uml))
-r = EXIT_SUCCESS;
+/* don't fail the service on broken ttys */
+r = EXIT_SUCCESS;

 log_error(Device %s is not a virtual console., vc);
 goto finish;
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 2/2] vconsole-setup: setup negative conditional on uml

2013-07-21 Thread Ramkumar Ramachandra
Kay Sievers wrote:
 You meant to provide a patch against git, not your earlier patches?

Ofcourse; I was just asking if this is what you meant before
submitting another iteration for inclusion.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 2/2] vconsole-setup: setup negative conditional on uml

2013-07-21 Thread Ramkumar Ramachandra
Kay Sievers wrote:
 [...]

Fwiw, I more-or-less agree with the principle don't accumulate
specific workarounds when it's not scalable or maintainable.

 Hacks like the UML tty0 hack is just a too broken idea, to
 get any support or an exception in a generic tool like systemd.

I think of it as less of a hack, and more of a deficiency.  Nobody
stayed up all night drinking coffee to write that VT emulation: that's
why it's not there :)
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 2/2] vconsole-setup: setup negative conditional on uml

2013-07-20 Thread Ramkumar Ramachandra
Kay Sievers wrote:
 I would rather see vconsole to detect the mess and silently give up,
 instead of adding exotic options for really weird faked and wrong tty0
 setups.

um Linux lacks VT102 emulation, and this is a documented fact.
Therefore, your code:

unsigned char data[1];

data[0] = TIOCL_GETFGCONSOLE;
return ioctl(fd, TIOCLINUX, data) = 0;

is guaranteed to fail.  Not because something went wrong, or due to
some mess or fakeness, but because it was perfectly expected.  I
discussed this on LKML, and posted an explanation about this already
[1].

That said, I don't know what to do about
systemd-vconsole-setup.service: I just followed Zbyszek's suggestion.
Penalizing um Linux for not doing VT102 emulation, and always failing
a service seems user-unfriendly to me.

[1]: http://lists.freedesktop.org/archives/systemd-devel/2013-July/012150.html
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 2/2] vconsole-setup: setup negative conditional on uml

2013-07-20 Thread Ramkumar Ramachandra
Kay Sievers wrote:
 It's not about failing it, that would be ugly, sure. Vconsole can just
 give up and return 0 if it finds a tt0 that actually isn't a tty0.

Hm, how can I tell if vconsole-setup actually did something or not
then?  Doesn't it matter for curses apps, which require VT102
emulation to interpret escape sequences correctly?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 2/2] vconsole-setup: setup negative conditional on uml

2013-07-20 Thread Ramkumar Ramachandra
Kay Sievers wrote:
 Oh, I meant turning is_vconsole() into returning success when it is
 called for a tty0 that in fact doesn't work like tty0. :)

We might as well remove is_vconsole() then.  Does it make sense to
execute the rest of the code in vconsole-setup.c (fontmap, utf8 etc.)
on a non-VT device?  Should I, as the end-user, see that
systemd-vconsole-setup.service passed even if my devices are non-VT?

 That would make all the weird (I expect there are more things like
 that) tty0 setups just skip the service without additional explicit
 conditions in the unit file.

I'm not sure I understand this rationale: when a device is broken in
an unexpected way, we _should_ complain and tell the end-user.  um
Linux is a documented exception that we're making room for.  I don't
know of any other setups that have tty devices but don't implement VT
emulation; do you?

If you're so particular about keeping primary unit files clean, may
I suggest moving the exception code to vconsole-setup.c?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] console-getty.service: conflict with vconsole-setup

2013-07-20 Thread Ramkumar Ramachandra
Kay Sievers wrote:
 such work-arounds need to
 be a generic as possible

I disagree with this.  I specifically asked Lennart about a /dev/tty0
being created by hand using mknod earlier: his answer was that systemd
does not support it.  In the most generic scenario, you cannot rely on
the sanity of _any_ device, and will have to go about hand-checking
the capabilities of everything explicitly.  This will add complexity
and slow down the bootup for no good reason.  As a rule of thumb:
don't over-generalize for no good reason.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 2/2] vconsole-setup: setup negative conditional on uml

2013-07-20 Thread Ramkumar Ramachandra
Kay Sievers wrote:
 If you're so particular about keeping primary unit files clean, may
 I suggest moving the exception code to vconsole-setup.c?

 That's what I meant, yeah, sorry for the confusion.

Cool, I understand that your desire to keep primary units clean: I'll
write a patch for this.

In the meantime, could you merge [1/2] assuming it's fine?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] vconsole-setup: pass when uml is detected

2013-07-20 Thread Ramkumar Ramachandra
User-Mode Linux does not do VT102 emulation, and

  $ systemd-vconsole-setup /dev/tty0

will always fail on it.  In order to prevent vconsole-setup.service from
always failing, write an exception for it in vconsole-setup.c.  Now,
vconsole-setup.service will pass on um Linux, and the logs will indicate
that /dev/tty0 is not a virtual console.

Cc: Kay Sievers k...@vrfy.org
Cc: Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl
Cc: Lennart Poettering lenn...@poettering.net
Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 I didn't cut corners: I built it with abs, and tested it properly :)

 Kay: You like this?

 src/vconsole/vconsole-setup.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index 1bbf737..bffc632 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -224,6 +224,7 @@ int main(int argc, char **argv) {
 pid_t font_pid = 0, keymap_pid = 0;
 bool font_copy = false;
 int r = EXIT_FAILURE;
+const char *id = NULL;
 
 log_set_target(LOG_TARGET_AUTO);
 log_parse_environment();
@@ -245,6 +246,10 @@ int main(int argc, char **argv) {
 }
 
 if (!is_vconsole(fd)) {
+/* uml does not do VT102 emulation */
+if (detect_vm(id)  0  !strcmp(id, uml))
+r = EXIT_SUCCESS;
+
 log_error(Device %s is not a virtual console., vc);
 goto finish;
 }
-- 
1.8.3.3.820.ge3d4493.dirty

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


[systemd-devel] [QUERY] getty and terminfo

2013-07-20 Thread Ramkumar Ramachandra
Hi,

I noticed that my TERM is set to linux, even when I boot the
console-getty.service.  Isn't it supposed to be console instead,
since VT emulation is not guaranteed?  Should we explicitly pass the
term argument to agetty?

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


Re: [systemd-devel] [PATCH] console-getty.service: conflict with vconsole-setup

2013-07-19 Thread Ramkumar Ramachandra
Lennart Poettering wrote:
 /dev/tty0 always points to the foreground VC tty. Are you saying UML
 provides /dev/tty0 but not /dev/tty1, /dev/tty2, ...? I am pretty sure
 that UML should be fixed to provide neither or both, evertyhing else is
 broken.

Thanks for all the information.  With some help from Al, I finally
figured out what's happening:

0. um Linux does not do VT102 emulation.  This is a known limitation.

1. In its default configuration, it connects the guest's /dev/console
to the host's fd:0,fd:1.

2. In its default configuration (I just sent a patch changing this),
it connects the guest's /dev/tty[1-16] to a /dev/pts/N on the the host
(allocated dynamically).  Then, to get a prompt on the guest, the user
can do `screen /dev/pts/N` or `minicom /dev/pts/N` on the host.

3. It provides con#= and ssl#= kernel parameters to override how all
the console and serial devices on the guest should be connected to the
host.

So, I can provide a patch for getty-generator to detect um Linux and
switch to getty on /dev/console, but vconsole-setup will still fail;
what should we do about that?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 2/2] vconsole-setup: setup negative conditional on uml

2013-07-19 Thread Ramkumar Ramachandra
User-Mode Linux does not do VT102 emulation, and

  $ vconsole-setup /dev/tty0

will always fail on it.  In order to prevent vconsole-setup.service from
always failing, disable it when uml is detected.

Cc: Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl
Cc: Lennart Poettering lenn...@poettering.net
Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 units/systemd-vconsole-setup.service.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/units/systemd-vconsole-setup.service.in 
b/units/systemd-vconsole-setup.service.in
index 18faa63..3dc3153 100644
--- a/units/systemd-vconsole-setup.service.in
+++ b/units/systemd-vconsole-setup.service.in
@@ -13,6 +13,7 @@ Conflicts=shutdown.target
 After=systemd-readahead-collect.service systemd-readahead-replay.service
 Before=sysinit.target shutdown.target
 ConditionPathExists=/dev/tty0
+ConditionVirtualization=!uml
 
 [Service]
 Type=oneshot
-- 
1.8.3.3.797.gb72c616.dirty

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


[systemd-devel] [PATCH 0/2] Finishing touches for User-Mode Linux

2013-07-19 Thread Ramkumar Ramachandra
Hi,

These are the finishing touches required to make User-Mode Linux work
out-of-the-box.  Sorry it took so long: I had to build with abs and
test it for good.

Thanks again, for all the help.

Ramkumar Ramachandra (2):
  getty-generator: run console shell for uml
  vconsole-setup: setup negative conditional on uml

 src/getty-generator/getty-generator.c   | 3 ++-
 units/systemd-vconsole-setup.service.in | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

-- 
1.8.3.3.797.gb72c616.dirty

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


[systemd-devel] [PATCH 1/2] getty-generator: run console shell for uml

2013-07-19 Thread Ramkumar Ramachandra
In its default configuration, um Linux connects its /dev/console to the
host's fd:0,fd:1.  Other tty devices (/dev/tty*) are accessible on
various host devices that the user must connect to explicitly.  By
running getty on /dev/console by default,

  $ ./linux ubd0=arch-rootfs

will display a prompt immediately on the same terminal, along with the
boot messages.  This is much more user-friendly, than making the user
explicitly connect to the right device using

  $ screen /dev/pts/8

to get a login prompt.

Cc: Thomas Bächler tho...@archlinux.org
Cc: Lennart Poettering lenn...@poettering.net
Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 src/getty-generator/getty-generator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/getty-generator/getty-generator.c 
b/src/getty-generator/getty-generator.c
index 4b7a60a..9c7ed1a 100644
--- a/src/getty-generator/getty-generator.c
+++ b/src/getty-generator/getty-generator.c
@@ -96,6 +96,7 @@ int main(int argc, char *argv[]) {
 int r = EXIT_SUCCESS;
 char *active;
 const char *j;
+const char *id = NULL;
 
 if (argc  1  argc != 4) {
 log_error(This program takes three or no arguments.);
@@ -111,7 +112,7 @@ int main(int argc, char *argv[]) {
 
 umask(0022);
 
-if (detect_container(NULL)  0) {
+if (detect_container(NULL)  0 || (detect_vm(id)  0  !strcmp(id, 
uml))) {
 log_debug(Automatically adding console shell.);
 
 if (add_symlink(console-getty.service, 
console-getty.service)  0)
-- 
1.8.3.3.797.gb72c616.dirty

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


[systemd-devel] [PATCH v2] detect-virt: detect User-Mode Linux

2013-07-16 Thread Ramkumar Ramachandra
In a User-Mode Linux session:

  $ systemd-detect-virt
  none

Although it is possible to reliably detect virtualization:

  $ cat /proc/cpuinfo
  processor   : 0
  vendor_id   : User Mode Linux
  model name  : UML
  mode: skas
  host: Linux kytes 3.11.0-rc1-9-ge5fd680 (...)
  bogomips: 7007.43

So, grep for the string vendor_id\t: User Mode Linux\n in
/proc/cpuinfo, and say uml when asked.

Cc: Lennart Poettering lenn...@poettering.net
Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 See arch/um/kernel/um_arch.c:75, where it writes the hard-coded
 string vendor_id\t: User Mode Linux\n.  No variable-width padding,
 so it should be safe to grep for this exact string.

 Also tweaked documentation.

 man/systemd-detect-virt.xml |  1 +
 src/shared/virt.c   | 11 +++
 2 files changed, 12 insertions(+)

diff --git a/man/systemd-detect-virt.xml b/man/systemd-detect-virt.xml
index 762b6ab..f21493df 100644
--- a/man/systemd-detect-virt.xml
+++ b/man/systemd-detect-virt.xml
@@ -70,6 +70,7 @@
 varnamemicrosoft/varname,
 varnameoracle/varname, varnamexen/varname,
 varnamebochs/varname, varnamechroot/varname,
+varnameuml/varname,
 varnameopenvz/varname, varnamelxc/varname,
 varnamelxc-libvirt/varname,
 varnamesystemd-nspawn/varname./para
diff --git a/src/shared/virt.c b/src/shared/virt.c
index 1c86a3d..6114b6c 100644
--- a/src/shared/virt.c
+++ b/src/shared/virt.c
@@ -67,6 +67,7 @@ int detect_vm(const char **id) {
 const char *j, *k;
 bool hypervisor;
 _cleanup_free_ char *hvtype = NULL;
+_cleanup_free_ char *cpuinfo_contents = NULL;
 int r;
 
 /* Try high-level hypervisor sysfs file first:
@@ -164,6 +165,16 @@ int detect_vm(const char **id) {
 }
 
 #endif
+
+/* Detect User-Mode Linux by reading /proc/cpuinfo */
+r = read_full_file(/proc/cpuinfo, cpuinfo_contents, NULL);
+if (r  0)
+return r;
+if (strstr(cpuinfo_contents, vendor_id\t: User Mode Linux\n)) {
+*id = uml;
+return 1;
+}
+
 return 0;
 }
 
-- 
1.8.3.2.736.g869de25

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


Re: [systemd-devel] [PATCH] detect-virt: detect User-Mode Linux

2013-07-16 Thread Ramkumar Ramachandra
Ramkumar Ramachandra wrote:
  It seems that UM does not have a proper tty system; I force
  systemd to use the /dev/console by doing:

  $ mv 
 /etc/systemd/system/getty.target.wants/{getty@tty1.service,getty@console.service}

Where should the exception for um linux go?  When does the code in
getty-generator get executed exactly (installation?).  The same rootfs
can be used in a chroot, or with a vm, so I think the override should
be done at runtime.  There's already an exception for containers: when
detect_container(), install console-getty.service.  Should we add one
for detect_virtualization() when id = uml?

Also, um linux does not seem to respect the console=tty0 kernel
parameter (or I'm missing something).
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH v4] Skip tests that depend on /etc/machine-id if it is not present

2012-12-02 Thread Ramkumar Ramachandra
David Strauss wrote:
 Would it be possible, for testing purposes, to generate a machine ID
 on the fly if one is not present on disk?

Hard, as /etc/machine-id is hardcoded in
src/libsystemd-id128/sd-id128.c.  I don't think it's worth the effort.

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


Re: [systemd-devel] [PATCH v4] Skip tests that depend on /etc/machine-id if it is not present

2012-12-02 Thread Ramkumar Ramachandra
Zbigniew Jędrzejewski-Szmek wrote:
 I started munging your patch to apply it, but on second thought it is
 totally the wrong direction to take. The purpose of tests is to check
 if systemd will function after installation. And as mentioned
 elsewhere in the thread, journald will break badly, and thus systemd
 will not function as expected. So it is much better to have the tests
 fail as they do now, then to paper over a missing file. So I think that
 the patch should
 (a) skip _some_ of the tests to reduce noise,
 (b) fail at least one test to tell the user that /etc/machine-id is missing.

Hm, you have a point.  On Debian, /etc/machine-id is created when
the systemd package is installed -- I'm not sure if it's in the source
code or if it's a custom Debian patch.  Either way, there should be
one test checking the pre-existence of files (like /etc/mtab), to
assert whether the OS is systemd-ready -- and this test should fail.

 I would be nice to
 (c) using automake skip (below) to do that,

This is a hack.  Ideally, I'd like real testsuite (not a bunch of
asserts thrown around randomly) with a way to execute tests based on
pre-requisites, like the one in git.git.  I'll try to write one for
systemd in the evening, and see how that goes.

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


Re: [systemd-devel] [PATCH v4] Skip tests that depend on /etc/machine-id if it is not present

2012-12-02 Thread Ramkumar Ramachandra
Hi Michael,

Michael Biebl wrote:
 2012/12/2 Ramkumar Ramachandra artag...@gmail.com:
 Hm, you have a point.  On Debian, /etc/machine-id is created when
 the systemd package is installed -- I'm not sure if it's in the source
 code or if it's a custom Debian patch.

 We run systemd-machine-id-setup in postinst.

Ah, that explains it.  Again, why should any of the tests packaged
with systemd fail if the distribution does this?

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


Re: [systemd-devel] [PATCH] *.py: don't hardcode /usr/bin/python

2012-12-02 Thread Ramkumar Ramachandra
David Strauss wrote:
 We could also move more tools outside the main systemd package and
 into PIP.

Er, you want to move some essential systemd scripts out from the source tree?

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


Re: [systemd-devel] [PATCH] *.py: don't hardcode /usr/bin/python

2012-12-01 Thread Ramkumar Ramachandra
Michael Biebl wrote:
 2012/11/30 Ramkumar Ramachandra artag...@gmail.com:
 Execute python using /usr/bin/env python instead of hard-coding the

 I'm not really a fan of using /usr/bin/env, as you can pick up a
 random python version depending on how your PATH is setup.
 Besides, you need to spawn an additional binary.
 I would assume that pretty much every distro ships the python
 interpreter as /usr/bin/python.

I don't follow your reasoning: it is idiomatic to use /usr/bin/env
$interpreter, because every distro does not necessarily ship it as
/usr/bin/$interpreter.  As far as the version of Python is concerned,
this patch makes no changes with regard to that- /usr/bin/python and
/usr/bin/env python might be equally bad versions of Python -- as
Colin pointed out, the correct way to resolve it is at configure-time.

FWIW, the git project uses /usr/bin/env $interpreter in scripts as well:

$ git grep /usr/bin/env
contrib/ciabot/ciabot.py:#!/usr/bin/env python
contrib/fast-import/import-zips.py:#!/usr/bin/env python
contrib/gitview/gitview:#! /usr/bin/env python
contrib/hg-to-git/hg-to-git.py:#!/usr/bin/env python
contrib/p4import/git-p4import.py:#!/usr/bin/env python
contrib/remote-helpers/git-remote-hg:#!/usr/bin/env python
git-instaweb.sh:#!/usr/bin/env ruby
git-p4.py:#!/usr/bin/env python
git-remote-testgit.py:#!/usr/bin/env python
git_remote_helpers/__init__.py:#!/usr/bin/env python
git_remote_helpers/git/git.py:#!/usr/bin/env python
git_remote_helpers/setup.py:#!/usr/bin/env python
git_remote_helpers/util.py:#!/usr/bin/env python
t/Git-SVN/00compile.t:#!/usr/bin/env perl
t/Git-SVN/Utils/add_path_to_url.t:#!/usr/bin/env perl
t/Git-SVN/Utils/canonicalize_url.t:#!/usr/bin/env perl
t/Git-SVN/Utils/collapse_dotdot.t:#!/usr/bin/env perl
t/Git-SVN/Utils/join_paths.t:#!/usr/bin/env perl

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


Re: [systemd-devel] [PATCH v3] Skip tests that depend on /etc/machine-id if it is not present

2012-12-01 Thread Ramkumar Ramachandra
David Strauss wrote:
 Please fix the spelling of present.
 The number -128, if used, should get #define'd instead of being a magic
 number dropped in a bunch of places.

Thanks.  Will fix in the next iteration.

 It's not good to mask all errors opening the machine-id with the -128
 response code. The change here seems to make all opening errors return -128.

Hm, perhaps I shouldn't handle wrong permissions as a special case and
fail the tests in that case. I'll specifically mask only an ENOENT in
the next iteration.

 More importantly, what's wrong with looking for the normal [Errno 2] No
 such file or directory return code?

There would be no way to differentiate between a ENOENT from this and
an ENOENT from callers then -- clearly, I'm not treating this as a
normal ENOENT error; I'd want a way to trap this specific error from
any caller, and handle it carefully.

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


[systemd-devel] Systemd doesn't remove itself cleanly

2012-12-01 Thread Ramkumar Ramachandra
Hi,

I booted up my Debian machine with systemd, and removed systemd after
bootup.  Now it refuses to halt with:

  init: timeout opening/writing control channel /dev/initctl

I don't know if it's systemd's fault or the Debian package manager's
fault- investigating.

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


Re: [systemd-devel] Systemd doesn't remove itself cleanly

2012-12-01 Thread Ramkumar Ramachandra
Ramkumar Ramachandra wrote:
 I booted up my Debian machine with systemd, and removed systemd after
 bootup.  Now it refuses to halt with:

   init: timeout opening/writing control channel /dev/initctl

Correction: I can't halt a Debian systemd machine at all (even when
the package isn't removed)!
It seems to be documented here though:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=657990

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


[systemd-devel] [PATCH v4] Skip tests that depend on /etc/machine-id if it is not present

2012-12-01 Thread Ramkumar Ramachandra
The following tests fail if /etc/machine-id is not present:

  $ ./test-id128
  random: a08ea8ed34594d4bbd953dd182ec86f9
  Assertion 'sd_id128_get_machine(id) == 0' failed at
  src/test/test-id128.c:41, function main(). Aborting.
  [1]8017 abort (core dumped)  ./test-id128

  $ ./test-journal
  Assertion 'journal_file_open(test.journal, O_RDWR|O_CREAT, 0666,
  true, true, NULL, NULL, NULL, f) == 0' failed at
  src/journal/test-journal.c:46, function main(). Aborting.
  [1]8059 abort (core dumped)  ./test-journal

  $ ./test-journal-stream
  Assertion 'journal_file_open(one.journal, O_RDWR|O_CREAT, 0666,
  true, false, NULL, NULL, NULL, one) == 0' failed at
  src/journal/test-journal-stream.c:88, function main(). Aborting.
  [1]8107 abort (core dumped)  ./test-journal-stream

  $ ./test-journal-verify
  Generating...
  Assertion 'journal_file_open(test.journal, O_RDWR|O_CREAT, 0666,
  true, !!verification_key, NULL, NULL, NULL, f) == 0' failed at
  src/journal/test-journal-verify.c:87, function main(). Aborting.
  [1]8154 abort (core dumped)  ./test-journal-verify

This is because they call sd_id128_get_machine() which barfs if
/etc/machine-id can't be open()'ed.  Treat ENOENT as a special case
and skip the dependent tests instead of failing them.
---
 src/journal/test-journal-stream.c |6 ++
 src/journal/test-journal-verify.c |6 ++
 src/journal/test-journal.c|6 ++
 src/libsystemd-id128/sd-id128.c   |3 ++-
 src/systemd/sd-id128.h|2 ++
 src/test/test-id128.c |8 ++--
 6 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/src/journal/test-journal-stream.c 
b/src/journal/test-journal-stream.c
index b3e816d..05eedfd 100644
--- a/src/journal/test-journal-stream.c
+++ b/src/journal/test-journal-stream.c
@@ -79,6 +79,12 @@ int main(int argc, char *argv[]) {
 char *z;
 const void *data;
 size_t l;
+sd_id128_t id;
+
+if (sd_id128_get_machine(id) == MACHINE_ID_MISSING) {
+printf(skipping test: /etc/machine-id not present\n);
+return 0;
+}
 
 log_set_max_level(LOG_DEBUG);
 
diff --git a/src/journal/test-journal-verify.c 
b/src/journal/test-journal-verify.c
index b667721..c35a96b 100644
--- a/src/journal/test-journal-verify.c
+++ b/src/journal/test-journal-verify.c
@@ -76,6 +76,12 @@ int main(int argc, char *argv[]) {
 char c[FORMAT_TIMESPAN_MAX];
 struct stat st;
 uint64_t p;
+sd_id128_t id;
+
+if (sd_id128_get_machine(id) == MACHINE_ID_MISSING) {
+printf(skipping test: /etc/machine-id not present\n);
+return 0;
+}
 
 log_set_max_level(LOG_DEBUG);
 
diff --git a/src/journal/test-journal.c b/src/journal/test-journal.c
index f4dc52c..27b1cc3 100644
--- a/src/journal/test-journal.c
+++ b/src/journal/test-journal.c
@@ -37,6 +37,12 @@ int main(int argc, char *argv[]) {
 Object *o;
 uint64_t p;
 char t[] = /tmp/journal-XX;
+sd_id128_t id;
+
+if (sd_id128_get_machine(id) == MACHINE_ID_MISSING) {
+printf(skipping test: /etc/machine-id not present\n);
+return 0;
+}
 
 log_set_max_level(LOG_DEBUG);
 
diff --git a/src/libsystemd-id128/sd-id128.c b/src/libsystemd-id128/sd-id128.c
index 4286ae7..6f92cf1 100644
--- a/src/libsystemd-id128/sd-id128.c
+++ b/src/libsystemd-id128/sd-id128.c
@@ -106,7 +106,8 @@ _public_ int sd_id128_get_machine(sd_id128_t *ret) {
 
 fd = open(/etc/machine-id, O_RDONLY|O_CLOEXEC|O_NOCTTY);
 if (fd  0)
-return -errno;
+/* Special return value if machine-id is missing */
+return errno == ENOENT ? MACHINE_ID_MISSING : -errno;
 
 k = loop_read(fd, buf, 32, false);
 close_nointr_nofail(fd);
diff --git a/src/systemd/sd-id128.h b/src/systemd/sd-id128.h
index 79bb8b3..f4a8914 100644
--- a/src/systemd/sd-id128.h
+++ b/src/systemd/sd-id128.h
@@ -102,6 +102,8 @@ static inline int sd_id128_equal(sd_id128_t a, sd_id128_t 
b) {
 
 #define SD_ID128_NULL ((sd_id128_t) { .qwords = { 0, 0 }})
 
+#define MACHINE_ID_MISSING -128
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/test/test-id128.c b/src/test/test-id128.c
index bfd743e..f03204d 100644
--- a/src/test/test-id128.c
+++ b/src/test/test-id128.c
@@ -38,8 +38,12 @@ int main(int argc, char *argv[]) {
 assert_se(sd_id128_from_string(t, id2) == 0);
 assert_se(sd_id128_equal(id, id2));
 
-assert_se(sd_id128_get_machine(id) == 0);
-printf(machine: %s\n, sd_id128_to_string(id, t));
+if (sd_id128_get_machine(id) == MACHINE_ID_MISSING)
+printf(skipping test: /etc/machine-id not present\n);
+else {
+assert_se(sd_id128_get_machine(id) == 0);
+printf(machine: %s\n, sd_id128_to_string(id, t));
+}
 
 assert_se(sd_id128_get_boot(id) == 

[systemd-devel] [PATCH] machine-id-setup: generate /etc/machine-id if it doesn't exist

2012-11-30 Thread Ramkumar Ramachandra
/etc/machine-id does not exist on all distributions, and DBus puts its
machine-id in /var/lib/dbus/machine-id.  One test in test-id128 fails
if the file isn't present.  Make systemd-machine-id-setup create the
file if it doesn't exist, and fix a failing test in test-id128.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 Ramkumar Ramachandra wrote:
  $ ./test-id128
  random: a08ea8ed34594d4bbd953dd182ec86f9
  Assertion 'sd_id128_get_machine(id) == 0' failed at
  src/test/test-id128.c:41, function main(). Aborting.
  [1]8017 abort (core dumped)  ./test-id128
 
 Okay, this test fails because I don't have a /etc/machine-id -- I
 thought systemd is supposed to create it?  However, from the logic in
 src/core/machine-id-setup.c, it looks like although open() is called
 with O_CREAT on /etc/machine-id, systemd barfs if the file isn't
 present.  How about changing this?

 src/core/machine-id-setup.c |   12 +---
 src/test/test-id128.c   |6 --
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/core/machine-id-setup.c b/src/core/machine-id-setup.c
index 7f4c23b..3f21d58 100644
--- a/src/core/machine-id-setup.c
+++ b/src/core/machine-id-setup.c
@@ -168,12 +168,8 @@ int machine_id_setup(void) {
 writable = true;
 else {
 fd = open(/etc/machine-id, O_RDONLY|O_CLOEXEC|O_NOCTTY);
-if (fd  0) {
-umask(m);
-log_error(Cannot open /etc/machine-id: %m);
-return -errno;
-}
-
+if (fd  0)
+goto generate;
 writable = false;
 }
 
@@ -192,7 +188,9 @@ int machine_id_setup(void) {
 }
 }
 
-/* Hmm, so, the id currently stored is not useful, then let's
+generate:
+/* Hmm, so, either /etc/machine-id doesn't exist, the id
+ * currently stored is not useful, then let's
  * generate one */
 
 r = generate(id);
diff --git a/src/test/test-id128.c b/src/test/test-id128.c
index bfd743e..60902d0 100644
--- a/src/test/test-id128.c
+++ b/src/test/test-id128.c
@@ -38,8 +38,10 @@ int main(int argc, char *argv[]) {
 assert_se(sd_id128_from_string(t, id2) == 0);
 assert_se(sd_id128_equal(id, id2));
 
-assert_se(sd_id128_get_machine(id) == 0);
-printf(machine: %s\n, sd_id128_to_string(id, t));
+if (sd_id128_get_machine(id)  0)
+printf(machine: run systemd-machine-id-setup first\n);
+else
+printf(machine: %s\n, sd_id128_to_string(id, t));
 
 assert_se(sd_id128_get_boot(id) == 0);
 printf(boot: %s\n, sd_id128_to_string(id, t));
-- 
1.7.8.1.362.g5d6df.dirty

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


Re: [systemd-devel] 4 failing tests

2012-11-30 Thread Ramkumar Ramachandra
Ramkumar Ramachandra wrote:
 $ ./test-journal
 Assertion 'journal_file_open(test.journal, O_RDWR|O_CREAT, 0666,
 true, true, NULL, NULL, NULL, f) == 0' failed at
 src/journal/test-journal.c:46, function main(). Aborting.
 [1]8059 abort (core dumped)  ./test-journal

 $ ./test-journal-stream
 Assertion 'journal_file_open(one.journal, O_RDWR|O_CREAT, 0666,
 true, false, NULL, NULL, NULL, one) == 0' failed at
 src/journal/test-journal-stream.c:88, function main(). Aborting.
 [1]8107 abort (core dumped)  ./test-journal-stream

 $ ./test-journal-verify
 Generating...
 Assertion 'journal_file_open(test.journal, O_RDWR|O_CREAT, 0666,
 true, !!verification_key, NULL, NULL, NULL, f) == 0' failed at
 src/journal/test-journal-verify.c:87, function main(). Aborting.
 [1]8154 abort (core dumped)  ./test-journal-verify

These tests fail due to the code in src/journal-file.c:167, which
again checks for /etc/machine-id.  Why do you expect this file to be
present?

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


Re: [systemd-devel] 4 failing tests

2012-11-30 Thread Ramkumar Ramachandra
Kay Sievers wrote:
 On Fri, Nov 30, 2012 at 1:28 PM, Zbigniew Jędrzejewski-Szmek
 zbys...@in.waw.pl wrote:

 It'll be created by systemd during init if not present. So we _do_ a
 kind of around.

Where is the creation code?  The systemd-machine-id-setup binary does
_not_ create it, and my patch proposes to fix that.

 I haven't looked at the details of the patch, but
 I think that it would be nice to support testing before the first run
 with systemd: the tests should support missing /etc/machine-id.

 Don't know if it matters that much. Failing the test with a proper
 error message sounds reasonable good enough to me.

How do you propose we do that?  /etc/machine-id is hardcoded in
src/libsystemd-id128/sd-id128.c:107.  Instead of returning -errno, we
can return a special error value when /etc/machine-id can't be
open()'ed, and cascade that value upwards from callers, finally
handling it in the test.

 The code should surely not get active during normal operation or any
 service startup/restart, and magically try to fix the system in a way
 we can't know what the right fix should be.

My patch only proposes that systemd-machine-id-setup creates the file;
nothing else.

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


Re: [systemd-devel] 4 failing tests

2012-11-30 Thread Ramkumar Ramachandra
Kay Sievers wrote:
 It is mandatory for systemd systems. We just require it to be around,
 and do not work around it.

Specifically, which package installs /etc/machine-id?  Is it a build
dependency for systemd?

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


[systemd-devel] [PATCH] Skip tests that depend on /etc/machine-id if it is not present

2012-11-30 Thread Ramkumar Ramachandra
The following tests fail if /etc/machine-id is not present:

  $ ./test-id128
  random: a08ea8ed34594d4bbd953dd182ec86f9
  Assertion 'sd_id128_get_machine(id) == 0' failed at
  src/test/test-id128.c:41, function main(). Aborting.
  [1]8017 abort (core dumped)  ./test-id128

  $ ./test-journal
  Assertion 'journal_file_open(test.journal, O_RDWR|O_CREAT, 0666,
  true, true, NULL, NULL, NULL, f) == 0' failed at
  src/journal/test-journal.c:46, function main(). Aborting.
  [1]8059 abort (core dumped)  ./test-journal

  $ ./test-journal-stream
  Assertion 'journal_file_open(one.journal, O_RDWR|O_CREAT, 0666,
  true, false, NULL, NULL, NULL, one) == 0' failed at
  src/journal/test-journal-stream.c:88, function main(). Aborting.
  [1]8107 abort (core dumped)  ./test-journal-stream

  $ ./test-journal-verify
  Generating...
  Assertion 'journal_file_open(test.journal, O_RDWR|O_CREAT, 0666,
  true, !!verification_key, NULL, NULL, NULL, f) == 0' failed at
  src/journal/test-journal-verify.c:87, function main(). Aborting.
  [1]8154 abort (core dumped)  ./test-journal-verify

This is because they call sd_id128_get_machine() which barfs if
/etc/machine-id can't be open()'ed.  Treat this as a special case and
skip the dependent tests instead of failing them.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 Ramkumar Ramachandra wrote:
  Kay Sievers wrote:
  On Fri, Nov 30, 2012 at 1:28 PM, Zbigniew Jędrzejewski-Szmek
  zbys...@in.waw.pl wrote:
  I haven't looked at the details of the patch, but
  I think that it would be nice to support testing before the first run
  with systemd: the tests should support missing /etc/machine-id.
 
  Don't know if it matters that much. Failing the test with a proper
  error message sounds reasonable good enough to me.
 
  How do you propose we do that?  /etc/machine-id is hardcoded in
  src/libsystemd-id128/sd-id128.c:107.  Instead of returning -errno, we
  can return a special error value when /etc/machine-id can't be
  open()'ed, and cascade that value upwards from callers, finally
  handling it in the test.

 This is a patch that does exactly that.

 src/journal/test-journal-stream.c |5 +
 src/journal/test-journal-verify.c |5 +
 src/journal/test-journal.c|5 +
 src/libsystemd-id128/sd-id128.c   |2 +-
 src/test/test-id128.c |8 ++--
 5 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/journal/test-journal-stream.c 
b/src/journal/test-journal-stream.c
index b3e816d..eaf9daa 100644
--- a/src/journal/test-journal-stream.c
+++ b/src/journal/test-journal-stream.c
@@ -85,6 +85,11 @@ int main(int argc, char *argv[]) {
 assert_se(mkdtemp(t));
 assert_se(chdir(t) = 0);
 
+if (journal_file_open(one.journal, O_RDWR|O_CREAT, 0666, true, 
false, NULL, NULL, NULL, one) == -128) {
+printf(skipping test: /etc/machine-id not preset\n);
+return 0;
+}
+
 assert_se(journal_file_open(one.journal, O_RDWR|O_CREAT, 0666, true, 
false, NULL, NULL, NULL, one) == 0);
 assert_se(journal_file_open(two.journal, O_RDWR|O_CREAT, 0666, true, 
false, NULL, NULL, NULL, two) == 0);
 assert_se(journal_file_open(three.journal, O_RDWR|O_CREAT, 0666, 
true, false, NULL, NULL, NULL, three) == 0);
diff --git a/src/journal/test-journal-verify.c 
b/src/journal/test-journal-verify.c
index b667721..00068fb 100644
--- a/src/journal/test-journal-verify.c
+++ b/src/journal/test-journal-verify.c
@@ -84,6 +84,11 @@ int main(int argc, char *argv[]) {
 
 log_info(Generating...);
 
+if (journal_file_open(test.journal, O_RDWR|O_CREAT, 0666, true, 
!!verification_key, NULL, NULL, NULL, f) == -128) {
+printf(skipping test: /etc/machine-id not preset\n);
+return 0;
+}
+
 assert_se(journal_file_open(test.journal, O_RDWR|O_CREAT, 0666, 
true, !!verification_key, NULL, NULL, NULL, f) == 0);
 
 for (n = 0; n  N_ENTRIES; n++) {
diff --git a/src/journal/test-journal.c b/src/journal/test-journal.c
index f4dc52c..73c7554 100644
--- a/src/journal/test-journal.c
+++ b/src/journal/test-journal.c
@@ -43,6 +43,11 @@ int main(int argc, char *argv[]) {
 assert_se(mkdtemp(t));
 assert_se(chdir(t) = 0);
 
+if (journal_file_open(test.journal, O_RDWR|O_CREAT, 0666, true, 
true, NULL, NULL, NULL, f) == -128) {
+printf(skipping test: /etc/machine-id not preset\n);
+return 0;
+}
+
 assert_se(journal_file_open(test.journal, O_RDWR|O_CREAT, 0666, 
true, true, NULL, NULL, NULL, f) == 0);
 
 dual_timestamp_get(ts);
diff --git a/src/libsystemd-id128/sd-id128.c b/src/libsystemd-id128/sd-id128.c
index 4286ae7..4e5aaad 100644
--- a/src/libsystemd-id128/sd-id128.c
+++ b/src/libsystemd-id128/sd-id128.c
@@ -106,7 +106,7 @@ _public_ int sd_id128_get_machine(sd_id128_t *ret) {
 
 fd = open(/etc/machine-id, O_RDONLY|O_CLOEXEC|O_NOCTTY

Re: [systemd-devel] [PATCH 1/3] LICENSE.LGPL2.1: update license

2012-11-30 Thread Ramkumar Ramachandra
Kay Sievers wrote:
 On Thu, Nov 29, 2012 at 8:06 PM, Ramkumar Ramachandra
 artag...@gmail.com wrote:
 Update the license with the copy found on
 http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt

 Applied.

Thanks.  I noticed that you dropped the signoff on all three patches.
Should I send future patches without a signoff?

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


[systemd-devel] [PATCH v2] Skip tests that depend on /etc/machine-id if it is not present

2012-11-30 Thread Ramkumar Ramachandra
The following tests fail if /etc/machine-id is not present:

  $ ./test-id128
  random: a08ea8ed34594d4bbd953dd182ec86f9
  Assertion 'sd_id128_get_machine(id) == 0' failed at
  src/test/test-id128.c:41, function main(). Aborting.
  [1]8017 abort (core dumped)  ./test-id128

  $ ./test-journal
  Assertion 'journal_file_open(test.journal, O_RDWR|O_CREAT, 0666,
  true, true, NULL, NULL, NULL, f) == 0' failed at
  src/journal/test-journal.c:46, function main(). Aborting.
  [1]8059 abort (core dumped)  ./test-journal

  $ ./test-journal-stream
  Assertion 'journal_file_open(one.journal, O_RDWR|O_CREAT, 0666,
  true, false, NULL, NULL, NULL, one) == 0' failed at
  src/journal/test-journal-stream.c:88, function main(). Aborting.
  [1]8107 abort (core dumped)  ./test-journal-stream

  $ ./test-journal-verify
  Generating...
  Assertion 'journal_file_open(test.journal, O_RDWR|O_CREAT, 0666,
  true, !!verification_key, NULL, NULL, NULL, f) == 0' failed at
  src/journal/test-journal-verify.c:87, function main(). Aborting.
  [1]8154 abort (core dumped)  ./test-journal-verify

This is because they call sd_id128_get_machine() which barfs if
/etc/machine-id can't be open()'ed.  Treat this as a special case and
skip the dependent tests instead of failing them.
---
 Zbigniew Jędrzejewski-Szmek wrote:
  On Fri, Nov 30, 2012 at 06:47:42PM +0530, Ramkumar Ramachandra wrote:
  The following tests fail if /etc/machine-id is not present:
  +if (journal_file_open(one.journal, O_RDWR|O_CREAT, 0666, true, 
  false, NULL, NULL, NULL, one) == -128) {
  +printf(skipping test: /etc/machine-id not preset\n);
  +return 0;
  +}
  +
   assert_se(journal_file_open(one.journal, O_RDWR|O_CREAT, 0666, 
  true,Hm, this seems fairly intrusive. What about just adding a simple
  test in the Makefile, which adds this test to the list of tests
  only if /etc/machine-id does not exist?
 
 I wouldn't like that.  I don't want to have to regenerate my Makefile
 after installing /etc/machine-id.  I don't think it's elegant to have
 a different number of tests depending on different conditions.
 
 How about this patch as an alternative?  I call sd_id_get_machine()
 before anything else happens.

 src/journal/test-journal-stream.c |5 +
 src/journal/test-journal-verify.c |5 +
 src/journal/test-journal.c|5 +
 src/libsystemd-id128/sd-id128.c   |2 +-
 src/test/test-id128.c |8 ++--
 5 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/journal/test-journal-stream.c 
b/src/journal/test-journal-stream.c
index b3e816d..b3dd140 100644
--- a/src/journal/test-journal-stream.c
+++ b/src/journal/test-journal-stream.c
@@ -80,6 +80,11 @@ int main(int argc, char *argv[]) {
 const void *data;
 size_t l;
 
+if (sd_id128_get_machine(id) == -128) {
+printf(skipping test: /etc/machine-id not preset\n);
+return 0;
+}
+
 log_set_max_level(LOG_DEBUG);
 
 assert_se(mkdtemp(t));
diff --git a/src/journal/test-journal-verify.c 
b/src/journal/test-journal-verify.c
index b667721..54dff9b 100644
--- a/src/journal/test-journal-verify.c
+++ b/src/journal/test-journal-verify.c
@@ -77,6 +77,11 @@ int main(int argc, char *argv[]) {
 struct stat st;
 uint64_t p;
 
+if (sd_id128_get_machine(id) == -128) {
+printf(skipping test: /etc/machine-id not preset\n);
+return 0;
+}
+
 log_set_max_level(LOG_DEBUG);
 
 assert_se(mkdtemp(t));
diff --git a/src/journal/test-journal.c b/src/journal/test-journal.c
index f4dc52c..c23aca0 100644
--- a/src/journal/test-journal.c
+++ b/src/journal/test-journal.c
@@ -38,6 +38,11 @@ int main(int argc, char *argv[]) {
 uint64_t p;
 char t[] = /tmp/journal-XX;
 
+if (sd_id128_get_machine(id) == -128) {
+printf(skipping test: /etc/machine-id not preset\n);
+return 0;
+}
+
 log_set_max_level(LOG_DEBUG);
 
 assert_se(mkdtemp(t));
diff --git a/src/libsystemd-id128/sd-id128.c b/src/libsystemd-id128/sd-id128.c
index 4286ae7..4e5aaad 100644
--- a/src/libsystemd-id128/sd-id128.c
+++ b/src/libsystemd-id128/sd-id128.c
@@ -106,7 +106,7 @@ _public_ int sd_id128_get_machine(sd_id128_t *ret) {
 
 fd = open(/etc/machine-id, O_RDONLY|O_CLOEXEC|O_NOCTTY);
 if (fd  0)
-return -errno;
+return -128; /* Special return value */
 
 k = loop_read(fd, buf, 32, false);
 close_nointr_nofail(fd);
diff --git a/src/test/test-id128.c b/src/test/test-id128.c
index bfd743e..ea621f9 100644
--- a/src/test/test-id128.c
+++ b/src/test/test-id128.c
@@ -38,8 +38,12 @@ int main(int argc, char *argv[]) {
 assert_se(sd_id128_from_string(t, id2) == 0);
 assert_se(sd_id128_equal(id, id2));
 
-assert_se(sd_id128_get_machine(id) == 0

[systemd-devel] [PATCH v3] Skip tests that depend on /etc/machine-id if it is not present

2012-11-30 Thread Ramkumar Ramachandra
The following tests fail if /etc/machine-id is not present:

  $ ./test-id128
  random: a08ea8ed34594d4bbd953dd182ec86f9
  Assertion 'sd_id128_get_machine(id) == 0' failed at
  src/test/test-id128.c:41, function main(). Aborting.
  [1]8017 abort (core dumped)  ./test-id128

  $ ./test-journal
  Assertion 'journal_file_open(test.journal, O_RDWR|O_CREAT, 0666,
  true, true, NULL, NULL, NULL, f) == 0' failed at
  src/journal/test-journal.c:46, function main(). Aborting.
  [1]8059 abort (core dumped)  ./test-journal

  $ ./test-journal-stream
  Assertion 'journal_file_open(one.journal, O_RDWR|O_CREAT, 0666,
  true, false, NULL, NULL, NULL, one) == 0' failed at
  src/journal/test-journal-stream.c:88, function main(). Aborting.
  [1]8107 abort (core dumped)  ./test-journal-stream

  $ ./test-journal-verify
  Generating...
  Assertion 'journal_file_open(test.journal, O_RDWR|O_CREAT, 0666,
  true, !!verification_key, NULL, NULL, NULL, f) == 0' failed at
  src/journal/test-journal-verify.c:87, function main(). Aborting.
  [1]8154 abort (core dumped)  ./test-journal-verify

This is because they call sd_id128_get_machine() which barfs if
/etc/machine-id can't be open()'ed.  Treat this as a special case and
skip the dependent tests instead of failing them.
---
 Oops; forgot to declate `id' in the previous iteration.

 src/journal/test-journal-stream.c |6 ++
 src/journal/test-journal-verify.c |6 ++
 src/journal/test-journal.c|6 ++
 src/libsystemd-id128/sd-id128.c   |2 +-
 src/test/test-id128.c |8 ++--
 5 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/journal/test-journal-stream.c 
b/src/journal/test-journal-stream.c
index b3e816d..d07448f 100644
--- a/src/journal/test-journal-stream.c
+++ b/src/journal/test-journal-stream.c
@@ -79,6 +79,12 @@ int main(int argc, char *argv[]) {
 char *z;
 const void *data;
 size_t l;
+sd_id128_t id;
+
+if (sd_id128_get_machine(id) == -128) {
+printf(skipping test: /etc/machine-id not preset\n);
+return 0;
+}
 
 log_set_max_level(LOG_DEBUG);
 
diff --git a/src/journal/test-journal-verify.c 
b/src/journal/test-journal-verify.c
index b667721..ee55485 100644
--- a/src/journal/test-journal-verify.c
+++ b/src/journal/test-journal-verify.c
@@ -76,6 +76,12 @@ int main(int argc, char *argv[]) {
 char c[FORMAT_TIMESPAN_MAX];
 struct stat st;
 uint64_t p;
+sd_id128_t id;
+
+if (sd_id128_get_machine(id) == -128) {
+printf(skipping test: /etc/machine-id not preset\n);
+return 0;
+}
 
 log_set_max_level(LOG_DEBUG);
 
diff --git a/src/journal/test-journal.c b/src/journal/test-journal.c
index f4dc52c..192b787 100644
--- a/src/journal/test-journal.c
+++ b/src/journal/test-journal.c
@@ -37,6 +37,12 @@ int main(int argc, char *argv[]) {
 Object *o;
 uint64_t p;
 char t[] = /tmp/journal-XX;
+sd_id128_t id;
+
+if (sd_id128_get_machine(id) == -128) {
+printf(skipping test: /etc/machine-id not preset\n);
+return 0;
+}
 
 log_set_max_level(LOG_DEBUG);
 
diff --git a/src/libsystemd-id128/sd-id128.c b/src/libsystemd-id128/sd-id128.c
index 4286ae7..4e5aaad 100644
--- a/src/libsystemd-id128/sd-id128.c
+++ b/src/libsystemd-id128/sd-id128.c
@@ -106,7 +106,7 @@ _public_ int sd_id128_get_machine(sd_id128_t *ret) {
 
 fd = open(/etc/machine-id, O_RDONLY|O_CLOEXEC|O_NOCTTY);
 if (fd  0)
-return -errno;
+return -128; /* Special return value */
 
 k = loop_read(fd, buf, 32, false);
 close_nointr_nofail(fd);
diff --git a/src/test/test-id128.c b/src/test/test-id128.c
index bfd743e..ea621f9 100644
--- a/src/test/test-id128.c
+++ b/src/test/test-id128.c
@@ -38,8 +38,12 @@ int main(int argc, char *argv[]) {
 assert_se(sd_id128_from_string(t, id2) == 0);
 assert_se(sd_id128_equal(id, id2));
 
-assert_se(sd_id128_get_machine(id) == 0);
-printf(machine: %s\n, sd_id128_to_string(id, t));
+if (sd_id128_get_machine(id) == -128)
+printf(skipping test: /etc/machine-id not preset\n);
+else {
+assert_se(sd_id128_get_machine(id) == 0);
+printf(machine: %s\n, sd_id128_to_string(id, t));
+}
 
 assert_se(sd_id128_get_boot(id) == 0);
 printf(boot: %s\n, sd_id128_to_string(id, t));
-- 
1.7.8.1.362.g5d6df.dirty

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


[systemd-devel] 4 failing tests

2012-11-29 Thread Ramkumar Ramachandra
Hi,

The following tests fail.  Is it just me, or does this indicate work
in progress?

$ ./test-id128
random: a08ea8ed34594d4bbd953dd182ec86f9
Assertion 'sd_id128_get_machine(id) == 0' failed at
src/test/test-id128.c:41, function main(). Aborting.
[1]8017 abort (core dumped)  ./test-id128

$ ./test-journal
Assertion 'journal_file_open(test.journal, O_RDWR|O_CREAT, 0666,
true, true, NULL, NULL, NULL, f) == 0' failed at
src/journal/test-journal.c:46, function main(). Aborting.
[1]8059 abort (core dumped)  ./test-journal

$ ./test-journal-stream
Assertion 'journal_file_open(one.journal, O_RDWR|O_CREAT, 0666,
true, false, NULL, NULL, NULL, one) == 0' failed at
src/journal/test-journal-stream.c:88, function main(). Aborting.
[1]8107 abort (core dumped)  ./test-journal-stream

$ ./test-journal-verify
Generating...
Assertion 'journal_file_open(test.journal, O_RDWR|O_CREAT, 0666,
true, !!verification_key, NULL, NULL, NULL, f) == 0' failed at
src/journal/test-journal-verify.c:87, function main(). Aborting.
[1]8154 abort (core dumped)  ./test-journal-verify

Thanks.

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


[systemd-devel] [PATCH 0/3] Some miscellanous fixes

2012-11-29 Thread Ramkumar Ramachandra
Hi,

This evening, I was curious to know whether I could install systemd on
my Ubuntu laptop.  Incidentally, I got a chance to look at the code
and fixed up a few minor things.  Hope it's useful.

Ram

Ramkumar Ramachandra (3):
  LICENSE.LGPL2.1: update license
  DISTRO_PORTING: correct location of hostname-setup.c
  man: fix some spelling mistakes

 DISTRO_PORTING  |6 ++--
 LICENSE.LGPL2.1 |   81 ---
 man/daemon.xml  |2 +-
 man/journalctl.xml  |2 +-
 man/journald.conf.xml   |4 +-
 man/kernel-command-line.xml |2 +-
 6 files changed, 46 insertions(+), 51 deletions(-)

-- 
1.7.8.1.362.g5d6df.dirty

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


[systemd-devel] [PATCH 1/3] LICENSE.LGPL2.1: update license

2012-11-29 Thread Ramkumar Ramachandra
Update the license with the copy found on
http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 LICENSE.LGPL2.1 |   81 +-
 1 files changed, 38 insertions(+), 43 deletions(-)

diff --git a/LICENSE.LGPL2.1 b/LICENSE.LGPL2.1
index 89d4489..5cbfcb5 100644
--- a/LICENSE.LGPL2.1
+++ b/LICENSE.LGPL2.1
@@ -3,7 +3,7 @@
Version 2.1, February 1999
 
  Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
@@ -23,8 +23,7 @@ specially designated software packages--typically 
libraries--of the
 Free Software Foundation and other authors who decide to use it.  You
 can use it too, but we suggest you first think carefully about whether
 this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations
-below.
+strategy to use in any particular case, based on the explanations below.
 
   When we speak of free software, we are referring to freedom of use,
 not price.  Our General Public Licenses are designed to make sure that
@@ -57,7 +56,7 @@ modified by someone else and passed on, the recipients should 
know
 that what they have is not the original version, so that the original
 author's reputation will not be affected by problems that might be
 introduced by others.
-^L
+
   Finally, software patents pose a constant threat to the existence of
 any free program.  We wish to make sure that a company cannot
 effectively restrict the users of a free program by obtaining a
@@ -89,9 +88,9 @@ libraries.  However, the Lesser license provides advantages 
in certain
 special circumstances.
 
   For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it
-becomes a de-facto standard.  To achieve this, non-free programs must
-be allowed to use the library.  A more frequent case is that a free
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
 library does the same job as widely used non-free libraries.  In this
 case, there is little to gain by limiting the free library to free
 software only, so we use the Lesser General Public License.
@@ -113,7 +112,7 @@ modification follow.  Pay close attention to the difference 
between a
 work based on the library and a work that uses the library.  The
 former contains code derived from the library, whereas the latter must
 be combined with the library in order to run.
-^L
+
   GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
@@ -138,8 +137,8 @@ included without limitation in the term modification.)
   Source code for a work means the preferred form of the work for
 making modifications to it.  For a library, complete source code means
 all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control
-compilation and installation of the library.
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
 
   Activities other than copying, distribution and modification are not
 covered by this License; they are outside its scope.  The act of
@@ -218,7 +217,7 @@ instead of to this License.  (If a newer version than 
version 2 of the
 ordinary GNU General Public License has appeared, then you can specify
 that version instead if you wish.)  Do not make any other change in
 these notices.
-^L
+
   Once this change is made in a given copy, it is irreversible for
 that copy, so the ordinary GNU General Public License applies to all
 subsequent copies and derivative works made from that copy.
@@ -269,7 +268,7 @@ Library will still fall under Section 6.)
 distribute the object code for the work under the terms of Section 6.
 Any executables containing that work also fall under Section 6,
 whether or not they are linked directly with the Library itself.
-^L
+
   6. As an exception to the Sections above, you may also combine or
 link a work that uses the Library with the Library to produce a
 work containing portions of the Library, and distribute that work
@@ -305,10 +304,10 @@ of these things:
 the user installs one, as long as the modified version is
 interface-compatible with the version that the work was made with.
 
-c) Accompany the work with a written offer, valid for at least
-three years, to give the same user the materials specified in
-Subsection 6a, above, for a charge no more than the cost of
-performing

[systemd-devel] [PATCH 2/3] DISTRO_PORTING: correct location of hostname-setup.c

2012-11-29 Thread Ramkumar Ramachandra
f33d3ec1 (move more common files to shared/ and add them to shared.la,
2012-04-12) moved src/hostname-setup.c to src/shared/hostname-setup.c,
but did not update DISTRO_PORTING accordingly.  Fix this.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 DISTRO_PORTING |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/DISTRO_PORTING b/DISTRO_PORTING
index 2b08bf8..a6ae043 100644
--- a/DISTRO_PORTING
+++ b/DISTRO_PORTING
@@ -9,9 +9,9 @@ HOWTO:
 insensitively) and you should be able to find the places where
 you need to add/change things.
 
-1) Patch src/hostname-setup.c so that systemd knows where to
-read your host name from. You might also want to update
-status_welcome() in util.c.
+1) Patch src/shared/hostname-setup.c so that systemd knows
+where to read your host name from. You might also want to
+update status_welcome() in util.c.
 
 2) Check the unit files in units/ if they match your
 distribution. Most likely you will have to make additions to
-- 
1.7.8.1.362.g5d6df.dirty

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


[systemd-devel] [PATCH 3/3] man: fix some spelling mistakes

2012-11-29 Thread Ramkumar Ramachandra
Fix some minor spelling mistakes in the manpages.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 man/daemon.xml  |2 +-
 man/journalctl.xml  |2 +-
 man/journald.conf.xml   |4 ++--
 man/kernel-command-line.xml |2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/man/daemon.xml b/man/daemon.xml
index 197138e..0d29e7a 100644
--- a/man/daemon.xml
+++ b/man/daemon.xml
@@ -122,7 +122,7 @@
 first child, so that only the second
 child (the actual daemon process)
 stays around. This ensures that the
-daemon process is reparented to
+daemon process is re-parented to
 init/PID 1, as all daemons should
 be./para/listitem
 
diff --git a/man/journalctl.xml b/man/journalctl.xml
index 471c945..959ae1e 100644
--- a/man/journalctl.xml
+++ b/man/journalctl.xml
@@ -362,7 +362,7 @@
 the time part is omitted, 00:00:00 is
 assumed. If only the seconds component
 is omitted, :00 is assumed. If the
-date component is ommitted, the
+date component is omitted, the
 current day is assumed. Alternatively
 the strings
 literalyesterday/literal,
diff --git a/man/journald.conf.xml b/man/journald.conf.xml
index 86c9869..30523c5 100644
--- a/man/journald.conf.xml
+++ b/man/journald.conf.xml
@@ -183,8 +183,8 @@
 messages is generated. This rate
 limiting is applied per-service, so
 that two services which log do not
-interfere with each other's
-limit. Defaults to 200 messages in
+interfere with each others'
+limits. Defaults to 200 messages in
 10s. The time specification for
 varnameRateLimitInterval=/varname
 may be specified in the following
diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml
index 27f0d40..154d399 100644
--- a/man/kernel-command-line.xml
+++ b/man/kernel-command-line.xml
@@ -64,7 +64,7 @@
 and
 
citerefentryrefentrytitlebootparam/refentrytitlemanvolnum7/manvolnum/citerefentry./para
 
-paraFor command line paramaters understood by the
+paraFor command line parameters understood by the
 initial RAM disk, please see
 
citerefentryrefentrytitledracut.cmdline/refentrytitlemanvolnum7/manvolnum/citerefentry,
 or the documentation of the specific initrd
-- 
1.7.8.1.362.g5d6df.dirty

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


Re: [systemd-devel] [PATCH 0/3] Fix some minor annoyances

2012-10-28 Thread Ramkumar Ramachandra
Zbigniew Jędrzejewski-Szmek wrote:
 On Wed, Dec 14, 2011 at 11:19:13PM +0530, Ramkumar Ramachandra wrote:
 Hi,

 On Dec 2, 2011, Ramkumar Ramachandra wrote:
  Ramkumar Ramachandra (3):
   Debian: update m4 scripts in units/
   completion: fix typo in accessing array index
   completion: add ZSH support

 Does the series look alright?  Can I do something to help move it forward?

 I think that this series slipped through the cracks. I commited the
 first two patches now, the third one requires some discussion since a
 competing approach has appeared.

Thanks.  I'll look into the discussion surrounding the third patch.

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


[systemd-devel] [PATCH] Debian: add hostname path, m4 units

2011-12-02 Thread Ramkumar Ramachandra
Teach systemd about the location of the hostname, distribution version
file, and tweak the various m4 scripts in units/.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 Started using systemd on my Debian machine yesterday- here's a quick
 patch for starters.

 Thanks for reading.
 [Please CC me on replies; I'm not subscribed to the list]

 src/hostname-setup.c   |4 +++-
 src/util.c |   13 +
 units/console-shell.service.m4 |3 +++
 units/getty@.service.m4|3 +++
 units/serial-getty@.service.m4 |3 +++
 5 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/src/hostname-setup.c b/src/hostname-setup.c
index 2c2f10c..918525d 100644
--- a/src/hostname-setup.c
+++ b/src/hostname-setup.c
@@ -32,6 +32,8 @@
 
 #if defined(TARGET_FEDORA) || defined(TARGET_ALTLINUX) || 
defined(TARGET_MANDRIVA) || defined(TARGET_MEEGO) || defined(TARGET_MAGEIA)
 #define FILENAME /etc/sysconfig/network
+#elif defined(TARGET_DEBIAN)
+#define FILENAME /etc/hostname
 #elif defined(TARGET_SUSE) || defined(TARGET_SLACKWARE)
 #define FILENAME /etc/HOSTNAME
 #elif defined(TARGET_ARCH)
@@ -114,7 +116,7 @@ finish:
 fclose(f);
 return r;
 
-#elif defined(TARGET_SUSE) || defined(TARGET_SLACKWARE)
+#elif defined(TARGET_DEBIAN) || defined(TARGET_SUSE) || 
defined(TARGET_SLACKWARE)
 return read_and_strip_hostname(FILENAME, hn);
 #else
 return -ENOENT;
diff --git a/src/util.c b/src/util.c
index e93e6f6..8c0bad9 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3612,6 +3612,19 @@ void status_welcome(void) {
 if (!ansi_color)
 const_color = 0;32; /* Green for openSUSE */
 
+#elif defined(TARGET_DEBIAN)
+
+if (!pretty_name) {
+if ((r = read_one_line_file(/etc/debian_version, 
pretty_name))  0) {
+
+if (r != -ENOENT)
+log_warning(Failed to read 
/etc/debian_version: %s, strerror(-r));
+}
+}
+
+if (!ansi_color)
+const_color = 0;31; /* Red for Debian */
+
 #elif defined(TARGET_GENTOO)
 
 if (!pretty_name) {
diff --git a/units/console-shell.service.m4 b/units/console-shell.service.m4
index 02adc84..461f40a 100644
--- a/units/console-shell.service.m4
+++ b/units/console-shell.service.m4
@@ -11,6 +11,9 @@ After=systemd-user-sessions.service plymouth-quit-wait.service
 m4_ifdef(`TARGET_FEDORA',
 After=rc-local.service
 )m4_dnl
+m4_ifdef(`TARGET_DEBIAN',
+After=rc-local.service
+)m4_dnl
 m4_ifdef(`TARGET_ARCH',
 After=rc-local.service
 )m4_dnl
diff --git a/units/getty@.service.m4 b/units/getty@.service.m4
index d2a145d..0e0cb19 100644
--- a/units/getty@.service.m4
+++ b/units/getty@.service.m4
@@ -12,6 +12,9 @@ After=dev-%i.device systemd-user-sessions.service 
plymouth-quit-wait.service
 m4_ifdef(`TARGET_FEDORA',
 After=rc-local.service
 )m4_dnl
+m4_ifdef(`TARGET_DEBIAN',
+After=rc-local.service
+)m4_dnl
 m4_ifdef(`TARGET_ARCH',
 After=rc-local.service
 )m4_dnl
diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4
index e5f0ca6..e748cce 100644
--- a/units/serial-getty@.service.m4
+++ b/units/serial-getty@.service.m4
@@ -12,6 +12,9 @@ After=dev-%i.device systemd-user-sessions.service 
plymouth-quit-wait.service
 m4_ifdef(`TARGET_FEDORA',
 After=rc-local.service
 )m4_dnl
+m4_ifdef(`TARGET_DEBIAN',
+After=rc-local.service
+)m4_dnl
 m4_ifdef(`TARGET_ARCH',
 After=rc-local.service
 )m4_dnl
-- 
1.7.6.351.gb35ac.dirty

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


Re: [systemd-devel] [PATCH] Debian: add hostname path, m4 units

2011-12-02 Thread Ramkumar Ramachandra
Hi Tollef,

Tollef Fog Heen wrote:
 | diff --git a/src/hostname-setup.c b/src/hostname-setup.c
 | index 2c2f10c..918525d 100644
 | --- a/src/hostname-setup.c
 | +++ b/src/hostname-setup.c
 | @@ -32,6 +32,8 @@
 [...]
 Not needed, the top of read_hostname from the same file.

and

 | diff --git a/src/util.c b/src/util.c
 | index e93e6f6..8c0bad9 100644
 | --- a/src/util.c
 | +++ b/src/util.c
 | @@ -3612,6 +3612,19 @@ void status_welcome(void) {
 [...]
 Already present, AFAICS?

Ugh.  Sorry I was in such a rush.

 | diff --git a/units/console-shell.service.m4 b/units/console-shell.service.m4
 | index 02adc84..461f40a 100644
 | --- a/units/console-shell.service.m4
 | +++ b/units/console-shell.service.m4
 | @@ -11,6 +11,9 @@ After=systemd-user-sessions.service 
 plymouth-quit-wait.service
 [...]
 There's no rc-local.service on Debian, it's rc.local.service if
 anything, ditto for the rest of the patch.

Ah, yes- the initscripts package puts an rc.local in /etc/init.d.
I'll post a fresh patch shortly.

Thanks.

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


[systemd-devel] [PATCH 0/3] Fix some minor annoyances

2011-12-02 Thread Ramkumar Ramachandra
Hi,

I've just started scratching the surface: lack of autocomplete in ZSH
is annoying.  So, here are a couple of patches fixing that, along with
a better version of a patch I messed up earlier today [1].

Thanks for reading.

-- Ram

[1]: 1322818483-3506-1-git-send-email-artag...@gmail.com

Ramkumar Ramachandra (3):
  Debian: update m4 scripts in units/
  completion: fix typo in accessing array index
  completion: add ZSH support

 src/systemd-bash-completion.sh |   54 ---
 units/console-shell.service.m4 |3 ++
 units/getty@.service.m4|3 ++
 units/serial-getty@.service.m4 |3 ++
 4 files changed, 37 insertions(+), 26 deletions(-)

-- 
1.7.6.351.gb35ac.dirty

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


[systemd-devel] [PATCH 1/3] Debian: update m4 scripts in units/

2011-12-02 Thread Ramkumar Ramachandra
Teach the console, getty, and serial m4 scripts about Debian.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 units/console-shell.service.m4 |3 +++
 units/getty@.service.m4|3 +++
 units/serial-getty@.service.m4 |3 +++
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/units/console-shell.service.m4 b/units/console-shell.service.m4
index 02adc84..9bc53f7 100644
--- a/units/console-shell.service.m4
+++ b/units/console-shell.service.m4
@@ -11,6 +11,9 @@ After=systemd-user-sessions.service plymouth-quit-wait.service
 m4_ifdef(`TARGET_FEDORA',
 After=rc-local.service
 )m4_dnl
+m4_ifdef(`TARGET_DEBIAN',
+After=rc.local.service
+)m4_dnl
 m4_ifdef(`TARGET_ARCH',
 After=rc-local.service
 )m4_dnl
diff --git a/units/getty@.service.m4 b/units/getty@.service.m4
index d2a145d..d4a6500 100644
--- a/units/getty@.service.m4
+++ b/units/getty@.service.m4
@@ -12,6 +12,9 @@ After=dev-%i.device systemd-user-sessions.service 
plymouth-quit-wait.service
 m4_ifdef(`TARGET_FEDORA',
 After=rc-local.service
 )m4_dnl
+m4_ifdef(`TARGET_DEBIAN',
+After=rc.local.service
+)m4_dnl
 m4_ifdef(`TARGET_ARCH',
 After=rc-local.service
 )m4_dnl
diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4
index e5f0ca6..9cad9ee 100644
--- a/units/serial-getty@.service.m4
+++ b/units/serial-getty@.service.m4
@@ -12,6 +12,9 @@ After=dev-%i.device systemd-user-sessions.service 
plymouth-quit-wait.service
 m4_ifdef(`TARGET_FEDORA',
 After=rc-local.service
 )m4_dnl
+m4_ifdef(`TARGET_DEBIAN',
+After=rc.local.service
+)m4_dnl
 m4_ifdef(`TARGET_ARCH',
 After=rc-local.service
 )m4_dnl
-- 
1.7.6.351.gb35ac.dirty

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


[systemd-devel] [PATCH 2/3] completion: fix typo in accessing array index

2011-12-02 Thread Ramkumar Ramachandra
Remove spurious '}'.  This error went unnoticed so far because Bash
doesn't complain.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 src/systemd-bash-completion.sh |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/systemd-bash-completion.sh b/src/systemd-bash-completion.sh
index 176591f..9f58b06 100644
--- a/src/systemd-bash-completion.sh
+++ b/src/systemd-bash-completion.sh
@@ -113,7 +113,7 @@ _systemctl () {
 
 for ((i=0; $i = $COMP_CWORD; i++)); do
 if __contains_word ${COMP_WORDS[i]} ${VERBS[*]} 
- ! __contains_word ${COMP_WORDS[i-1]} ${OPTS[ARG}]}; then
+ ! __contains_word ${COMP_WORDS[i-1]} ${OPTS[ARG]}; then
 verb=${COMP_WORDS[i]}
 break
 fi
@@ -228,7 +228,7 @@ _systemd_loginctl () {
 
 for ((i=0; $i = $COMP_CWORD; i++)); do
 if __contains_word ${COMP_WORDS[i]} ${VERBS[*]} 
- ! __contains_word ${COMP_WORDS[i-1]} ${OPTS[ARG}]}; then
+ ! __contains_word ${COMP_WORDS[i-1]} ${OPTS[ARG]}; then
 verb=${COMP_WORDS[i]}
 break
 fi
-- 
1.7.6.351.gb35ac.dirty

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