Ticket #3646 (closed defect: fixed)

Opened 18 months ago

Last modified 17 months ago

Filtered View does not perform shell expansion on the user's command

Reported by: mc-hobbit Owned by: andrew_b
Priority: major Milestone: 4.8.18
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

What version of Midnight Commander is used?

4.8.17, complied from source on Fedora Linux 23.

[blowe@fedora ~]$ LC_MESSAGES=C /opt/mc-4.8.17/bin/mc -V
GNU Midnight Commander 4.8.17
Built with GLib 2.46.2
Using the S-Lang library with terminfo database
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, fish
Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;

[blowe@fedora ~]$ LC_MESSAGES=C /opt/mc-4.8.17/bin/mc -F
Root directory: /home/blowe

[System data]
    Config directory: /opt/mc-4.8.17/etc/mc/
    Data directory:   /opt/mc-4.8.17/share/mc/
    File extension handlers: /opt/mc-4.8.17/libexec/mc/ext.d/
    VFS plugins and scripts: /opt/mc-4.8.17/libexec/mc/
        extfs.d:        /opt/mc-4.8.17/libexec/mc/extfs.d/
        fish:           /opt/mc-4.8.17/libexec/mc/fish/

[User data]
    Config directory: /home/blowe/.config/mc/
    Data directory:   /home/blowe/.local/share/mc/
        skins:          /home/blowe/.local/share/mc/skins/
        extfs.d:        /home/blowe/.local/share/mc/extfs.d/
        fish:           /home/blowe/.local/share/mc/fish/
    Cache directory:  /home/blowe/.cache/mc/

[blowe@fedora ~]$ /opt/mc-4.8.17/bin/mc --configure-options
 '--prefix=/opt/mc-4.8.17'

What steps will reproduce the problem?

  1. Go to the source sirectory for version 4.8.17
  2. Enter the command ls -l misc/mc*. The output will show at least 7 files.
  3. Start mc.
  4. Press Meta-! to open the "Filtered View" dialogue box
  5. Enter the same command: ls -l misc/mc*

What is the expected output?

An ls file listing identical to the one in step 2.

What do you see instead?

MC displays the following error:

ls: cannot access misc/mc*: No such file or directory

Change History

comment:1 Changed 17 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.18

comment:2 Changed 17 months ago by andrew_b

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

comment:3 Changed 17 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 17 months ago by andrew_b

  • Status changed from testing to closed

comment:5 follow-up: ↓ 7 Changed 17 months ago by zaytsev-work

I'm curious about this line:

const char *const argv[] = { "/bin/sh", "sh", "-c", command, "\0" };

Why the seemingly extra "sh", is necessary?

comment:6 Changed 17 months ago by zaytsev-work

Also, I'm wondering what's the advantage of G_SPAWN_FILE_AND_ARGV_ZERO over G_SPAWN_SEARCH_PATH... It might be safe to assume that /bin/sh is available on every sensible system, but still.

comment:7 in reply to: ↑ 5 Changed 17 months ago by andrew_b

Replying to zaytsev-work:

Why the seemingly extra "sh", is necessary?

This is common way to call exec*() function: http://pubs.opengroup.org/onlinepubs/009695399/functions/popen.html

comment:8 Changed 17 months ago by mc-hobbit

As the original bug submitter, I've reviewed this fix (I compiled from a recent git clone) and it's working. Thanks guys; it's nice to have this feature back!

Note: See TracTickets for help on using tickets.