If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler
NEW : We have got a new blog where we post some interesting SWF internals info.

#654 backslash-escaped file names on command line cause error in Linux
Author:
loki

Date created:
Type: bug
Visibility: Everybody
Assigned to:
honfika

Labels: Linux
State: closed 

Normally "\ " is a valid way to use a space on the command line (it autocompleted that
way.)
> What steps will reproduce the problem?
$ ~/Downloads/ffdec_3.0.0_fd9e1de/ffdec.sh -replaceBinaryData ~/wordgamerelease.swf
/opt/Word\ Realms/share/wordgamerelease.swf 7 7-modified.bin
Exception in thread "main" java.lang.NumberFormatException: For input string:
"Realms/share/wordgamerelease.swf"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
at java.lang.Integer.parseInt(Integer.java:527)
at
com.jpexs.decompiler.flash.console.CommandLineArgumentParser.parseReplaceBinaryData(Comman
dLineArgumentParser.java:1261)
at
com.jpexs.decompiler.flash.console.CommandLineArgumentParser.parseArguments(CommandLineArg
umentParser.java:349)
at com.jpexs.decompiler.flash.gui.Main.main(Main.java:904)
> What is the expected output? What do you see instead?
Not sure, first time trying the replace feature, but see output above.
> What version of the product are you using? On what operating system?
As above, on Linux Mint 16.
> Please provide any additional information below. Attach the file you have problem with
if neccessary. If you do not want to publish files YOU CAN CHANGE VISIBILITY TO PRIVATE
If I change it to being surrounded by quotes but without the backslash, I get the exact
same error. Quotes and backslash, same thing. So I guess there's no way to pass a path
containing a space currently?
Please execute the followingcommand with the latest nightly build:
ffdec.sh -debug -replaceBinaryData ~/wordgamerelease.swf /opt/Word\
Realms/share/wordgamerelease.swf 7 7-modified.bin
This command will print the original arguments (args from main(String[] args) method)
If it splits your fileName-filePath, then the problem is not in our sw. Otherwise we will
fix it.
Please copy the result here. Thanks.
Assigned: →
honfika

