lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 29 Mar 2023 22:02:20 +0200
From:   Nicolas Schier <nicolas@...sle.eu>
To:     Masahiro Yamada <masahiroy@...nel.org>
Cc:     linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>
Subject: Re: [PATCH] kbuild: fix package build error due to broken symlinks

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@...nel.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@...sle.eu>

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