emacs-devel
[Top][All Lists]
Advanced

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

Re: Finding the dump


From: Paul Eggert
Subject: Re: Finding the dump
Date: Wed, 30 Jan 2019 18:21:09 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

On 1/29/19 12:50 AM, Richard Stallman wrote:
   > When doing that, please consider the scenario where argv[0] does not
   > have a directory part (i.e., does not have a '/' in POSIX). In this case
   > in the past it has been reasonably common for argv[0] to not identify
   > the executable that would be found by searching PATH for a file with
   > that name, either because PATH itself has changed since the parent did
   > the search, or because the program is being executed in a chrooted jail,
   > or for some other reason. If this usage need not be supported by GNU
   > programs it would be helpful to have that clearly stated.

The case exists, but is there anything to be said about it there?
I don't see anything.

Perhaps you could write something like the following?

Sometimes it is convenient for a program to determine the name of the file used to execute the program, in order to re-execute the program or to find other files near the executable file. In general argv[0] is not a reliable way to do this, as a program's invoker can set argv[0] to any string. In practice, if argv[0] contains a slash it normally names the executable; otherwise, for various reasons it might not name the executable even after searching through the directories named in the PATH environment variable. In any case if a program needs its installation location it is good practice to let the user specify it in some other way, such as via a command-line argument.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]