Ticket #1425 (closed defect: fixed)

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: slavazanko
Priority: minor Milestone: 4.7.0-pre2
Component: mcedit Version: 4.6.2
Keywords: editor Cc:
Blocked By: Blocking:
Branch state: Votes for changeset: committed-master

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

comment:2 Changed 15 years ago by slavazanko

  • Status changed from new to accepted
  • Owner set to slavazanko
  • severity changed from no branch to on review

Created branch 1425_spaces_in_EDITOR (parent: master)

Initial changeset:deefd6f6570d20c0997d656d5d5f7c393dfc34ca

Review, please.

comment:3 Changed 15 years ago by slavazanko

comment:4 Changed 15 years ago by styx

  • Votes for changeset set to styx

comment:5 Changed 15 years ago by angel_il

  • Votes for changeset changed from styx to styx angel_il
  • severity changed from on review to approved

comment:6 Changed 15 years ago by slavazanko

  • Status changed from accepted to testing
  • Votes for changeset changed from styx angel_il to commited-master
  • Resolution set to fixed
  • severity changed from approved to merged

comment:7 Changed 15 years ago by slavazanko

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.