Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (2) </ [1] 2 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: problems loading *.dsl files with spaces in paths, problem in dsl 2.1?< Next Oldest | Next Newest >
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: Jan. 12 2006,18:40 QUOTE

I just tried out the new SATA drives feature in dsl 2.1.  This is a great addition.  I can finally read from the hard drive on my new machine, which is a big thing for me.  Thanks so much for adding this feature.

I had a small problem loading dsl files directly from the drive.  I can copy them to /home/dsl fine and load them from there, but if I try to load them directly from the SATA drive (using emelfm and the mydsl button) I get this error:

Code Sample
BusyBox v1.00 (2006.01.04-23:00+0000) multi-call binary

Usage: basename FILE [SUFFIX]

Strips directory path and suffixes from FILE.
If specified, also removes any trailing SUFFIX.

cut: invalid byte or field list
tar: /mnt/sda2/Documents: No such file or directory


after I loaded gnu-utils, that error message changed to:

Code Sample
basename: too many arguments
Try `basename --help' for more information.
cut: invalid byte or field list
Try `cut --help' for more information.
tar: /mnt/sda2/Documents: No such file or directory


the file was in a directory a called /mnt/sda2/Documents and Settings/myname/My Documents/Linux/optional so it looks like somehow the space messed things up.

As another test I did was to create a directory called /home/dsl/my\ stuff and place a *.dsl file in there.  I got the same error so the problem is with spaces and not the SATA drive.

I tried looking through the code but I didn't see why this is happening.  It looks like the variables are surrounded by quotes like they should be.
Back to top
Profile PM 
cbagger01 Offline





Group: Members
Posts: 4264
Joined: Oct. 2003
Posted: Jan. 12 2006,18:57 QUOTE

Spaces are generally considered to be a nono when using Linux and filenames or directorynames.

You can usually compensate for this with special parameter handling like the MSWord Viewer script, for example.

But the MSWord Viewer is INTENDED for viewing MSWord documents that often contain spaces in the file name.

Most of the DSL scripts are based on the assumption that Linux filename/directoryname best practices are being followed.

So while in theory, this error could be fixed, I doubt that the developers will want to do so because it is like opening a can of worms.  Every script that might be used with a file/dir that has spaces would then need to be rewritten and that is not a small task.

Just my $0.02
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Jan. 12 2006,19:08 QUOTE

I would make a symlink (or mount --bind) and use that path instead:

ln -s "/mnt/sda2/Documents and Settings/myname/My Documents/Linux/optional" /home/dsl/sda2_apps

or:

mount --bind "/mnt/sda2/Documents and Settings/myname/My Documents/Linux/optional" /mnt/sda2_apps

I'm not certain that basename would work as expected with a symlink, but mounting it will work for sure.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: Jan. 12 2006,19:24 QUOTE

The symilnks are a good idea.  I can try that.

I noticed in line 43 and 46 of /etc/init.d/mydsl-install that there are two instances of the $APP variable which are not surrounded by quotes.  Quoting those got rid of the error messages but the dsls still didn't load (but I had some problems because of the read only filesystem).

case "$APP" in
  *.dsl)
     /etc/init.d/mkwriteable
     busybox tar -C / -zxf $APP
  ;;
  *.tar.gz)
     busybox tar -C / -zxf $APP
Back to top
Profile PM 
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: Jan. 13 2006,03:32 QUOTE

OK, I had to modify three files, but once that's done you can have spaces in path names and still be able to use the mydsl-load myapp.dsl games functionality.

The first change was to the /usr/bin/mydsl-load script.  I changed the first area to slurp up all of the parameters and if this ends in an extension we want (dsl, uci, or tar.gz) I take that as the pasth and file name.  If it doesn't. then I assume that there is a $1 containing the file and a $2 containing the repository group.  I also added some quotes around $APP at the end of the script:

Code Sample
#!/bin/sh
#(c) Robert Shingledecker 2004,2005
#
. /etc/init.d/dsl-functions
#
MYMENU="/var/tmp/mydsl.menu"
MYICONS="/var/tmp/mydsl.icons"
DESKTOP=`cat $HOME/.desktop`
XTDESKTOP="$HOME/.xtdesktop"

#
desktop_setup(){
  if [ -f "$MYMENU/$APPNAME" ]; then
#     if [ "$DESKTOP" == "fluxbox" ]; then
        /etc/init.d/mkmydslmenu.lua "$APPNAME"
#     else
        /etc/init.d/mkmydsljwmmenu.lua "$APPNAME"
        jwm -restart
#     fi
  fi
  iconsnap.sh
}
#
# Main
#
if [ -n "$DISPLAY" ] && [ $UID != 1001 ]; then
  echo "Non DSL User error." > /tmp/noload
  echo "You must be logged in as user \"dsl\" to install a myDSL extension."
  exit 1
else
  rm -f /tmp/noload
fi

#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if [ -n "$1" ]; then
  if (echo "$*" | grep -q "\.dsl$") || (echo "$*" | grep -q "\.uci$") || (echo "$*" | grep -q "\.tar\.gz$"); then
     APP="$*"
  else
     if [ -n "$2" ]; then
        APP="$1"
        mydsl-wget "$APP" "$2"
        if [ -f /tmp/noload ]; then
           cat /tmp/noload
           exit 1;
        fi
     fi
  fi
else
  whiptail --title "Specify myDSL Extensions" --inputbox "Enter extension, e.g. /mnt/hda3/optional/myapp.dsl" 0 0 2>/tmp/mydsl.app
  APP=$(cat /tmp/mydsl.app)
  if [ ! -n "$APP" ]; then
     exit 1
  fi
fi
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


######################################################################################################
#if [ -n "$1" ]; then
#   APP="$1"
#else
#   whiptail --title "Specify myDSL Extensions" --inputbox "Enter extension, e.g. /mnt/hda3/optional/myapp.dsl" 0 0 2>/tmp/mydsl.app
#   APP=$(cat /tmp/mydsl.app)
#   if [ ! -n "$APP" ]; then
#      exit 1
#   fi
#fi
#if [ -n "$2" ]; then
#   mydsl-wget "$APP" "$2"
#   if [ -f /tmp/noload ]; then
#      cat /tmp/noload
#      exit 1;
#   fi
#fi
######################################################################################################

#
case "$APP" in
  *.uci)
     APPNAME=$(getbasefile "$APP" 1)
     sudo /etc/init.d/mountci "$APP" "$APPNAME"
     if [ $? == 0 ] && [ -n "$DISPLAY" ]; then
        iconcheck
        desktop_setup
     fi
 ;;
  *.dsl)
     APPNAME=$(getbasefile "$APP" 1)
     sudo /etc/init.d/mydsl-install "$APP"
     if [ -n "$DISPLAY" ]; then
        iconcheck
        desktop_setup
     fi
 ;;
  *.tar.gz)
     APPNAME=$(getbasefile "$APP" 2)
     sudo /etc/init.d/mydsl-install "$APP"
     if [ -n "$DISPLAY" ]; then
        iconcheck
        desktop_setup
     fi
 ;;
esac


Next I edited the /etc/init.d/mydsl-install script.  Again I used a $* to get all of the parameter string, and also added some parenthesis around the $APP at the end:

Code Sample
#!/bin/sh
#(c) Robert Shingledecker 2004,2005
#
MYICONS="/var/tmp/mydsl.icons"
XTDESKTOP="$HOME"/.xtdesktop
#
if [ -n "$1" ]; then
  APP="$*"
else
  exit 1
fi
UMOUNT=""
if [ ! -e "$APP" ]; then
  APP_NAME=`basename "$APP"`
  MYDSL=`dirname "$APP"`
  if [ `basename "$MYDSL"` == "optional" ]; then
     MYDSL=`dirname "$MYDSL"`
     if [ "$MYDSL" == "/cdrom2" ]; then
        MYDSL="/mnt/auto/cdrom"
        APP="$MYDSL/optional/$APP_NAME"
     else
        mount "$MYDSL" 2>/dev/null
     fi
  fi
  if [ ! -e "$APP" ]; then
     if [ -n "$DISPLAY" ]; then
        popup.lua 'Please mount media containing optional dir and try again.'
     else
        echo -n 'Please mount media containing optional directory and try again.'
        read gagme
     fi
     exit 1
  else
     UMOUNT="yes"
  fi
fi
if [ -d "$XTDESKTOP" ]; then
  mount --bind "$MYICONS" "$XTDESKTOP"
fi
case "$APP" in
  *.dsl)
     /etc/init.d/mkwriteable
     busybox tar -C / -zxf "$APP"
 ;;
  *.tar.gz)
     busybox tar -C / -zxf "$APP"
 ;;
  *.deb)
     /usr/sbin/dpkg-restore >/dev/null 2>&1
     rxvt -rv -T "myDSL deb package terminal" -e sudo dpkg -i "$APP" &
 ;;
esac
if [ -d "$XTDESKTOP" ]; then
  umount "$XTDESKTOP"
fi
if [ "$UMOUNT" == "yes" ]; then
  umount "$MYDSL"
fi


The last change was to the file /etc/init.d/dsl-functions.  I changed the getbasefile function slightly by adding quotes around the $1.  I don't think it's really necessary, but I did it for completeness:

Code Sample
getbasefile(){
BASENAME=`basename "$1"`
FIELDS=`echo $BASENAME|awk 'BEGIN{ FS="."} {print NF}'`
((FIELDS -= $2))
INFO=`echo $BASENAME|cut -f1-$FIELDS -d.`
echo $INFO
return 0
}


Modifying those three script allowed me to load *.dsl, *.uci, and *.tar.gz files for a directory with spaces in it, as well as using the mydsl-load barrage.dsl games form correctly.

I'm sure there is a cleaner way to do it, but this worked.  If you don't want to use it because spaces are a nono that's OK too.
Back to top
Profile PM 
5 replies since Jan. 12 2006,18:40 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (2) </ [1] 2 >/
reply to topic new topic new poll
Quick Reply: problems loading *.dsl files with spaces in paths

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code