Mail Archives: djgpp-workers/2001/04/23/11:09:46
Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
| On 22 Apr 2001, Jim Meyering wrote:
|
| > If I understand, those problems are all because a program invoked
| > like `mv a b' will get argv[0] set to ../../src/mv. Is that true?
|
| That's one possibility, yes. It's also possible to get the full
| absolute file name in argv[0], as in "c:/foo/bar/bin/mv.exe".
|
| > If so, I wonder if that's a problem with the way djgpp's bash calls exec.
|
| It's not a Bash problem, it's a ``feature'' of the DOS system call
| which loads and executes a program: you always get leading directories
| in argv[0]. Bash cannot work around this.
|
| I don't think Posix mandates that argv[0] should not include leading
| directories. I think some Unix shells do produce argv[0] similar to
| ../../src/mv. So I think it would be good for Fetish test suites not
| to depend on the exact form of argv[0] too much.
Changing the test suite so it accommodates this behavior would be a pain.
In the latest test release of the fileutils, there are many more than the
three that were affected in 4.0.
I haven't seen the losing behavior on any Unix system.
It'd sure be nice if Windows would join the modern world...
I'm not sure if the following (from the d6 draft) is a real requirement,
but it certainly seems to discourage what DOS/Windows does.
The requirement on a Strictly Conforming POSIX Application also states
that the value passed as the first argument be a filename associated
with the process being started. Although some existing applications pass
a pathname rather than a filename in some circumstances, a filename
is more generally useful, since the common usage of argv[0] is in
printing diagnostics. In some cases the filename passed is not the
actual filename of the file; for example, many implementations of the
login utility use a convention of prefixing a hyphen ('-') to the actual
filename, which indicates to the command interpreter being invoked that
it is a ``login shell''. Some implementations can exec shell scripts.
- Raw text -