Re: man EXECVE(2) resp. EXEC(3)

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

 



Hello Jüergen,

On 3/8/19 6:22 PM, Dr. Jürgen Sauermann wrote:
> Hi Michael,
> 
> On 03/08/2019 05:56 PM, Michael Kerrisk (man-pages) wrote:
>> Hello Jürgen,
>>
>> On 3/5/19 1:19 PM, Dr. Jürgen Sauermann wrote:
>>> Hi,
>>>
>>> this is an improvement proposal for the EXECVE(2) and EXEC(3) man pages.
>>>
>>> I am using release 3.54 of the Linux man-pages project, but the current
>>> version 4.16 shows the same. I am running Linux Mint 17.1 Rebecca.
>>>
>>>
>>> The man page EXEC(3) contains a paragraph named "Special semantics
>>> for execlp() and execvp() which explains to some extent how the "file"
>>> argument of these function is handled. There are some inconsistencies
>>> and possible improvements between the EXECVE(2) and  the EXEC(3)
>>> man pages:
>>>
>>> * The execve() function seems to behave exactly as   execlp*(),  execvp(),
>>>   and execvpe() do, but the paragraph mentioned above
>>>  only occurs in EXEC(3) but not in EXEC VE(2). [ This has caused a bit
>>>  of confusion on the gnu-prog-discuss mailing list lately because one
>>>  side was only aware of EXECVE(2) but not of EXEC(3) ]
>> Can you give more detail here please (e.g., quote exactly the
>> sentences in exec(3) that you also think apply to execve(2)).
> It is the following paragraph in EXEC(3). Please note that you may have
> modified
> in the meantime:
> 
> "
>    Special semantics for execlp() and execvp()
>        The  execlp(),  execvp(), and execvpe() functions duplicate the
> actions
>        of the shell in searching for an executable file if the specified
> file‐
>        name does not contain a slash (/) character.  The file is sought
> in the
>        colon-separated list of directory pathnames specified in the PATH
> envi‐
>        ronment  variable.   If  this  variable  isn't  defined,  the
> path list
>        defaults to the current directory followed by the list  of 
> directories
>        returned by confstr(_CS_PATH).  (This confstr(3) call typically
> returns
>        the value "/bin:/usr/bin".)

But the above sentences don't apply to execve(). Or: why do you
think they do.

>        If the specified filename includes a  slash  character,  then 
> PATH  is
>        ignored, and the file at the specified pathname is executed.
> "

This is true of execve() (it ignores PATH).

> I am not sure if the sentences after this paragraph up to RETURN VALUE
> also apply to execve; I would assume so but haven't tested that.

If you mean these sentences:

       If permission is denied for a file (the attempted execve(2) failed
       with  the  error  EACCES), these functions will continue searching
       the rest of the search path.  If no other file is found,  however,
       they will return with errno set to EACCES.

       If  the header of a file isn't recognized (the attempted execve(2)
       failed with the error ENOEXEC), these functions will  execute  the
       shell  (/bin/sh)  with the path of the file as its first argument.
       (If this attempt fails, no further searching is done.)

They don't apply to execve(2).

> The last sentence in the quote above remains a bit obscure, I believe that
> rms is currently working on a better description.

I'm not sure what you find unclear about the sentence? If you can
elaborate, maybe we can work out an improvement.

Cheers,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux