Hi! I would like to suggest the following patch to get rid of space-related problems. The only two characters which are still "bad" in iso file paths are newline (because output from find is split by newlines) and "," (because $ISOS_FOUND is split by it by debconf and analyze_cd() replaces commas with spaces).
I manually rebuilt the current hd-media/initrd.gz to include my version of iso-scan.postinst and it did successfully find the file I named "/1 2 3/4 5 6/7 8 9.iso" (screenshot attached). I set IFS to \n\0 because $() cuts the trailing newlines and I didn't figure out a way to put \0 in a variable in dash. The result is that IFS gets the value of \n. Best regards, Ivan
diff --git a/debian/iso-scan.postinst b/debian/iso-scan.postinst index a21ed85..266fa83 100755 --- a/debian/iso-scan.postinst +++ b/debian/iso-scan.postinst @@ -67,10 +67,10 @@ analyze_cd () { # Try to mount a file as an iso, and see if it's a Debian cd. add_usable_iso () { - local iso_to_try=$1 + local iso_to_try="$1" local iso_device=$2 local isodesc - if ! mount -t iso9660 -o loop,ro,exec $iso_to_try /cdrom 2>/dev/null; then + if ! mount -t iso9660 -o loop,ro,exec "$iso_to_try" /cdrom 2>/dev/null; then log "Failed mounting $iso_to_try (from $iso_device) as an ISO image" return fi @@ -162,17 +162,21 @@ scan_device_for_isos() { elif [ "$look_subdirs" = 1 ]; then opt="-type f" fi - isolist=$(find "$dir" $opt -name "*.iso" -o -name "*.ISO" 2>/dev/null) TOPLEVEL_DIRS_COUNT=$(($TOPLEVEL_DIRS_COUNT + 1)) - for iso in $isolist; do + found="$(find "$dir" $opt -name "*.iso" -o -name "*.ISO" 2>/dev/null)" + oldIFS="$IFS" + IFS="$(printf "\n\0")" + for iso in $found; do + IFS="$oldIFS" # FIXME: is this enough to detect broken symlinks? - [ -e $iso ] || continue + [ -e "$iso" ] || continue log "Found ISO $iso on $dev" ISO_COUNT=$(($ISO_COUNT + 1)) - add_usable_iso $iso $dev + add_usable_iso "$iso" $dev done + IFS="$oldIFS" if [ $progress = dir ]; then db_progress STEP 1 fi @@ -199,18 +203,18 @@ scan_device_for_isos() { # Mount selected ISO as Installer image use_this_iso () { - local iso_to_try=${1#/} + local iso_to_try="${1#/}" local iso_device=$2 local RET mount -t auto -o ro $iso_device /hd-media 2>/dev/null cd /hd-media - mount -t iso9660 -o loop,ro,exec $iso_to_try /cdrom 2>/dev/null + mount -t iso9660 -o loop,ro,exec "$iso_to_try" /cdrom 2>/dev/null analyze_cd - db_subst iso-scan/success FILENAME $iso_to_try - db_set iso-scan/filename $iso_to_try + db_subst iso-scan/success FILENAME "$iso_to_try" + db_set iso-scan/filename "$iso_to_try" db_subst iso-scan/success DEVICE $iso_device # FIXME !!! db_subst iso-scan/success SUITE FIXME @@ -469,6 +473,6 @@ device=/dev/$(echo "$SELECTED_ISO" | sed -e 's/\[\(.*\)\] .*/\1/') iso=$(echo "$SELECTED_ISO" | sed -e 's/\[.*\] \(.*\) (.*/\1/') log "Selected ISO: $iso on $device" -use_this_iso $iso $device +use_this_iso "$iso" $device exit 0