>>>>> On Sun, 09 Oct 2022 15:23:14 +0200, Christian Schoenebeck said: > > On Sonntag, 9. Oktober 2022 00:47:41 CEST Paul Eggert wrote: > > Looks like you're using a shell that invokes 'tar' and passes the > > fully-qualified file name as argv[0]. You might try using a shell that > > doesn't do that; 'tar' (and most other programs) expect $0 to be the > > name used to invoke the program. > > I just had a glimpse at this, but yeah, seems Paul is right. > > The test (e.g. tests/opcomp01.at) fails because it compares the actually > generated error message *exactly* with the expected error message, i.e.: > > Expected error message: > > tar: '--occurrence' cannot be used with '-c' > Try 'tar --help' or 'tar --usage' for more information. > > Actual error message: > > /home/arthur/cpu2017/tools/src/tar-1.28/src/tar: '--occurrence' cannot be > used with '-c' > Try '/home/arthur/cpu2017/tools/src/tar-1.28/src/tar --help' or > '/home/arthur/cpu2017/tools/src/tar-1.28/src/tar --usage' for more > information.
Yes, the test suite is assuming that. > So Paul's point was argv[0] should not be the fully qualified path to the > `tar` binary. POSIX says [1]: > > "The argument arg0 should point to a filename string that is associated with > the process being started by one of the exec functions." No, that is specific to execlp() and execvp() in [1]: "In the cases where the other members of the exec family of functions would fail and set errno to [ENOEXEC], the execlp() and execvp() functions shall execute a command interpreter and the environment of the executed command shall be as if the process invoked the sh utility using execl() as follows: execl(<shell path>, arg0, file, arg1, ..., (char *)0); " There is no requirement for argv[0] to be just the filename in other cases. In fact, [1] says: "When a C-language program is executed as a result of a call to one of the exec family of functions, it shall be entered as a C-language function call as follows: int main (int argc, char *argv[]); " [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html __Martin