$ ~/Downloads/ffdec_3.0.0_fd9e1de/ffdec.sh -debug -replaceBinaryData ~/wordgamerelease.swf
/opt/Word\ Realms/share/wordgamerelease.swf 7 7-spatulacity.bin
Exception in thread "main" java.lang.NumberFormatException: For input string:
"Realms/share/wordgamerelease.swf"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
at java.lang.Integer.parseInt(Integer.java:527)
at
com.jpexs.decompiler.flash.console.CommandLineArgumentParser.parseReplaceBinaryData(Comman
dLineArgumentParser.java:1261)
at
com.jpexs.decompiler.flash.console.CommandLineArgumentParser.parseArguments(CommandLineArg
umentParser.java:349)
at com.jpexs.decompiler.flash.gui.Main.main(Main.java:904)
Sorry, wrong nightly! Just a sec
There we go (identical output with quotes instead of '\' ):
$ ~/Downloads/ffdec_3.0.0_0a1e132/ffdec.sh -debug -replaceBinaryData ~/wordgamerelease.swf
/opt/Word\ Realms/share/wordgamerelease.swf 7 7-spatulacity.bin
0.:-debug
1.:-replaceBinaryData
2.:/home/kev/wordgamerelease.swf
3.:/opt/Word
4.:Realms/share/wordgamerelease.swf
5.:7
6.:7-spatulacity.bin
Exception in thread "main" java.lang.NumberFormatException: For input string:
"Realms/share/wordgamerelease.swf"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
at java.lang.Integer.parseInt(Integer.java:527)
at
com.jpexs.decompiler.flash.console.CommandLineArgumentParser.parseReplaceBinaryData(Comman
dLineArgumentParser.java:1267)
at
com.jpexs.decompiler.flash.console.CommandLineArgumentParser.parseArguments(CommandLineArg
umentParser.java:355)
at com.jpexs.decompiler.flash.gui.Main.main(Main.java:904)
Please try
java -jar ...
instead of
ffdec.sh ...
with the backslash and with quotes too
sorry, I mean:
java -jar ffdec.jar ...
That way works:
0.:-debug
1.:-replaceBinaryData
2.:/home/kev/wordgamerelease.swf
3.:/opt/Word Realms/share/wordgamerelease.swf
4.:7
5.:7-spatulacity.bin
(with quotes produces the same output as with backslash)
Then the problem seems to be in ffdec.sh
Does anyone know how to fix it?
Oh, I think I do--just put quotes around the $@ occurences:
# Check default java
if [ -x "`which java`" ]; then
JAVA_VERSION_OUTPUT=`java -version 2>&1`
check_java_version && exec java -Djava.net.preferIPv4Stack=true -Xmx$MEMORY -jar
$JAR_FILE "$@"
fi
# Test other possible Java locations
for JRE_PATH in $LOOKUP_JRE_DIRS; do
if [ -x "$JRE_PATH/bin/java" ]; then
JAVA_VERSION_OUTPUT=`"$JRE_PATH/bin/java" -version 2>&1`
check_java_version && {
export JRE_PATH
exec $JRE_PATH/bin/java -Djava.net.preferIPv4Stack=true -Xmx$MEMORY -jar $JAR_FILE
"$@"
...that seems to let it work, although every argument then seems to need an absolute path
for some reason.
Sorry, I hadn't thought to look there...had assumed it was in Java somewhere...thanks!
Actually, this might be a bit more quote/script-friendly:
# Handle symlinks
PROGRAM="$0"
while [ -L "$PROGRAM" ]; do
PROGRAM=`readlink -f "$PROGRAM"`
done
cd "`dirname \"$PROGRAM\"`"
PARAMS=""
for PARAM in "$@"
do
PARAMS="${PARAMS} \"${PARAM}\""
done
# Check default java
if [ -x "`which java`" ]; then
JAVA_VERSION_OUTPUT=`java -version 2>&1`
check_java_version && bash -c "exec java -Djava.net.preferIPv4Stack=true -Xmx$MEMORY -jar
$JAR_FILE ${PARAMS}"
fi
# Test other possible Java locations
for JRE_PATH in $LOOKUP_JRE_DIRS; do
if [ -x "$JRE_PATH/bin/java" ]; then
JAVA_VERSION_OUTPUT=`"$JRE_PATH/bin/java" -version 2>&1`
check_java_version && {
export JRE_PATH
bash -c "exec $JRE_PATH/bin/java -Djava.net.preferIPv4Stack=true -Xmx$MEMORY -jar
$JAR_FILE ${PARAMS}"
}
fi
done
Actually, maybe that's no good, it then fails the check after that block.
Then how should we fix this? Sorry, I don't know this script.
Ah, just take out the bash -c stuff, and it seems to work well:
PARAMS=""
for PARAM in "$@"
do
PARAMS="${PARAMS} \"${PARAM}\""
done
# Check default java
if [ -x "`which java`" ]; then
JAVA_VERSION_OUTPUT=`java -version 2>&1`
check_java_version && exec java -Djava.net.preferIPv4Stack=true -Xmx$MEMORY -jar
$JAR_FILE ${PARAMS}
fi
# Test other possible Java locations
for JRE_PATH in $LOOKUP_JRE_DIRS; do
if [ -x "$JRE_PATH/bin/java" ]; then
JAVA_VERSION_OUTPUT=`"$JRE_PATH/bin/java" -version 2>&1`
check_java_version && {
export JRE_PATH
exec $JRE_PATH/bin/java -Djava.net.preferIPv4Stack=true -Xmx$MEMORY -jar $JAR_FILE
${PARAMS}
}
fi
done
i've created a nightly build with your modified script. please try it
thanks for the fix
State: new→upgraded
Actually, sorry, for some reason this still doesn't work. It worked from my script, but
not from the straight command line. It should actually be the straight "$@" way I first
suggested; when I then fixed my script properly, my script and ffdec from the command-line
worked fine.
Please could you attach the working sh file?
Thanks, added. Please try the latest nightly build.
Works great! Glad to help, thanks for your patience.
State: upgraded→closed