Notice: Trying to access array offset on value of type bool in /srv/www/vhosts/openpandora.org/domains/bugs.openpandora.org/httpdocs/scripts/details.php on line 649 FS#112 : .pnd files with spaces in filename won't work

OpenPandora Main OS

  • Status Closed
  • Percent Complete
    100%
  • Task Type Bug Report
  • Category Core
  • Operating System All
  • Severity Medium
  • Reported Version Hotfix 3
Attached to Project: OpenPandora Main OS
Opened by Grazvydas - 19.06.2010
Last edited by Michael Mrozek - 21.07.2010

FS#112 - .pnd files with spaces in filename won't work

pnd_run.sh barfs when given a file with space in it's name. Also pnd_run bin doesnt enclose the .pnd name, it should. /usr/pandora/scripts/pnd_run.sh -p "PicoDrive_180beta2 .pnd" -e PicoDrive.run pnd set to `PicoDrive_180beta2 .pnd' exec set to `PicoDrive.run' /usr/pandora/scripts/pnd_run.sh: line 50: [: PicoDrive_180beta2: unary operator expected when run from menu: in fork! df: /media/mmcblk1p1/pandora/desktop//PicoDrive_180beta2: can't find mount point mountpoint: /usr/pandora/scripts/pnd_run.sh: line 120: [: !: integer expression expected not mounted on loop yet, doing so Usage: grep [OPTION]... PATTERN [FILE]... Try `grep --help' for more information. Usage: grep [OPTION]... PATTERN [FILE]... Try `grep --help' for more information. error determining fs, output was cannot
Closed by  Michael Mrozek
21.07.2010 00:53
Reason for closing:  Fixed
Additional comments about closing:  Tested and working. Will be included in HotFix 4
Nils Kneuper commented on 25.06.2010 12:53
Created a patch that might allow the bash script work if the pnd or the exec has a space in its name. The diff is based on some changes that EvilDragon already implemented (cf the file 'pnd_run_original.sh'). So far this is not tested on a pandora (since I don't have one yet). Beside this I am not 100% sure if all cases are handled regarding the mntline when it comes to the variable $FREELOOP. At least it should work if the type "directory" is found, the rest has to be tested further. These are the changes in the diff: * make sure that all the vars that might include spaces when supplied ($PNG, $EXENAME and $STARTDIR) can include spaces by surrounding them with a " " when used/tested * rework the "sudo mount -t aufs" lines to just place " " around the respective variables. This way the strange hacks with param specific stuff should work nicely * check for existance of the pnd file, abort with more meaningful error if that is the case * make the echo output of creating mount points and the stuff "more complete" * comment out the fallback for the $MOUNTPOINT var since it basically makes no sense regarding what the var will include * fix indention at one place Please apply *lots* of testing! Test various formats of pnds (the different types) and also test on different file systems (one vfat card and one non vfat as well as directly in the nand once).
   pnd_run_original.sh (10.7 KiB)
   pnd_run.sh (11.1 KiB)
   pnd_run.sh.diff (6.5 KiB)
vimacs commented on 25.06.2010 14:18
looks good, two small problems thou: +#EDIT IVANOVIC: the following line makes no sense, since the mountpoint has to exist or the PND would not be there! (commenting it out) This should not be commented out as it is (most likely, cant test right now) needed for pnd's on nand to work. also the mount lines shouldnt have the parameters enclosed seperately but instead the whole line should be enclosed, like so: sudo mount -t aufs -o exec,noplink,dirs="$MOUNTPOINT/pandora/appdata/$BASENAME=rw+nolwh":"/mnt/pnd/$BASENAME=rr$append" none "/mnt/utmp/$BASENAME" # put union on top The attached version should work.
   pnd_run.sh (10.9 KiB)
Nils Kneuper commented on 25.06.2010 14:46
Okay, some more fixes (compared to the version done by vimacs right before: * enclose another $PND that can break grep * enclose more variables where checks for existance of variable take place with " " * remove some useless whitespaces Please test this one extensively, though it should work nicely.
   pnd_run.sh (11 KiB)
   pnd_run.sh.diff (6.1 KiB)
   pnd_run_vimacs.sh.diff (1.4 KiB)
Admin
Michael Mrozek commented on 28.06.2010 23:45
Script seems to work, but unless skeezix doesn't update the command line call from libpnd, it won't work with spaces in filenames.
Nils Kneuper commented on 01.07.2010 22:28
Patched version of pandora-libraries.git /lib/pnd_apps.c to allow spaces in parameters. Attaching the diff as well as the old and the new complete version. Please do test it since I don't have a compile env here yet to check it myself.
   lib_pnd_apps.c.diff (0.8 KiB)
   lib_pnd_apps.c_new (6 KiB)
   lib_pnd_apps.c_old (5.6 KiB)
Jeff commented on 02.07.2010 01:25
ivanovic -- for invocation from xfce, that patch actually will not take (since the code is in pnd_desktop.c -> emit_dotdesktop; due to history, theres some oddities .. there used to be some divide between exec methods, but nowadays they mostly all go through one function; emit_dotdesktop seems to still use its own code (which is bad), so I'm, putting a quick fix in there (to quote everything), which should solve the problem right now; however, given a few moments (I don't have many for another week or two), shoudl make emit_dotdesktop use pnd_apps_exec_disco() with the NOEXEC option, and store the exec-line ther;e that way every single exec-type would be routing through one routine, keeping things half-sensible. I've applied your patch as well, as it'll fix the problem from the other avenue. I also found another nit, so woot :) Will post a build in a few mins..
Jeff commented on 02.07.2010 01:29
try this bin: http://www.codejedi.com/pandora/libpnd/random/libpnd.so.1.0.1 copy it over /usr/lib/libpnd.so.1.0.1 also over /usr/lib/libpnd.so.1 (ie: libpnd is copied to both in the build system right now, so we best keep that up lest chaos erupt) jeff
Jeff commented on 02.07.2010 01:31
fwiw, can someone check pnd_run (not pnd_run.sh!) works with paths in spaces? I'm super tight on time, so can't check tonight :(
Nils Kneuper commented on 06.07.2010 12:16
Okay, I copied http://www.codejedi.com/pandora/libpnd/random/libpnd.so.1.0.1 to /usr/lib and also replaced libpnd.so.1 with this file (any reason not to use a symlink?). Afterwards I renamed a pnd to include a space in the pnd name ("wesnoth-1.8.3-1.pnd" becomes "wesnoth-1.8.3 -1,pnd"). What I tested: 1) starting the prog by double clicking on it, on the desktop result: application starts as expected 2) opening a terminal an typing this: pnd_run /media/16GB-MAINmA/pandora/desktop/wesnoth-1.8.3\ -1.pnd result: application starts as expected 3) opening a terminal an typing this: pnd_run "/media/16GB-MAINmA/pandora/desktop/wesnoth-1.8.3 -1.pnd" result: application starts as expected 4) opening a terminal an typing this: pnd_info /media/16GB-MAINmA/pandora/desktop/wesnoth-1.8.3\ -1.pnd result: information about application is shown as expected 5) opening a terminal an typing this: pnd_info "/media/16GB-MAINmA/pandora/desktop/wesnoth-1.8.3 -1.pnd" result: information about application is shown as expected So yeah, regarding my quick and dirty test your changes seem to work.
tsh commented on 16.07.2010 00:15
More tidy-ups, I just added some null string protection and a warning at the end since the un-mounting seems to be a bit brute-force. Removes the 'grep' warnings.
   0001-Removed-spurious-errors.... (4.5 KiB)
   pnd_run.sh (11.1 KiB)

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing