To: Eli Zaretskii Cc: Richard Dawe , DJGPP workers Subject: Re: (Fileutils) More test suite & Fetish.pm problems References: In-Reply-To: (Eli Zaretskii's message of "Mon, 23 Apr 2001 13:27:34 +0300 (IDT)") From: Jim Meyering Date: 23 Apr 2001 12:55:54 +0200 Message-ID: Lines: 39 User-Agent: Gnus/5.090003 (Oort Gnus v0.03) Emacs/21.0.103 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: Jim Meyering Reply-To: djgpp-workers AT delorie DOT com Eli Zaretskii 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.