Re: git: 67ce8cec004c - main - Mk/Scripts: Fix the 'stripped' check from 'make check-plist' to report all unstripped files

From: Mathieu Arnold <mat_at_freebsd.org>
Date: Fri, 02 Jun 2023 07:11:49 UTC
On Fri, Jun 02, 2023 at 06:45:31AM +0000, Yuri Victorovich wrote:
> The branch main has been updated by yuri:
> 
> URL: https://cgit.FreeBSD.org/ports/commit/?id=67ce8cec004c85caeee5a6e965bd10f872e1b895
> 
> commit 67ce8cec004c85caeee5a6e965bd10f872e1b895
> Author:     Yuri Victorovich <yuri@FreeBSD.org>
> AuthorDate: 2023-06-02 06:40:46 +0000
> Commit:     Yuri Victorovich <yuri@FreeBSD.org>
> CommitDate: 2023-06-02 06:45:29 +0000
> 
>     Mk/Scripts: Fix the 'stripped' check from 'make check-plist' to report all unstripped files
>     
>     Prior to this patch, the 'stripped' check always skipped the first
>     unstripped file.
>     
>     It uses the "find [...] -exec sh -c 'readelf -S -- /dev/null $0 "$@" || :' -- {} +"
>     command. When arguments are passed to shell like this:
>     "sh -c 'script' arg1 arg2 arg3" - $@ within the script is assigned
>     to 'arg2 arg3', and $0 is assigned to arg1. This is a quirk in
>     how shells handle arguments in case when the script is passed
>     using -c.
>     
>     This patch adds $0 to account for the first passed file.

So, you are right, when you run `sh -c 'script' arg1 arg2 arg3`, arg1 is
in $0, and arg2 and arg3 are in $@.

Now, here, we are running `sh -c 'script' -- arg1 arg2 arg3`, so, $0
contains `--`, and arg1-3 are in $@.

> -	    -exec sh -c 'readelf -S -- /dev/null "$@" || :' -- {} + 2>/dev/null | awk '
> +	    -exec sh -c 'readelf -S -- /dev/null $0 "$@" || :' -- {} + 2>/dev/null | awk '

If the patch was correct, you would need to quote "$0".

But as I pointed out, it is not correct, so please revert.

-- 
Mathieu Arnold