Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit 0f4e8c1

Browse files
committed
Fix isoinfo usage in the iso9660 view action
- 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
1 parent 57cf824 commit 0f4e8c1

File tree

1 file changed

+48
-5
lines changed

1 file changed

+48
-5
lines changed

misc/ext.d/misc.sh.in

+48-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,54 @@ do_view_action() {
1313

1414
case "${filetype}" in
1515
iso9660)
16-
if which isoinfo > /dev/null 2>&1; then
17-
isoinfo -d -i "${MC_EXT_FILENAME}" && isoinfo -l -R -J -i "${MC_EXT_FILENAME}"
18-
else
19-
7za l "${MC_EXT_FILENAME}"
20-
fi
16+
if which isoinfo > /dev/null 2>&1; then
17+
info=$(isoinfo -d -i "${MC_EXT_FILENAME}")
18+
_st=$?
19+
20+
if [ "$_st" = 0 ]; then
21+
# Prepend the listing with `isoinfo -d` output
22+
echo "$info"
23+
24+
echo "$info" | {
25+
rock=n
26+
joliet=n
27+
28+
while read -r line; do
29+
case "$line" in
30+
Rock*found)
31+
rock=y ;;
32+
Joliet*found)
33+
joliet=y ;;
34+
esac
35+
done
36+
37+
# Contrary to xorriso, isoinfo does not assume the "natural"
38+
# Rock Ridge -> Joliet -> ECMA-119 fallback order. Without
39+
# any options it uses ECMA-119. With -R it uses Rock Ridge,
40+
# if present, with a fallback to ECMA-119. With -J it uses
41+
# Joliet, if present, but throws an error otherwise. When
42+
# both -J and -R are set (regardless the order), -R is
43+
# ignored. Hence, there is no point in using both together
44+
# in the sense of "either of the two".
45+
46+
ext=
47+
if [ $rock = y ]; then
48+
ext=-R
49+
elif [ $joliet = y ]; then
50+
ext=-J
51+
fi
52+
53+
# `isoinfo -l` should be the last command to transfer its
54+
# status to the pipe
55+
isoinfo -l $ext -i "${MC_EXT_FILENAME}"
56+
} || _st=$?
57+
fi
58+
59+
# Set status as if it was `isoinfo -d .. && isoinfo -l ..` one-liner
60+
(exit "$_st")
61+
else
62+
7za l "${MC_EXT_FILENAME}"
63+
fi
2164
;;
2265
cat)
2366
cat "${MC_EXT_FILENAME}" 2>/dev/null

0 commit comments

Comments
 (0)