Ticket #1425 (new defect) — at Version 1

Opened 15 years ago

Last modified 14 years ago

External editor won't open if there are spaces in EDITOR variable

Reported by: andreitch Owned by:
Priority: minor Milestone: 4.7.0-pre2
Component: mcedit Version: 4.6.2
Keywords: editor Cc:
Blocked By: Blocking:
Branch state: Votes for changeset:

Description (last modified by iNode) (diff)

If there are spaces in the EDITOR environment variable, mc won't load it.

These first two examples work, but the last ones don't:

EDITOR=emacs mc
EDITOR=mcedit mc
EDITOR='emacs -nw' mc
EDITOR='mc -e' mc

I think it's a problem with my_system function (utilunix.c, line 128) when it calls execl and execlp. You can see by running this two little C programs that they don't work. The third one works as expected.

#include <unistd.h>

int main(int argc, char *argv[])
{
    execlp("sh", "sh", "emacs -nw", (char *)NULL);
    return 0;
}
#include <unistd.h>

int main(int argc, char *argv[])
{
    execl("sh", "sh", "-c", "emacs -nw", (char *)NULL);
    return 0;
}
#include <unistd.h>

int main(int argc, char *argv[])
{
    execlp("sh", "sh", "-c", "emacs -nw", (char *)NULL);
    return 0;
}

Change History

comment:1 Changed 15 years ago by iNode

  • Component changed from mc-core to mcedit
  • Description modified (diff)
  • Milestone changed from 4.7 to 4.7.0-pre2
Note: See TracTickets for help on using tickets.