OpenCSW Bug Tracker


Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000280 [vncserver] regular use minor always 2004-03-07 19:02 2009-12-08 20:04
Reporter scs1ng View Status public  
Assigned To maciej
Priority normal Resolution fixed  
Status closed  
Summary 0000280: Start up script has shell run-time errors
Description The script /etc/init.d/cswvncserver gives shell errors both when starting and stopping.

Details:
The config script /opt/csw/etc/vncservers was edited so that the last two lines are:

VNCSERVERS=\"1:scs1ng\"
ARGS=\"-geometry 1024x768 -alwaysshared\"

Running /etc/init.d/cswvncserver stop gives:

Shutting down VNC server:
1:scs1ng
Ambiguous output redirect

and /etc/init.d/cswvncserver start gives

Starting VNC server:
1:scs1ng
Missing ]

Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0003219)
james (reporter)
2006-03-04 05:13

The script has further errors.


Starting with no config always touches /var/spool/locks/vncserver, the initial value for RETVAL should be 1.



If stop is called when not running:

Shutting down VNC server:
/etc/init.d/cswvncserver: [: : integer expression expected


The problem is bash. example:

$ /usr/bin/bash
bash-2.03$ [ \"$RETVAL\" -eq 0 ] && echo yes
[: : integer expression expected


Solution is to set RETVAL as for start or don\'t use bash. This works with /bin/ksh

$ /bin/ksh
$ echo $RETVAL

$ [ \"$RETVAL\" -eq 0 ] && echo yes
yes



Current stable version is 1.2.9
(0004462)
davecb (reporter)
2007-03-20 12:52

In addition to the above:
1) the su command will be run using root\'s default shell, and
when the Solaris 9 root shell is sh, the expression \"cd ~\" will fail, and
vncserver will not be found. If one adds \"-\" to the su options, \"cd ~\" can
be replaced with just \"cd\".

2) the script needs to add the full path to vncserver,

3) the USER variable needs to be set.

The fixes for Solaris 9 are follows:

# Experimental sh-compatable variation, for Solaris 9/10 sh
X=${display##*:}
su - ${display##*:} -c \"set -x && cd && pwd && [ -f .vnc/passwd ] && USE
R=$X /opt/csw/bin/vncserver ${ARGS} :${display%%:*}\"
(0004463)
davecb (reporter)
2007-03-20 15:38

Whoops, that script will NOT work on Solaris: it\'s bash-only, and
/etc/rc2 code only runs it with sh, thusly:

        for f in /etc/rc3.d/S*; do
                if [ -s $f ]; then
                        case $f in
                                *.sh) . $f ;;
                                *) /sbin/sh $f start ;;
                        esac
                fi
        done

Rats! Rewrite time!

--Dave Collier-Brown <davecb@spamcop.net>
(0004467)
davecb (reporter)
2007-03-23 09:18

Ok, here\'s an rc3.d script that works on Solaris, using only sh instead of bash: --Dave Collier-Brown <davecb@spamcop.net>
 
hobbes> cat S92cswvncserver
#!/bin/sh
#
# S92cswvncserver -- Starts and stops vncserver.
# used to provide remote X window systems access to
# machines which only have (PC) VNC available.
#set -x
VNCSERVERS=\"\"
ARGS=\"\"

main() {
        chmod 01777 /tmp/.X11-unix # Permit non-root access
        
        if [ -f /opt/csw/etc/vncservers ] ; then
                . /opt/csw/etc/vncservers
        else
                say \"$0: no servers to start in /opt/csw/etc/vncservers\"
                exit 0
        fi
        
        # See how we were called.
        case \"$1\" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart|reload)
                stop
                start
                ;;
        condrestart)
                if [ -f /var/spool/locks/vncserver ]; then
                        stop
                        start
                fi
                ;;
        stat*)
                pgrep -l vnc
                ;;
        *)
                echo $\"Usage: $0 {start|stop|status|restart|condrestart}\"
                exit 1
        esac
}

start() {
        echo \"Starting VNC server: \"
        ulimit -c 0 >/dev/null 2>&1
        rc=0
        for token in ${VNCSERVERS}; do
                echo \"${token} \"
                display=`echo $token | sed \'s/:.*$//\'`
                user=`echo $token | sed \'s/^.*://\'`
                su - ${user} -c \"
                        cd
                        if [ ! -f .vnc/passwd ]
                                say \"$0: $user lacks a .vnc/password file, skipped\"
                        else

                                USER=$user /opt/csw/bin/vncserver ${ARGS} :${display}
                        fi
                \"
                rc=$?
                if [ \"$rc\" -ne 0 ]; then
                        break
                fi
        done
        if [ \"$rc\" -eq 0 ]; then
                touch /var/spool/locks/vncserver
        fi
}

stop() {
        echo \"Shutting down VNC server: \"
        for token in ${VNCSERVERS}; do
                echo \"${token} \"
                display=`echo $token | sed \'s/:.*$//\'`
                user=`echo $token | sed \'s/^.*://\'`
                su ${user} -c \"USER=$user /opt/csw/bin/vncserver -kill :${display}\"
                rc=$?
        done
        if [ \"$rc\" -eq 0 ]; then
                rm -f /var/spool/locks/vncserver
        fi
}

say() {
        echo \"$@\" 1>&2
}

main \"$@\"
exit 0
(0007003)
maciej (manager)
2009-11-18 09:12

Hi, I'm the new vncviewer maintainer.

I fixed one RETVAL issue in the startup script. Can you take another look?

Version 1.3.10 is available from the mirrors.
(0007072)
maciej (manager)
2009-12-08 20:04

No feedback, closing the bug. There's a fair chance it works with current tightvnc.


Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker