Author: rmilecki
Date: 2015-09-23 13:55:18 +0200 (Wed, 23 Sep 2015)
New Revision: 47028
Modified:
branches/chaos_calmer/package/base-files/files/lib/upgrade/common.sh
Log:
base-files: sysupgrade: quote source image name
get_image() eval a filename without quoting it, resulting in errors with
filenames containing characters that need to be escaped.
$ sysupgrade -T -f ./cfg\(12\).tar.gz img.bin; echo $?
Image check 'platform_check_image' failed.
Invalid config file. Please use only .tar.gz files
1
$ mv cfg\(12\).tar.gz cfg_12.tar.gz
$ mv img\(1\).bin img.bin
sysupgrade -T -f ./cfg_12.tar.gz img.bin; echo $?
0
Enclose the content of $from in double quotes.
Signed-off-by: Adrien Schildknecht <[email protected]>
Backport of r46919
Modified: branches/chaos_calmer/package/base-files/files/lib/upgrade/common.sh
===================================================================
--- branches/chaos_calmer/package/base-files/files/lib/upgrade/common.sh
2015-09-22 11:29:00 UTC (rev 47027)
+++ branches/chaos_calmer/package/base-files/files/lib/upgrade/common.sh
2015-09-23 11:55:18 UTC (rev 47028)
@@ -184,14 +184,14 @@
*) cmd="cat";;
esac
if [ -z "$conc" ]; then
- local magic="$(eval $cmd $from 2>/dev/null | dd bs=2 count=1
2>/dev/null | hexdump -n 2 -e '1/1 "%02x"')"
+ local magic="$(eval $cmd \"$from\" 2>/dev/null | dd bs=2
count=1 2>/dev/null | hexdump -n 2 -e '1/1 "%02x"')"
case "$magic" in
1f8b) conc="zcat";;
425a) conc="bzcat";;
esac
fi
- eval "$cmd $from 2>/dev/null ${conc:+| $conc}"
+ eval "$cmd \"$from\" 2>/dev/null ${conc:+| $conc}"
}
get_magic_word() {
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits