diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2019-07-20 18:12:41 +0100 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2019-07-20 18:12:51 +0100 |
commit | 11c1d710556ac8e59d1c4fd68ba0d2d23b2757ca (patch) | |
tree | 8818164768852f294e0e7a188717bada8f673eea /app-misc/mc | |
parent | app-emulation/wine-staging: Sync with ::wine (diff) | |
download | gentoo-11c1d710556ac8e59d1c4fd68ba0d2d23b2757ca.tar.gz gentoo-11c1d710556ac8e59d1c4fd68ba0d2d23b2757ca.tar.bz2 gentoo-11c1d710556ac8e59d1c4fd68ba0d2d23b2757ca.zip |
app-misc/mc: improve iso9660 error detection, bug #533214
Reported-by: Łukasz Stelmach
Bug: https://bugs.gentoo.org/533214
Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'app-misc/mc')
-rw-r--r-- | app-misc/mc/files/mc-4.8.23-3933-iso9660-1.patch | 85 | ||||
-rw-r--r-- | app-misc/mc/files/mc-4.8.23-3933-iso9660-2.patch | 29 | ||||
-rw-r--r-- | app-misc/mc/mc-4.8.23-r1.ebuild | 111 |
3 files changed, 225 insertions, 0 deletions
diff --git a/app-misc/mc/files/mc-4.8.23-3933-iso9660-1.patch b/app-misc/mc/files/mc-4.8.23-3933-iso9660-1.patch new file mode 100644 index 000000000000..be08e68b296c --- /dev/null +++ b/app-misc/mc/files/mc-4.8.23-3933-iso9660-1.patch @@ -0,0 +1,85 @@ +From afdc9719f3e37921b621046f01f23fe6b705f059 Mon Sep 17 00:00:00 2001 +From: Andrew Borodin <aborodin@vmail.ru> +Date: Sun, 7 Jul 2019 14:44:10 +0300 +Subject: [PATCH 1/2] Ticket #3933: report iso9660 listing errors. + +Variation 1: + +Steps to reproduce: + + * create empty .iso file (touch foo.iso) + * run 'mc' and press enter on empty .iso + +Expected result: some error about invalid file format (sililar to what +F3 view would yield). +Actual result: mc elters a file as if it would be empty valid file. + +Variation 2: +Steps to reproduce: + + * pick valid .iso file + * deinstall all helper tools that handle .sio (isoinfo, xorriso, etc.) + * run 'mc' and press enter on empty .iso + +Expected result: some error about invalid file format (sililar to what +F3 view would yield) +Actual result: mc enters a file as if it would be empty valid file + +Variation 2 is especially confusing for users as it does not hint them +that they should install a tool to get it working. They just observe +silently broken behaviour. + +Signed-off-by: Andrew Borodin <aborodin@vmail.ru> +--- + src/vfs/extfs/helpers/iso9660.in | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/src/vfs/extfs/helpers/iso9660.in b/src/vfs/extfs/helpers/iso9660.in +index 8c2240e8e..76273522e 100644 +--- a/src/vfs/extfs/helpers/iso9660.in ++++ b/src/vfs/extfs/helpers/iso9660.in +@@ -93,6 +93,8 @@ xorriso_rm() { + + # tested to comply with isoinfo 2.0's output + test_iso () { ++ which isoinfo 2>/dev/null || (echo "isoinfo not found" >&2; return 1) ++ + CHARSET=$(locale charmap 2>/dev/null) + if test -z "$CHARSET"; then + CHARSET=$(locale 2>/dev/null | @GREP@ LC_CTYPE | sed -n -e 's/.*\.\(.*\)"$/\1/p') +@@ -119,6 +121,8 @@ test_iso () { + } + + mcisofs_list () { ++ local lsl r ++ + # left as a reminder to implement compressed image support =) + case "$1" in + *.lz) MYCAT="lzip -dc";; +@@ -133,7 +137,11 @@ mcisofs_list () { + *) MYCAT="cat";; + esac + +- $ISOINFO -l -i "$1" 2>/dev/null | @AWK@ -v SEMICOLON=$SEMICOLON ' ++ lsl=$($ISOINFO -l -i "$1" 2>/dev/null) ++ r=$? ++ test $r -gt 0 && return $r ++ ++ echo "$lsl" | @AWK@ -v SEMICOLON=$SEMICOLON ' + BEGIN { + dir=""; + # Pattern to match 8 first fields. +@@ -183,8 +191,8 @@ shift + case "$cmd" in + list) + xorriso_list "$@" || { +- test_iso "$@"; +- mcisofs_list "$@"; ++ test_iso "$@" || exit 1 ++ mcisofs_list "$@" || exit 1 + } + exit 0 + ;; +-- +2.22.0 + diff --git a/app-misc/mc/files/mc-4.8.23-3933-iso9660-2.patch b/app-misc/mc/files/mc-4.8.23-3933-iso9660-2.patch new file mode 100644 index 000000000000..173def62eb0b --- /dev/null +++ b/app-misc/mc/files/mc-4.8.23-3933-iso9660-2.patch @@ -0,0 +1,29 @@ +From c1b6d29b95a373108e8d03ac629dcb03fcec854c Mon Sep 17 00:00:00 2001 +From: Andrew Borodin <aborodin@vmail.ru> +Date: Sun, 7 Jul 2019 15:51:28 +0300 +Subject: [PATCH 2/2] iso9660: report errors in copyout in case of isoinfo + usage. + +Signed-off-by: Andrew Borodin <aborodin@vmail.ru> +--- + src/vfs/extfs/helpers/iso9660.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/vfs/extfs/helpers/iso9660.in b/src/vfs/extfs/helpers/iso9660.in +index 76273522e..f9c6e50ef 100644 +--- a/src/vfs/extfs/helpers/iso9660.in ++++ b/src/vfs/extfs/helpers/iso9660.in +@@ -222,8 +222,8 @@ case "$cmd" in + ;; + copyout) + xorriso_copyout "$@" || { +- test_iso "$@"; +- mcisofs_copyout "$@"; ++ test_iso "$@" || exit 1 ++ mcisofs_copyout "$@" || exit 1 + } + exit 0 + ;; +-- +2.22.0 + diff --git a/app-misc/mc/mc-4.8.23-r1.ebuild b/app-misc/mc/mc-4.8.23-r1.ebuild new file mode 100644 index 000000000000..322ccb31aed9 --- /dev/null +++ b/app-misc/mc/mc-4.8.23-r1.ebuild @@ -0,0 +1,111 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit flag-o-matic + +MY_P=${P/_/-} + +DESCRIPTION="GNU Midnight Commander is a text based file manager" +HOMEPAGE="https://www.midnight-commander.org" +SRC_URI="http://ftp.midnight-commander.org/${MY_P}.tar.xz" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x86-solaris" +IUSE="+edit gpm nls samba sftp +slang spell test unicode X +xdg" + +REQUIRED_USE="spell? ( edit )" + +RDEPEND=">=dev-libs/glib-2.26.0:2 + gpm? ( sys-libs/gpm ) + kernel_linux? ( sys-fs/e2fsprogs ) + samba? ( net-fs/samba ) + sftp? ( net-libs/libssh2 ) + slang? ( >=sys-libs/slang-2 ) + !slang? ( sys-libs/ncurses:0=[unicode?] ) + spell? ( app-text/aspell ) + X? ( x11-libs/libX11 + x11-libs/libICE + x11-libs/libXau + x11-libs/libXdmcp + x11-libs/libSM )" +DEPEND="${RDEPEND} + app-arch/xz-utils + virtual/pkgconfig + nls? ( sys-devel/gettext ) + test? ( dev-libs/check ) + " + +S=${WORKDIR}/${MY_P} + +PATCHES=( + "${FILESDIR}"/${P}-3933-iso9660-1.patch + "${FILESDIR}"/${P}-3933-iso9660-2.patch +) + +pkg_pretend() { + if use slang && use unicode ; then + ewarn "\"unicode\" USE flag only takes effect when the \"slang\" USE flag is disabled." + fi +} + +src_configure() { + [[ ${CHOST} == *-solaris* ]] && append-ldflags "-lnsl -lsocket" + + local myeconfargs=( + --disable-dependency-tracking + --disable-silent-rules + --enable-charset + --enable-vfs + --with-homedir=$(usex xdg 'XDG' '.mc') + --with-screen=$(usex slang 'slang' "ncurses$(usex unicode 'w' '')") + $(use_enable kernel_linux vfs-undelfs) + # Today mclib does not expose any headers and is linked to + # single 'mc' binary. Thus there is no advantage of having + # a library. Let's avoid shared library altogether + # as it also conflicts with sci-libs/mc: bug #685938 + --disable-mclib + $(use_enable nls) + $(use_enable samba vfs-smb) + $(use_enable sftp vfs-sftp) + $(use_enable spell aspell) + $(use_enable test tests) + $(use_with gpm gpm-mouse) + $(use_with X x) + $(use_with edit internal-edit) + ) + econf "${myeconfargs[@]}" +} + +src_test() { + # CK_FORK=no to avoid using fork() in check library + # as mc mocks fork() itself: bug #644462. + # + # VERBOSE=1 to make test failures contain detailed + # information. + CK_FORK=no emake check VERBOSE=1 +} + +src_install() { + emake DESTDIR="${D}" install + dodoc AUTHORS README NEWS + + # fix bug #334383 + if use kernel_linux && [[ ${EUID} == 0 ]] ; then + fowners root:tty /usr/libexec/mc/cons.saver + fperms g+s /usr/libexec/mc/cons.saver + fi + + if ! use xdg ; then + sed 's@MC_XDG_OPEN="xdg-open"@MC_XDG_OPEN="/bin/false"@' \ + -i "${ED%/}"/usr/libexec/mc/ext.d/*.sh || die + fi +} + +pkg_postinst() { + elog "To enable exiting to latest working directory," + elog "put this into your ~/.bashrc:" + elog ". ${EPREFIX}/usr/libexec/mc/mc.sh" +} |