diff --git a/misc/ext.d/misc.sh.in b/misc/ext.d/misc.sh.in index 822cf2bf6e..917667831d 100644 --- a/misc/ext.d/misc.sh.in +++ b/misc/ext.d/misc.sh.in @@ -13,11 +13,54 @@ do_view_action() { case "${filetype}" in iso9660) - if which isoinfo > /dev/null 2>&1; then - isoinfo -d -i "${MC_EXT_FILENAME}" && isoinfo -l -R -J -i "${MC_EXT_FILENAME}" - else - 7za l "${MC_EXT_FILENAME}" - fi + if which isoinfo > /dev/null 2>&1; then + info=$(isoinfo -d -i "${MC_EXT_FILENAME}") + _st=$? + + if [ "$_st" = 0 ]; then + # Prepend the listing with `isoinfo -d` output + echo "$info" + + echo "$info" | { + rock=n + joliet=n + + while read -r line; do + case "$line" in + Rock*found) + rock=y ;; + Joliet*found) + joliet=y ;; + esac + done + + # Contrary to xorriso, isoinfo does not assume the "natural" + # Rock Ridge -> Joliet -> ECMA-119 fallback order. Without + # any options it uses ECMA-119. With -R it uses Rock Ridge, + # if present, with a fallback to ECMA-119. With -J it uses + # Joliet, if present, but throws an error otherwise. When + # both -J and -R are set (regardless the order), -R is + # ignored. Hence, there is no point in using both together + # in the sense of "either of the two". + + ext= + if [ $rock = y ]; then + ext=-R + elif [ $joliet = y ]; then + ext=-J + fi + + # `isoinfo -l` should be the last command to transfer its + # status to the pipe + isoinfo -l $ext -i "${MC_EXT_FILENAME}" + } || _st=$? + fi + + # Set status as if it was `isoinfo -d .. && isoinfo -l ..` one-liner + (exit "$_st") + else + 7za l "${MC_EXT_FILENAME}" + fi ;; cat) cat "${MC_EXT_FILENAME}" 2>/dev/null