From: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
To: Nora Platiel <nplatiel@gmx.us>,
mtk.manpages@gmail.com, Shawn Landden <shawn@git.icu>
Cc: linux-man@vger.kernel.org
Subject: Re: execve(2) man page: "absolute pathname" inconsistency
Date: Sat, 3 Jul 2021 20:56:02 +0200 [thread overview]
Message-ID: <9558b097-7760-beb5-be4d-13e298461e82@gmail.com> (raw)
In-Reply-To: <trinity-131cbf9a-6570-4d3c-8b80-a808d1ad445a-1624567328724@3c-app-mailcom-bs07>
Hi Nora,
On 6/24/21 10:42 PM, Nora Platiel wrote:
> Hello,
> I'm reporting a problem with the execve(2) man page (see the "absolute pathname" part):
>
>> If the pathname argument of execve() specifies an interpreter
>> script, then interpreter will be invoked with the following
>> arguments:
>>
>> interpreter [optional-arg] pathname arg...
>>
>> where pathname is the absolute pathname of the file specified as
>> ^^^^^^^^^^^^^^^^^
>> the first argument of execve(), and arg... is the series of
>> words pointed to by the argv argument of execve(), starting at
>> argv[1]. Note that there is no way to get the argv[0] that was
>> passed to the execve() call.
>
> Then in the final example:
>
>> $ ./execve ./script
>> argv[0]: ./myecho
>> argv[1]: script-arg
>> argv[2]: ./script
>> argv[3]: hello
>> argv[4]: world
>
> According to the description, argv[2] is supposed to be the *absolute pathname* of "./script" but it is not.
> (In path_resolution(7), an absolute pathname is defined to be a pathname starting with a '/' character.)
>
> I tested the example with kernel 4.4.246 and the output is the same as the one in the man page (relative paths are preserved).
> I don't know about newer kernels, but if I understand correctly, either the "absolute pathname" wording is incorrect or the example is.
> (In the latter case, perhaps the man page could also mention the change in behavior.)
>
> The "absolute pathname" wording was introduced here:
> https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=60f16bf2fe6bd2d2d001d0a41936e778b1e7e3f6
> https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=63059c4b527d0da73666da5ff29dcc902e219371
Thanks for all of the info and links.
I think you're right. In fact, POSIX talks about pathname, and not
absolute pathname
(<https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html>).
However, the kernel documentation talks about 'full path', so I'm not
sure if maybe some versions of the kernel did not support relative paths
(<https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html>).
I added Shawn to the thread, so maybe he can shed some light (he added
that text).
Regards,
Alex
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
next prev parent reply other threads:[~2021-07-03 18:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-24 20:42 execve(2) man page: "absolute pathname" inconsistency Nora Platiel
2021-06-25 10:33 ` AW: " Walter Harms
2021-06-26 23:09 ` Nora Platiel
2021-07-03 18:56 ` Alejandro Colomar (man-pages) [this message]
[not found] ` <1778431625342219@mail.yandex.com>
2021-07-15 16:09 ` Nora Platiel
2021-07-17 12:28 ` Alejandro Colomar (man-pages)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9558b097-7760-beb5-be4d-13e298461e82@gmail.com \
--to=alx.manpages@gmail.com \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=nplatiel@gmx.us \
--cc=shawn@git.icu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).