Re: Bug#631968: aborts on start (GNU/kFreeBSD)

2012-10-24 Thread Pino Toscano
Hi,

(cleaning up the CC list to Hurd-specific recipients, since it is about 
Hurd-specific bits.)

Alle lunedì 22 ottobre 2012, Simon McVittie ha scritto:
 I have no idea how credentials-passing works on Hurd, but Hurd isn't
 release-critical, so that can wait (if my theory is correct, please
 clone the bug for Hurd support). If Hurd porters want to make GDBus
 work, grepping for __FreeBSD__ is probably a good start. GLib appears
 to support three different flavours of credentials-passing (for
 Linux, FreeBSD and OpenBSD) so if Hurd resembles one of those, it
 should be possible to make it work; the src:dbus build logs claim it
 has SCM_RIGHTS.

Since there is a bit more of BSD compatibility (I think it was one of 
the goals many years ago), there is the BSD-style API for that (i.e. 
using cmsgcred with SCM_CREDS payloads). Although, the actual filling of 
the payload data is not done, which makes things like D-Bus or gamin not 
work.
I saw glib has the API wrapping for socket credentials, but I decided to 
skip supporting Hurd there until cmsgcred would actually work on Hurd. 
(Of course, anybody else is free to prepare such patch.)

-- 
Pino Toscano


signature.asc
Description: This is a digitally signed message part.


Re: Bug#631968: aborts on start (GNU/kFreeBSD)

2012-10-23 Thread Steven Chamberlain
reassign 631968 libglib2.0-0
found 631968 glib2.0/2.33.12+really2.32.4-2
affects 631968 gnome-terminal
tags 631968 + confirmed patch
thanks

Hi!

On 22/10/12 17:33, Simon McVittie wrote:
 I wonder whether this is to do with GDBus not supporting credentials-passing
 for authentication on kFreeBSD. It does support credentials-passing on
 FreeBSD, and it's the same kernel, so the same code ought to work; please
 try the attached patch for src:glib2.0? If successful, this can be tagged
 'patch' and reassigned to libglib2.0-0.

Thank you Simon, this is exactly the reason that gnome-terminal would
fail to connect to DBus on GNU/kFreeBSD (and quits silently with exit
status 1).

I've just tested that your patch fixed the problem on kfreebsd-amd64;
gnome-terminal now starts up and works correctly in a graphical X11
environment.  The fix looks quite typical of other GNU/kFreeBSD porting
issues.

This probably also fixes more GNOME issues, that we didn't even know of yet.

Regards,
-- 
Steven Chamberlain
ste...@pyro.eu.org


-- 
To UNSUBSCRIBE, email to debian-hurd-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/50873685.2000...@pyro.eu.org



Re: Bug#631968: aborts on start (GNU/kFreeBSD)

2012-10-23 Thread Steven Chamberlain
affects 631968 + lightdm
thanks

I see that the same glib2.0 patch also fixes lightdm.

On kfreebsd-amd64 I can confirm the report below that it shows only a
blank screen.  With this glib2.0 patch it works correctly.  The issue
was not filed yet in the BTS but reported recently at:

http://lists.debian.org/ca+4ecjnpygh+qdxfexjdhuqoq+nvrhyw8bjzfzuynxxspy0...@mail.gmail.com

Regards,
-- 
Steven Chamberlain
ste...@pyro.eu.org


-- 
To UNSUBSCRIBE, email to debian-hurd-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/50873d4c.6020...@pyro.eu.org



Re: Bug#631968: aborts on start (GNU/kFreeBSD)

2012-10-22 Thread Simon McVittie
On Mon, 09 Jul 2012 at 00:10:45 +0100, Steven Chamberlain wrote:
 On 05/07/12 01:05, Simon McVittie wrote:
  You don't need all of GNOME, but you do need a D-Bus session.
  [...]
  
  $ eval `dbus-launch --sh-syntax`
  $ xvfb-run gnome-terminal -e mkdir /tmp/hello
 
 With a DBUS session running (now testing from a graphical X11
 environment) I can reproduce the original problem on kfreebsd-amd64

(I can't help wondering why anyone would ever try to use an X11 terminal
emulator *without* a graphical X11 session...)

I wonder whether this is to do with GDBus not supporting credentials-passing
for authentication on kFreeBSD. It does support credentials-passing on
FreeBSD, and it's the same kernel, so the same code ought to work; please
try the attached patch for src:glib2.0? If successful, this can be tagged
'patch' and reassigned to libglib2.0-0.

I tried to test it on a kfreebsd-i386 virtual machine, but that VM seems
to be excessively slow, and fails to compile the GLib documentation, so I
gave up after a few attempts.

I have no idea how credentials-passing works on Hurd, but Hurd isn't
release-critical, so that can wait (if my theory is correct, please
clone the bug for Hurd support). If Hurd porters want to make GDBus
work, grepping for __FreeBSD__ is probably a good start. GLib appears to
support three different flavours of credentials-passing (for Linux, FreeBSD
and OpenBSD) so if Hurd resembles one of those, it should be possible to
make it work; the src:dbus build logs claim it has SCM_RIGHTS.

In addition to credentials-passing across Unix sockets, D-Bus supports
an X11-like magic cookie mechanism (normally only used for TCP sockets),
but that relies on the connecting user having access to their official
home directory according to getent passwd, so it might not be useful
in all cases (for instance, the mini-GNOME-session run by the gdm3 greeter
can't necessarily rely on that).

Regards,
S


-- 
To UNSUBSCRIBE, email to debian-hurd-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/20121022091335.ga24...@reptile.pseudorandom.co.uk



Re: Bug#631968: aborts on start (GNU/kFreeBSD)

2012-10-22 Thread Samuel Thibault
Simon McVittie, le Mon 22 Oct 2012 10:13:35 +0100, a écrit :
 On Mon, 09 Jul 2012 at 00:10:45 +0100, Steven Chamberlain wrote:
  On 05/07/12 01:05, Simon McVittie wrote:
   You don't need all of GNOME, but you do need a D-Bus session.
   [...]
   
   $ eval `dbus-launch --sh-syntax`
   $ xvfb-run gnome-terminal -e mkdir /tmp/hello
  
  With a DBUS session running (now testing from a graphical X11
  environment) I can reproduce the original problem on kfreebsd-amd64
 
 (I can't help wondering why anyone would ever try to use an X11 terminal
 emulator *without* a graphical X11 session...)

An X11 environment does *not* imply a dbus session.

Samuel


-- 
To UNSUBSCRIBE, email to debian-hurd-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20121022115543.gg6...@type.bordeaux.inria.fr



Re: Bug#631968: aborts on start (GNU/kFreeBSD)

2012-10-22 Thread Steven Chamberlain
Hi,

On 22/10/12 12:55, Samuel Thibault wrote:
 Simon McVittie, le Mon 22 Oct 2012 10:13:35 +0100, a écrit :
 (I can't help wondering why anyone would ever try to use an X11 terminal
 emulator *without* a graphical X11 session...)
 
 An X11 environment does *not* imply a dbus session.

The only reason I tried without a 'graphical' X11 environment, is
because I tried firstly to debug the crash-on-startup on a remote shell
box, under xvfb instead of a real X server since there wasn't one set up.

What I found is that it exits silently, in different places, depending
whether a DBus session is running.  It doesn't got far enough to execute
any shell command given by the -e option.

Robert Millan already bisected this to a large DBus-related commit.

Regards,
-- 
Steven Chamberlain
ste...@pyro.eu.org


-- 
To UNSUBSCRIBE, email to debian-hurd-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/508536d8.1080...@pyro.eu.org



Re: Bug#631968: aborts on start (GNU/kFreeBSD)

2012-10-22 Thread Simon McVittie
retitle 631968 gnome-terminal: fails to start on kFreeBSD
clone 631968 -1 -2
retitle -1 gnome-terminal: should recommend dbus-x11
severity -1 important
retitle -2 gnome-terminal: no error message when unable to join D-Bus session
severity -2 important
thanks

On Mon, 22 Oct 2012 at 10:13:35 +0100, Simon McVittie wrote:
  On 05/07/12 01:05, Simon McVittie wrote:
   You don't need all of GNOME, but you do need a D-Bus session.

... which will automatically be started (either from Xsession.d or on-demand)
if you have dbus-x11. Since gnome-terminal needs a D-Bus session, it ought
to have at least a Recommends: on dbus-x11 - this is clone -1 of this bug.

In a previous mail, I wrote:
 [having no error message] is an unhelpful implementation, though - it
 should complain to stderr with g_printerr() before dying, or fall back
 to non-single-instance.

This is clone -2.

 I wonder whether this is to do with GDBus not supporting credentials-passing
 for authentication on kFreeBSD. It does support credentials-passing on
 FreeBSD, and it's the same kernel, so the same code ought to work; please
 try the attached patch for src:glib2.0? If successful, this can be tagged
 'patch' and reassigned to libglib2.0-0.

This is the original bug 631968. Sorry, I didn't attach the patch as I'd
intended: here it is.

S
From 7c02d526880e9a684a6b2f0c72f1b5779c1ae481 Mon Sep 17 00:00:00 2001
From: Simon McVittie s...@debian.org
Date: Sun, 21 Oct 2012 23:38:31 +0100
Subject: [PATCH] Use the FreeBSD credentials-passing code on Debian
 GNU/kFreeBSD

The __FreeBSD__ macro means we have both a FreeBSD kernel and FreeBSD
libc, which isn't the case on GNU/kFreeBSD (GNU libc and userland on
the FreeBSD kernel), so it predefines a different macro. The kernel
is what actually matters for credentials-passing, though.
---
 gio/gcredentials.c|   18 +-
 gio/gunixcredentialsmessage.c |   12 ++--
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/gio/gcredentials.c b/gio/gcredentials.c
index 3a98333..2827c45 100644
--- a/gio/gcredentials.c
+++ b/gio/gcredentials.c
@@ -22,7 +22,7 @@
 
 #include config.h
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #include sys/types.h
 #include sys/socket.h
 #include string.h
