Karl Godt wrote:I actually use your diff for
Subject: filemnt won't mount two files with same base name.
http://murga-linux.com/puppy/viewtopic. ... 987#430987
Since /usr/sbin/filemnt in Racy has the feature to mount encrypted save files by GUI would like to have this feature in Racy too . Cool
Hi Karl,
Thanks for the reminder. As it happens, I was working on a Racy version of this about three weeks ago, but didn't have time then to finish testing it. Then I got distracted by other things and didn't get back to it -- well, not until now. Here it is.
==========================================================
The attached filemnt has five changes:
1. Corrects false positives in test that checks to see if file is already mounted.
Because having a single file mounted at two mount points is a confusing and possibly dangerous thing, filemnt tests to see if it is already mounted. This has been true for years. But the existing code has a quirk.
If you happen to have two
different files with the same base name, attempting to mount the second file will give you something similar to the following xmessage which is quite puzzling because it simply isn't true.
Sorry /mnt/sr0/puppy_racy_5.2.2.sfs is already mounted and in-use by Puppy
With this new version, you may mount two or more files that happen to have the same name, as long as they are not actually the same file.
For instance, if you are comparing two versions of an .sfs file, you may mount both the old and new versions (at different mount points, obviously) without the need to temporarily rename one of them.
2. Corrects false negatives in test that checks to see if file is already mounted.
With the current filemnt, if the filename itself (not a directory name) is a symlink, then filemnt will allow the file to be mounted twice. This new version corrects this.
3. Expands the error message that appears when a user
does attempt to mount a single file twice.
Now it gives not just the pathname of the file you tried to mount, but also the mount point of the mounted file and the pathname that was used when it was mounted. This helps the user to find the already mounted file.
4. Prevents creation of directory in /mnt/ when given an invalid pathname.
Since most people access filemnt by clicking on icons in ROX-Filer, this would rarely happen. But if you run the existing filemnt from the command line, and pass it a bad filename, it will go ahead and create a directory for it in /mnt/ even though it has no file to mount. This new version prevents this.
5. Corrected code that determines absolute pathname of a file in the current directory.
filemnt creates a unique name for the mount point which is based on the pathname of the file. If the user mounts a file that is in the current directory, and doesn't give the absolute pathname, filemnt determines the absolute pathname so that it can create a unique name.
But due to a minor bug, this was not working. Instead the mount point was based only on the name of the file. So if you had a file named "test.sfs" in two directories, went to the first directory, mounted its test.sfs with the command
filemnt test.sfs, then changed to the other directory and mounted its test.sfs with the same command, filemnt would be confused. Because it thinks the absolute pathname is the same for both files, it assumes that the file is already mounted, so the second file would not be mounted, and the first file would be unmounted.
Again, this would rarely be a problem, since most people use filemnt through ROX-Filer, which supplies absolute file names.
==========================================================
Karl, I'm glad that you found my old version useful. I hope this Racy version works as well for you. My profession? Just an old hardware guy trying to make it in a software world.