problems loading *.dsl files with spaces in pathsForum: Other Help Topics Topic: problems loading *.dsl files with spaces in paths started by: clacker Posted by clacker on Jan. 12 2006,18:40
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:
after I loaded gnu-utils, that error message changed to:
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. Posted by cbagger01 on Jan. 12 2006,18:57
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 Posted by mikshaw on Jan. 12 2006,19:08
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. Posted by clacker on Jan. 12 2006,19:24
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 Posted by clacker on Jan. 13 2006,03:32
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:
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:
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:
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. Posted by cbagger01 on Jan. 16 2006,04:26
clacker,I think that adding "will work with spaces" fixes are a good thing, but provided that they do NOT create the expectation that all dsl and other (knoppix, debian, etc) scripts will always work with dirname/filename that have spaces. Because once the expectation is there, then any deviation from this expectation is considered a "bug", even though unix/linux best practices are to avoid dirnames/filenames that contain spaces. |