public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Schier <nicolas@fjasle.eu>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH] kbuild: fix package build error due to broken symlinks
Date: Wed, 29 Mar 2023 22:02:20 +0200	[thread overview]
Message-ID: <ZCSZTLjhLshLBKWM@bergen.fjasle.eu> (raw)
In-Reply-To: <20230325141909.2512452-1-masahiroy@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2240 bytes --]

On Sat 25 Mar 2023 23:19:09 GMT, Masahiro Yamada wrote:
> 'make deb-pkg' and 'make rpm-pkg' fail if a broken symlink exists in
> a dirty source tree. Handle symlinks properly, and also, keep the
> executable permission.
> 
> Fixes: 05e96e96a315 ("kbuild: use git-archive for source package creation")
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  scripts/package/gen-diff-patch | 36 +++++++++++++++++++++++++---------
>  1 file changed, 27 insertions(+), 9 deletions(-)
> 
> diff --git a/scripts/package/gen-diff-patch b/scripts/package/gen-diff-patch
> index f842ab50a780..23551de92e1b 100755
> --- a/scripts/package/gen-diff-patch
> +++ b/scripts/package/gen-diff-patch
> @@ -23,16 +23,34 @@ fi
>  git -C ${srctree} status --porcelain --untracked-files=all |
>  while read stat path
>  do
> -	if [ "${stat}" = '??' ]; then
> -
> -		if ! diff -u /dev/null "${srctree}/${path}" > .tmp_diff &&
> -			! head -n1 .tmp_diff | grep -q "Binary files"; then
> -			{
> -				echo "--- /dev/null"
> -				echo "+++ linux/$path"
> -				cat .tmp_diff | tail -n +3
> -			} >> ${untracked_patch}
> +	if [ "${stat}" != '??' ]; then
> +		continue
> +	fi
> +
> +	if [ -L "${path}" ]; then
> +		{
> +			echo "diff --git a/${path} b/${path}"
> +			echo "new file mode 120000"
> +			echo "--- /dev/null"
> +			echo "+++ b/$path"
> +			echo "@@ -0,0 +1 @@"
> +			printf "+"; readlink ${path}

Better quote "${path}"?

> +			echo '\ No newline at end of file'
> +		} >> ${untracked_patch}

Here quoting should not be necessary as mkdebian and mkspec give only 
save filenames, but for consistency I'd quote ${untracked_patch} as 
well.

> +	elif ! diff -u /dev/null "${srctree}/${path}" > .tmp_diff &&
> +	     ! head -n1 .tmp_diff | grep -q "Binary files"; then
> +		if [ -x ${path} ]; then

Same here.

> +			mode=100755
> +		else
> +			mode=100644
>  		fi
> +		{
> +			echo "diff --git a/${path} b/${path}"
> +			echo "new file mode ${mode}"
> +			echo "--- /dev/null"
> +			echo "+++ b/$path"
> +			cat .tmp_diff | tail -n +3
> +		} >> ${untracked_patch}

And possibly here?

>  	fi
>  done
>  
> -- 
> 2.34.1

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-03-29 20:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-25 14:19 [PATCH] kbuild: fix package build error due to broken symlinks Masahiro Yamada
2023-03-29 20:02 ` Nicolas Schier [this message]
2023-04-01 14:55   ` Masahiro Yamada
2023-04-01 17:53     ` Nicolas Schier
2023-04-02  2:13       ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZCSZTLjhLshLBKWM@bergen.fjasle.eu \
    --to=nicolas@fjasle.eu \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox