dbus-launch should print semicolons

Egmont Koblinger egmont at uhulinux.hu
Mon Feb 13 12:28:50 PST 2006


Hi,

The output of dbus-launch is primarly intended to be used with the shells
  eval `command`
syntax. However, eval converts newlines to spaces. Due to this feature:

- in bash the command: eval `dbus-launch --sh-syntax`
  exports both variables instead of just the bus address

- tcsh fails with "setenv: Too many arguments" if I type
  eval `dbus-launch --csh-syntax`

Patch attached to terminate every line of dbus-launch's output with a
semicolon and hence make it work as expected for both type of shells.



thx,

Egmont
-------------- next part --------------
diff -Naur dbus-0.60.orig/tools/dbus-launch.c dbus-0.60/tools/dbus-launch.c
--- dbus-0.60.orig/tools/dbus-launch.c	2005-11-30 20:32:27.000000000 +0100
+++ dbus-0.60/tools/dbus-launch.c	2006-02-13 21:13:45.000000000 +0100
@@ -884,17 +884,17 @@
       else
 	{
 	  if (c_shell_syntax)
-	    printf ("setenv DBUS_SESSION_BUS_ADDRESS '%s'\n", bus_address);	
+	    printf ("setenv DBUS_SESSION_BUS_ADDRESS '%s';\n", bus_address);	
 	  else
 	    {
-	      printf ("DBUS_SESSION_BUS_ADDRESS='%s'\n", bus_address);
+	      printf ("DBUS_SESSION_BUS_ADDRESS='%s';\n", bus_address);
 	      if (bourne_shell_syntax)
-		printf ("export DBUS_SESSION_BUS_ADDRESS\n");
+		printf ("export DBUS_SESSION_BUS_ADDRESS;\n");
 	    }
 	  if (c_shell_syntax)
-	    printf ("set DBUS_SESSION_BUS_PID=%ld\n", (long) bus_pid);
+	    printf ("set DBUS_SESSION_BUS_PID=%ld;\n", (long) bus_pid);
 	  else
-	    printf ("DBUS_SESSION_BUS_PID=%ld\n", (long) bus_pid);
+	    printf ("DBUS_SESSION_BUS_PID=%ld;\n", (long) bus_pid);
 	}
 	  
       verbose ("dbus-launch exiting\n");


More information about the dbus mailing list