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: Sat, 1 Apr 2023 19:53:21 +0200	[thread overview]
Message-ID: <ZChvkdnWpYkzKKQ5@fjasle.eu> (raw)
In-Reply-To: <CAK7LNAQkKE8X3n6Tyw1oX2g-TsLqpY54yi=ObCHfARdm02Gvyw@mail.gmail.com>

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

On Sat, Apr 01, 2023 at 11:55:44PM +0900 Masahiro Yamada wrote:
> On Thu, Mar 30, 2023 at 5:02 AM Nicolas Schier <nicolas@fjasle.eu> wrote:
> >
> > 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}"?
> 
> 
> Thanks for the suggestion.
> 
> Quoting variables are correct in most cases.
> But, that is not enough to generate a valid
> patch when a file path contains spaces.
> 
> 
> 
> 'git format-patch' produces a patch that
> is accepted by GNU patch and also by dpkg-source.
> 
> I learned a trick from GIT source code.
> 
> 
> If you are interested, what GIT does [1].
> 
> 
> [1] https://github.com/git/git/commit/1a9eb3b9d50367bee8fe85022684d812816fe531

thanks for the pointer, that is really interesting!

Kind regards,
Nicolas


> I will send v2 later, where I made some more efforts
> to fix several corner cases even if that is not perfect.
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> Best Regards
> Masahiro Yamada

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

  reply	other threads:[~2023-04-01 17:53 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
2023-04-01 14:55   ` Masahiro Yamada
2023-04-01 17:53     ` Nicolas Schier [this message]
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=ZChvkdnWpYkzKKQ5@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