[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GNU tar 1.28] testsuite: 5 6 7 8 9 12 15 20 33 40 41 42 47 57 60 63
From: |
Martin Simmons |
Subject: |
Re: [GNU tar 1.28] testsuite: 5 6 7 8 9 12 15 20 33 40 41 42 47 57 60 63 64 65 66 68 71 73 75 76 85 87 89 90 94 failed |
Date: |
Mon, 10 Oct 2022 11:15:24 +0100 |
>>>>> 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