Ticket #3926 (closed defect: fixed)
mc shows error message for each not-installed program libexec/mc/ext.d/doc.sh tries to access
Reported by: | marcelpaulo | Owned by: | andrew_b |
---|---|---|---|
Priority: | minor | Milestone: | 4.8.22 |
Component: | mc-core | Version: | master |
Keywords: | mc.ext msdoc doc.sh | Cc: | |
Blocked By: | Blocking: | ||
Branch state: | merged | Votes for changeset: | committed-master |
Description
paulo:~/src/mc (master)$ mc -V GNU Midnight Commander 4.8.21-8-g6cdd3b7ad Built with GLib 2.56.1 Using the S-Lang library with terminfo database With builtin Editor With subshell support as default With support for background operations With mouse support on xterm With support for X11 events With internationalization support With multiple codepages support Virtual File Systems: cpiofs, tarfs, sfs, extfs, ftpfs, sftpfs, fish Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;
When viewing *.doc files, for instance:
the file is rendered with the first viewer that can be found, but an error message is shown for every viewer which is tried and not found:
Here's the section from my ~/.config/mc/mc.ext that handles *.doc files (I haven't changed it from the default settings):
# Microsoft Word Document regex/i/\.(do[ct]|wri)$ Open=/usr/local/libexec/mc/ext.d/doc.sh open msdoc View=%view{ascii} /usr/local/libexec/mc/ext.d/doc.sh view msdoc type/^Microsoft\ Word Open=/usr/local/libexec/mc/ext.d/doc.sh open msdoc View=%view{ascii} /usr/local/libexec/mc/ext.d/doc.sh view msdoc
and here's the code from /usr/local/libexec/mc/ext.d/doc.sh that handles msdoc:
msdoc) which wvHtml >/dev/null 2>&1 && { tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX` wvHtml "${MC_EXT_FILENAME}" --targetdir="$tmp" page.html elinks -dump "$tmp/page.html" rm -rf "$tmp" } || \ antiword -t "${MC_EXT_FILENAME}" || \ catdoc -w "${MC_EXT_FILENAME}" || \ word2x -f text "${MC_EXT_FILENAME}" - || \ strings "${MC_EXT_FILENAME}" ;;
I don't have neither wv nor antiword installed:
paulo:~/tmp$ apt policy wv wv: Installed: (none) Candidate: 1.2.9-4.2build1 Version table: 1.2.9-4.2build1 500 500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages paulo:~/tmp$ apt policy antiword antiword: Installed: (none) Candidate: 0.37-11build1 Version table: 0.37-11build1 500 500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
so, antiword is run but not found, hence the error message I got. As catdoc is installed:
paulo:~/tmp$ apt policy catdoc catdoc: Installed: 1:0.95-4.1 Candidate: 1:0.95-4.1 Version table: *** 1:0.95-4.1 500 500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages 100 /var/lib/dpkg/status
it's run and it renders the file.
The presence of the alternatives antiword, catdoc, word2x and strings should be tested with which, just like wv was tested, to prevent an error message to be shown for each one which's not found.
Change History
comment:1 Changed 6 years ago by andrew_b
- Status changed from new to accepted
- Owner set to andrew_b
- Branch state changed from no branch to on review
- Milestone changed from Future Releases to 4.8.22
comment:2 Changed 6 years ago by andrew_b
- Votes for changeset set to andrew_b
- Branch state changed from on review to approved
comment:3 Changed 6 years ago by andrew_b
- Status changed from accepted to testing
- Votes for changeset changed from andrew_b to committed-master
- Resolution set to fixed
- Branch state changed from approved to merged
Merged to master: [0bb1db903039f619497e55c2e7563fec5e125153].
Branch: 3926_view_doc
changeset:1d197296901f8814df72d47a9e884c5e3a6bbcba