Re: Very minor bug in src/f-spot.in



>>>>> "Stephane" == Stephane Delcroix <stephane delcroix org> writes:

    Stephane> On Sat, 2008-05-10 at 18:02 +1000, Martin Schwenke wrote:
    >> src/f-spot.in contains the following line:
    >> 
    >> for arg in $*; do
    >> 
    >> This will break arguments on whitespace, so in the very unlikely case
    >> that someone passes a filename like "foo --profile=bar.jpg" then the
    >> wrong thing will happen.

    Stephane> am sorry I don't get it.
    Stephane> both
    Stephane> f-spot -view "foo --shutdown bar.jpg"
    Stephane> and
    Stephane> f-spot -view foo\ --shutdown\ bar.jpg
    Stephane> works fine (with an image file named "foo --shutdown bar.jpg")

It is only a problem for options that are handled in this loop:

for arg in $*; do
    case "x$arg" in
        x--debug)
            FSPOT_DEBUG="$arg"
            ;;
        x--mdb)
            run_mdb=true
            ;;
        x--trace=*)
            FSPOT_TRACE="$arg"
            ;;
        x--profile=*)
            FSPOT_PROFILE="$arg"
            ;;
        x--uninstalled)
            echo "*** Running uninstalled f-spot ***"
            EXE_TO_RUN="./f-spot.exe"
            export MONO_PATH= PATH_DBUS@../Tao/Tao.OpenGl:../Tao/Tao.OpenGl.Glu:../Tao/Tao.OpenGl.ExtensionLoader:../google-sharp:../gnome-keyring-sharp:../FlickrNet:../SmugMugNet:../libgphoto2-sharp:../semweb:../glitz-sharp/src/:../mono-addins/Mono.Addins:../mono-addins/Mono.Addins.Setup:../mono-addins/Mono.Addins.Gui:$MONO_PATH
            ;;
    esac
done

For example:

--------8<---------8<-------- CUT HERE --------8<---------8<--------
rover|~|4> f-spot -view "file:///home/martins/foo --profile=bar.jpg"
** Running Mono with   --profile=bar.jpg **

** (/usr/lib/f-spot/f-spot.exe:14403): WARNING **: Error loading profiler module 'mono-profiler-bar.jpg': libmono-profiler-bar.jpg.so: cannot open shared object file: No such file or directory
Initializing Mono.Addins
Starting new FSpot server
uri = file:///home/martins/foo --profile=bar.jpg
item changed
open uri = file:///home/martins/foo --profile=bar.jpg
open uri = file:///home/martins/foo --profile=bar.jpg
--------8<---------8<-------- CUT HERE --------8<---------8<--------

Note that it says:

** Running Mono with   --profile=bar.jpg **

The image still displays, but there may be an unwanted side-effect due
to the --profile setting.

If I change the loop to just say:

for arg; do

then the unwanted side-effect isn't there:

--------8<---------8<-------- CUT HERE --------8<---------8<--------
rover|~|6> f-spot -view "file:///home/martins/foo --profile=bar.jpg"
Initializing Mono.Addins
Starting new FSpot server
uri = file:///home/martins/foo --profile=bar.jpg
item changed
open uri = file:///home/martins/foo --profile=bar.jpg
open uri = file:///home/martins/foo --profile=bar.jpg
--------8<---------8<-------- CUT HERE --------8<---------8<--------

I know this is unlikely to be a real problem but the fix is
trivial...  :-)

By the way, you can observe the difference in behaviour by doing
something like this:

rover|~|12> set -- "foo bar" "hello world"
rover|~|13> for i in $* ; do
> echo $i
> done
foo
bar
hello
world
rover|~|14> for i ; do
> echo $i
> done
foo bar
hello world

peace & happiness,
martin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]