Skip to content

Commit

Permalink
Fix isoinfo usage in the iso9660 view action
Browse files Browse the repository at this point in the history
- ensure the "natural" Rock Ridge -> Joliet -> ECMA-119 fallback order
- never try -J when the iso has no Joliet stuff
- do not mix -R and -J together
  • Loading branch information
slowpeek committed May 26, 2024
1 parent 57cf824 commit 0f4e8c1
Showing 1 changed file with 48 additions and 5 deletions.
53 changes: 48 additions & 5 deletions misc/ext.d/misc.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0f4e8c1

Please sign in to comment.