! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
startxfce4 doesn't work on Solaris
Status:
RESOLVED: FIXED
Product:
Xfce-utils
Component:
General

Comments

Description Peter Tribble 2009-07-11 15:36:16 CEST
The startxfce4 script doesn't start XFCE at all on Solaris.

The problem is that the Solaris /bin/sh is really primitive, and can't cope with the xinitrc file in 4.6.1.

Simplest fix is to replace

  prog=/bin/sh

with

  prog=/bin/bash

in startxfce4, which means that the xinitrc file will be run by an adequately capable shell.
Comment 1 Brian J. Tarricone (not reading bugmail) 2009-07-11 18:54:56 CEST
Tempting, but I'd prefer to replace the bash-isms with safe sh equivalents.  Patch?
Comment 2 Yves-Alexis Perez editbugs 2009-07-12 07:36:54 CEST
Here checkbashisms doesn't report anything for startxfce4 (4.6.1). (checkbashsisms is a debian tool to find bashisms in /bin/sh scripts). It only checks for non-posix stuff, meaning a /bin/sh script should work with any posix-compliant sh. I guess your /bin/sh in solaris isn't posix or something.

Could you check which lines are problematic?
Comment 3 Brian J. Tarricone (not reading bugmail) 2009-07-12 08:28:01 CEST
It's probably in xinitrc, not in startxfce4.
Comment 4 Peter Tribble 2009-07-12 09:32:30 CEST
Created attachment 2449 
make xinitrc compatible with Solaris sh

The problem is with xinitrc, so we could either fix starxfce4 to run it with a more capable shell, or replace the one-line

export FOO=bar

with

FOO=bar
export FOO

which is what the attached patch does.
Comment 5 Yves-Alexis Perez editbugs 2009-07-12 09:34:57 CEST
Good point. checkbashisms against xinitrc reports:

corsac@hidalgo: checkbashisms debian/xfce/desktop/xfce-utils/scripts/xinitrc.in
possible bashism in debian/xfce/desktop/xfce-utils/scripts/xinitrc.in line 4 ($UID should be "$(id -ru)"):
if test "x$UID" = "x"; then
possible bashism in debian/xfce/desktop/xfce-utils/scripts/xinitrc.in line 31 (type):
if type xdg-user-dirs-update >/dev/null 2>&1; then
possible bashism in debian/xfce/desktop/xfce-utils/scripts/xinitrc.in line 36 (should be '.', not 'source'):
    source "$XDG_CONFIG_HOME/user-dirs.dirs"
possible bashism in debian/xfce/desktop/xfce-utils/scripts/xinitrc.in line 91 ($UID should be "$(id -ru)"):
if test $UID -gt 0 -a -z "$VNCSESSION"; then 
possible bashism in debian/xfce/desktop/xfce-utils/scripts/xinitrc.in line 168 (type):
      type "$trycmd" >/dev/null 2>&1 || continue
possible bashism in debian/xfce/desktop/xfce-utils/scripts/xinitrc.in line 172 (type):
    if test "$cmd" && type "$cmd" >/dev/null 2>&1; then
Comment 6 Yves-Alexis Perez editbugs 2009-07-12 10:13:17 CEST
(In reply to comment #5)
> Good point. checkbashisms against xinitrc reports:
> 
> corsac@hidalgo: checkbashisms debian/xfce/desktop/xfce-utils/scripts/xinitrc.in
> possible bashism in debian/xfce/desktop/xfce-utils/scripts/xinitrc.in line 4
> ($UID should be "$(id -ru)"):
> if test "x$UID" = "x"; then

false positive, since we set it at that time.

> possible bashism in debian/xfce/desktop/xfce-utils/scripts/xinitrc.in line 31
> (type):
> if type xdg-user-dirs-update >/dev/null 2>&1; then

not sure how to fix that :/

> possible bashism in debian/xfce/desktop/xfce-utils/scripts/xinitrc.in line 36
> (should be '.', not 'source'):
>     source "$XDG_CONFIG_HOME/user-dirs.dirs"
> possible bashism in debian/xfce/desktop/xfce-utils/scripts/xinitrc.in line 91
> ($UID should be "$(id -ru)"):

we already set it before, so false positive

> if test $UID -gt 0 -a -z "$VNCSESSION"; then 
> possible bashism in debian/xfce/desktop/xfce-utils/scripts/xinitrc.in line 168
> (type):
>       type "$trycmd" >/dev/null 2>&1 || continue

again, not sure how to fix it.

> possible bashism in debian/xfce/desktop/xfce-utils/scripts/xinitrc.in line 172
> (type):
>     if test "$cmd" && type "$cmd" >/dev/null 2>&1; then

and again.

So all in all, the only fixable one is the source / . which is fairly easy to do. I'll check how to fix the “type” one.

For the export= stuff, it's not detected by checkbashism, so I *guess* it's something POSIX and thus sould be kept? (but if it fixes other problems, why not).

Cheers,
Comment 7 Yves-Alexis Perez editbugs 2009-07-12 10:17:00 CEST
Hmhm, seems that “type” should be replaced by “which” so here's my diff:

diff --git a/scripts/xinitrc.in b/scripts/xinitrc.in
index e19dbe1..7358162 100755
--- a/scripts/xinitrc.in
+++ b/scripts/xinitrc.in
@@ -28,12 +28,12 @@ fi
 
 # set up XDG user directores.  see
 # http://freedesktop.org/wiki/Software/xdg-user-dirs
-if type xdg-user-dirs-update >/dev/null 2>&1; then
+if which xdg-user-dirs-update >/dev/null 2>&1; then
     xdg-user-dirs-update
 fi
 
 if test -f "$XDG_CONFIG_HOME/user-dirs.dirs"; then
-    source "$XDG_CONFIG_HOME/user-dirs.dirs"
+    . "$XDG_CONFIG_HOME/user-dirs.dirs"
     # i'm deliberately not 'export'-ing the XDG_ vars, because you shouldn't
     # rely on the env vars inside apps, since the file could be changed at
     # any time by the user.  this is solely here for migration purposes.
@@ -165,11 +165,11 @@ if test -d "$XDG_CONFIG_HOME/autostart"; then
     # check for TryExec
     trycmd=`grep -E "^TryExec=" "$i" | cut -d'=' -f2`
     if test "$trycmd"; then
-      type "$trycmd" >/dev/null 2>&1 || continue
+      which "$trycmd" >/dev/null 2>&1 || continue
     fi
     
     cmd=`grep -E "^Exec=" "$i" | cut -d'=' -f2`
-    if test "$cmd" && type "$cmd" >/dev/null 2>&1; then
+    if test "$cmd" && which "$cmd" >/dev/null 2>&1; then
       $cmd &
     fi
   done
Comment 8 Brian J. Tarricone (not reading bugmail) 2009-07-12 12:26:08 CEST
Patch is fine with me.
Comment 9 Brian J. Tarricone (not reading bugmail) 2009-07-12 12:27:36 CEST
(The 'source' line is already fixed in svn.)
Comment 10 Mike Massonnet editbugs 2009-07-23 15:13:21 CEST
I saw 2~ patches applied to startxfce4/xinitrc, could someone have a look at bug 5382 please?
Comment 11 Nick Schermer editbugs 2010-07-26 18:27:52 CEST
Fixed the type -> which replacements in master. Maybe someone can check for more bash-isms once this is pushed?
Comment 12 Jérôme Guelfucci editbugs 2010-10-25 22:23:14 CEST
Can anyone running Open Solaris check whether the current startxfce4 from git master branch works?
Comment 13 Peter Tribble 2010-11-05 22:33:11 CET
(In reply to comment #12)
> Can anyone running Open Solaris check whether the current startxfce4 from git
> master branch works?

Works just fine for me, on Solaris, thanks.

(OpenSolaris shouldn't be a problem as it doesn't have such a horribly antiquated /bin/sh so never suffered from the original problem.)
Comment 14 Jérôme Guelfucci editbugs 2010-11-05 22:59:09 CET
Marking as fixed then, thanks for the feedback.

Bug #5557

Reported by:
Peter Tribble
Reported on: 2009-07-11
Last modified on: 2010-12-04

People

Assignee:
Nick Schermer
CC List:
5 users

Version

Attachments

Additional information