[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

error "sh: 1: exec: ...: File exists" with dash



I've got the following error in a script yesterday on a Debian 8
machine:

  sh: 1: exec: /home/vlefevre/bin/mymaple: File exists

where sh is dash. The command that led to this error is equivalent to:

  sh -c 'exec /home/vlefevre/bin/mymaple -q -s 2>&1'

The "File exists" message corresponds to the EEXIST error:

$ errno --search exists
EEXIST 17 File exists

But what does this error mean here? Which file exists and shouldn't?

I've looked at the dash source, and the error seems to come from
shellexec() in exec.c, and EEXIST is the errno from execve() in
tryexec(). But EEXIST is not among the possible errors listed in
the execve(2) man page.

--------

A bit more details on the context. This comes from a Perl script
that does:

  $pid = IPC::Open2::open2(\*RD, \*WR, "exec @maple 2>&1");

where @maple is ('/home/vlefevre/bin/mymaple', '-q', '-s').
So, what open2 does corresponds to:

  sh -c 'exec /home/vlefevre/bin/mymaple -q -s 2>&1'

My home directory is under NFS.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Reply to: