Bug 199366 - misc/mc 4.8.14 fails with "Cannot create pipe streams" when running shell commands using the Filtered View menu item on the File menu
Summary: misc/mc 4.8.14 fails with "Cannot create pipe streams" when running shell com...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Adam Weinberger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-11 07:37 UTC by Trond.Endrestol
Modified: 2015-04-27 12:21 UTC (History)
2 users (show)

See Also:
woodsb02: maintainer-feedback+


Attachments
Patch to misc/mc to use the PATH environment variable to search for the executable when running Filtered View (1.46 KB, patch)
2015-04-12 03:30 UTC, Ben Woods
woodsb02: maintainer-approval+
Details | Diff
Successful poudriere testport logs on FreeBSD 10.1 amd64 (124.45 KB, text/plain)
2015-04-12 03:34 UTC, Ben Woods
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Trond.Endrestol 2015-04-11 07:37:57 UTC
This behaviour has been observed on stable/10 r279847 and on stable/9 r281350.

Both systems are amd64 and use ZFS.

In both cases, misc/mc was configured as:

===> The following configuration options are available for mc-4.8.14:
     DOCS=on: Build and/or install documentation
     EDITOR=on: Build with internal editor
     ICONV=on: Encoding conversion support via iconv
     NLS=off: Native Language Support
     SMB=off: SMB network protocol support
     SUBSHELL=on: Build with subshell support
     X11=off: X11 (graphics) support
====> Options available for the single SCREEN: you have to select exactly one of them
     SLANG=on: S-Lang console graphics library support
     NCURSES=off: Console (text) interface support
===> Use 'make config' to modify these settings
Comment 1 Ben Woods freebsd_committer 2015-04-11 10:47:33 UTC
I can confirm I am seeing the same error on my system (built with the default port options). I'll look into it.
Comment 2 Trond.Endrestol 2015-04-11 11:49:15 UTC
(In reply to Ben Woods from comment #1)

Using absolute paths, such as /usr/local/sbin/lsof, produces the desired outcome. Maybe MC doesn't properly locate the executable when we only provide the name of the executable, lsof, similar to the example above.
Comment 3 Ben Woods freebsd_committer 2015-04-12 03:30:00 UTC
Created attachment 155497 [details]
Patch to misc/mc to use the PATH environment variable to search for the executable when running Filtered View
Comment 4 Ben Woods freebsd_committer 2015-04-12 03:30:25 UTC
You are correct that mc does not use the PATH environment variable to search for the executable when performing a Filtered View command.

The filtered view command is run with the mc_popen function in lib/utilunix.c. This function runs the process with the glib function g_spawn_async_with_pipes, which by default requires the full path of the executable. Details defined here:
https://developer.gnome.org/glib/stable/glib-Spawning-Processes.html#g-spawn-async-with-pipes

The attached patch adds the G_SPAWN_SEARCH_PATH to the g_spawn_async_with_pipes function call, which causes mc to use the PATH environment variable to search for the executable. This fixes/improves this behaviour.
Comment 5 Ben Woods freebsd_committer 2015-04-12 03:34:47 UTC
Created attachment 155498 [details]
Successful poudriere testport logs on FreeBSD 10.1 amd64
Comment 6 Ben Woods freebsd_committer 2015-04-12 03:49:16 UTC
I have also submitted this patch upstream:
https://github.com/MidnightCommander/mc/pull/59
Comment 7 Trond.Endrestol 2015-04-12 09:06:03 UTC
(In reply to Ben Woods from comment #6)

Goodie. I can confirm the patch works on stable/10 r281411.
Thanks.
Comment 8 Ben Woods freebsd_committer 2015-04-19 22:29:58 UTC
This patch has just been accepted upstream, however it looks like their next release is still some time away. Suggest we go ahead and add this patch to the port in the mean time.
Comment 9 commit-hook freebsd_committer 2015-04-27 12:19:59 UTC
A commit references this bug:

Author: adamw
Date: Mon Apr 27 12:19:47 UTC 2015
New revision: 384828
URL: https://svnweb.freebsd.org/changeset/ports/384828

Log:
  Fix "Cannot create pipe streams" when running shell commands using the Filtered
  View menu item on the File menu.

  PR:		199366
  Reported by:	Trond.Endrestol@ximalas.info
  Patch by:	Ben Woods (maintainer)

Changes:
  head/misc/mc/Makefile
  head/misc/mc/files/patch-lib_utilunix.c
Comment 10 Adam Weinberger freebsd_committer 2015-04-27 12:21:07 UTC
Committed. For the next update, Ben, can you please remove the need to include <bsd.port.options.mk>?