Problem with ampersand (&) in filename

Help
NoJ
2010-08-20
2012-12-10
  • NoJ
    NoJ
    2010-08-20

    Hi there,

    I've encountered problems when trying to open files with an ampersand in their filename. anyremote is started with the following command:

    /usr/bin/anyremote -f /usr/share/anyremote/cfg-data/Server-mode/all-in-one2.cfg -log

    When I now open a file with mplayer I got the following entry in my log

    - DBG - execNoFork >cd "`cat $HOME/.anyRemote/ar_storedir.tmp`";mplayer -input file=$HOME/.mplayer/fifo "`echo 'Test&File.mp3'`" >> /dev/null<

    so playing of the file actually works. But now all controls fail:

    - DBG - : ------------- Command read -------------
    - DBG - : parseCommand >+CKEV: 9,1<
    - DBG - : Send message to executor thread
    - DBG - : ------------- Command read -------------
    - DBG - : parseCommand >+CKEV: 9,0<
    - DBG - : Send message to executor thread
    - DBG - : ------------- Command read -------------
    - DBG - : parseCommand >+CKEV: 9,1<
    - DBG - : Send message to executor thread
    - DBG - : ------------- Command read -------------
    - DBG - : parseCommand >+CKEV: 9,0<
    - DBG - : Send message to executor thread
    - DBG - : ------------- Command read -------------
    - DBG - : parseCommand >+CKEV: 9,1<
    - DBG - : Send message to executor thread
    - DBG - : ------------- Command read -------------
    - DBG - : parseCommand >+CKEV: 9,0<
    - DBG - : Send message to executor thread
    - DBG - : ------------- Command read -------------
    - DBG - : parseCommand >+CKEV: 7,1<
    - DBG - : Send message to executor thread
    - DBG - : ------------- Command read -------------
    - DBG - : parseCommand >+CKEV: 7,0<
    - DBG - : Send message to executor thread

    or better they are suspended until the file finished playing and are processed then:

    - INF - Command: Exec
    - DBG - substParams >echo "seek +60" > $HOME/.mplayer/fifo<
    - DBG - execSimpleCmd >echo "seek +60" > $HOME/.mplayer/fifo<
    - DBG - execNoFork >echo "seek +60" > $HOME/.mplayer/fifo&<
    - DBG - : got event
    - DBG - : got key >+CKEV: 9,0<
    - DBG - : handle_command
    - DBG - : Clean auto repeat flag
    - DBG - : got event
    - DBG - : got key >+CKEV: 9,1<
    - DBG - : handle_command
    - DBG - : handle_key_press() >9<
    - DBG - findItemInMode >mplayer,9<
    - DBG - handleCmdByKey() >9<
    - DBG - getCommand for >9<
    - INF - processOneCommand >no description< >echo "seek +60" > $HOME/.mplayer/fifo< >1<
    - INF - Command: Exec
    - DBG - substParams >echo "seek +60" > $HOME/.mplayer/fifo<
    - DBG - execSimpleCmd >echo "seek +60" > $HOME/.mplayer/fifo<
    - DBG - execNoFork >echo "seek +60" > $HOME/.mplayer/fifo&<
    - DBG - : got event
    - DBG - : got key >+CKEV: 9,0<
    - DBG - : handle_command
    - DBG - : Clean auto repeat flag
    - DBG - : got event
    - DBG - : got key >+CKEV: 9,1<
    - DBG - : handle_command
    - DBG - : handle_key_press() >9<
    - DBG - findItemInMode >mplayer,9<
    - DBG - handleCmdByKey() >9<
    - DBG - getCommand for >9<
    - INF - processOneCommand >no description< >echo "seek +60" > $HOME/.mplayer/fifo< >1<

    The thing is that the ampersand seems not to be quoted/handled correctly in the main anyremote binary. I tried changing the quoting-style for the FillFile method from shell to escape/c/locale, but all of that led to the same problem.

    Please let me know if there is an easy way to fix this.

    Cheers
    NoJ

     
  • Mike
    Mike
    2010-08-25

    Yes, i see
    Some workaround to fix this issue will be added in upcoming v5.2

     
  • NoJ
    NoJ
    2010-11-11

    Well, I found an easy fix for that, by letting the mplayer script put the filename in a temporary file and cat'ing that file as input to mplayer then ( much like you already do with the current directory ).

    You can find a patch file for applying these changes here

     
  • Mike
    Mike
    2010-12-13

    Thanks !
    I'm going to add the fix to upcoming v5.4