Ticket #3926 (closed defect: fixed)

Opened 4 months ago

Last modified 4 months ago

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:
https://i.imgur.com/K1WXYkn.png

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:
https://i.imgur.com/eJsUu5F.png

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 4 months ago by andrew_b

  • Owner set to andrew_b
  • Status changed from new to accepted
  • Branch state changed from no branch to on review
  • Milestone changed from Future Releases to 4.8.22

comment:2 Changed 4 months ago by andrew_b

  • Votes for changeset set to andrew_b
  • Branch state changed from on review to approved

comment:3 Changed 4 months 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

comment:4 Changed 4 months ago by andrew_b

  • Status changed from testing to closed

comment:5 Changed 4 months ago by marcelpaulo

It's working fine, I've just tested it, thanks a lot !

Note: See TracTickets for help on using tickets.