@@ -88,7 +88,7 @@ struct _GCredentials
 
 #ifdef __linux__
   struct ucred native;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
   struct cmsgcred native;
 #elif defined(__OpenBSD__)
   struct sockpeercred native;
@@ -140,7 +140,7 @@ g_credentials_init (GCredentials *credentials)
   credentials-native.pid = getpid ();
   credentials-native.uid = geteuid ();
   credentials-native.gid = getegid ();
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
   memset (credentials-native, 0, sizeof (struct cmsgcred));
   credentials-native.cmcred_pid  = getpid ();
   credentials-native.cmcred_euid = geteuid ();
@@ -202,7 +202,7 @@ g_credentials_to_string (GCredentials *credentials)
 g_string_append_printf (ret, gid=% G_GINT64_FORMAT ,, (gint64) credentials-native.gid);
   if (ret-str[ret-len - 1] == ',')
 ret-str[ret-len - 1] = '\0';
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
   g_string_append (ret, freebsd-cmsgcred:);
   if (credentials-native.cmcred_pid != -1)
 g_string_append_printf (ret, pid=% G_GINT64_FORMAT ,, (gint64) credentials-native.cmcred_pid);
@@ -260,7 +260,7 @@ g_credentials_is_same_user (GCredentials  *credentials,
 #ifdef __linux__
   if (credentials-native.uid == other_credentials-native.uid)
 ret = TRUE;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
   if (credentials-native.cmcred_euid == other_credentials-native.cmcred_euid)
 ret = TRUE;
 #elif defined(__OpenBSD__)
@@ -316,7 +316,7 @@ g_credentials_get_native (GCredentials *credentials,
 {
   ret = credentials-native;
 }
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
   if (native_type != G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED)
 {
   g_warning (g_credentials_get_native: Trying to get credentials of type %d but only 
@@ -377,7 +377,7 @@ g_credentials_set_native (GCredentials *credentials,
 {
   memcpy (credentials-native, native, sizeof (struct ucred));
 }
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
   if (native_type != G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED)
 {
   g_warning (g_credentials_set_native: Trying to set credentials of type %d 
@@ -435,7 +435,7 @@ g_credentials_get_unix_user (GCredentials*credentials,
 
 #ifdef __linux__
   ret = credentials-native.uid;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
   ret = credentials-native.cmcred_euid;
 #elif defined(__OpenBSD__)
   ret = credentials-native.uid;
@@ -482,7 +482,7 @@