diff mbox

[SRU,J,J:linux-bluefield,0/1] scripts/pahole-flags.sh change return to exit 0

Message ID 20230928022501.14072-1-matthew.ruffell@canonical.com
State New
Headers show

Commit Message

Matthew Ruffell Sept. 28, 2023, 2:25 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/2035123

[Impact]

When building the Jammy linux-bluefield kernel tree on a system without pahole
installed, the following warning is emitted:

./scripts/pahole-flags.sh: line 7: return: can only `return' from a function or
sourced script

scripts/pahole-flags.sh attempts to return from an if statement that is not
within a function, and generates a warning.

The fix is straightforward, changing return to an exit 0.


Clone the linux-bluefield kernel tree and build it on a arm64 system without
pahole installed.

A test kernel is available with the fix applied in:

https://launchpad.net/~mruffell/+archive/ubuntu/sf368560-test

Both linux-bluefield and ubuntu-jammy build correctly.

[Fix]

This was fixed by Linus Torvalds in the following merge commit:

commit fc02cb2b37fe2cbf1d3334b9f0f0eab9431766c4
Merge: bfc484fe6abb 84882cf72cd7
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Tue Nov 2 06:20:58 2021 -0700
Subject: Merge tag 'net-next-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc02cb2b37fe2cbf1d3334b9f0f0eab9431766c4

Note, the original commit does not have the fix included:

commit 9741e07ece7c247dd65e1aa01e16b683f01c05a8
Author: Jiri Olsa <jolsa@redhat.com>
Date:   Fri Oct 29 14:57:29 2021 +0200
Subject: kbuild: Unify options for BTF generation for vmlinux and modules
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9741e07ece7c247dd65e1aa01e16b683f01c05a8

The Ubuntu kernel cherry-picked the original commit and did not pick up the 
silent fix made in the merge commit. Submitting the silent fix as a SAUCE patch 
with changelog describing the change.

Note: I know SAUCE patches are bad, but in this scenario, to revert the initial
commit and re-apply the fixed version would require us to revert two additional
dependency commits, making six patches to review, vs, a one line change in a
SAUCE commit that has a real changelog entry.

[Where problems could occur]

The Ubuntu kernel is built with pahole enabled, and requires pahole to be 
installed as a build dependency. It is extremely unlikely that any users are 
disabling pahole at build time, apart from linux-bluefield engineers.

If a regression were to occur, engineers would see errors during build time
about scripts/pahole-flags.sh not executing properly.

[Other info]

Linus remarked about the issue in the following lkml discussion:

https://lore.kernel.org/lkml/CAHk-=wgdE6=ob5nF60GvRYAG24MKaJBGJf3jPufMe1k_UPBQTA@mail.gmail.com/
https://lore.kernel.org/lkml/CAHk-=wgPZM4bN=LUCrMkG3FX808QSLm6Uv6ixm5P350_7c=xUw@mail.gmail.com/

This was silently Incorporated into the linux-stable commit:

commit 0baced0e0938f2895ceba54038eaf15ed91032e7 5.15.y
From: Jiri Olsa <jolsa@redhat.com>
Date: Sun, 4 Sep 2022 15:19:00 +0200
Subject: kbuild: Unify options for BTF generation for vmlinux and modules
Link: https://github.com/gregkh/linux/commit/0baced0e0938f2895ceba54038eaf15ed91032e7

Matthew Ruffell (1):
  UBUNTU: SAUCE: scripts/pahole-flags.sh change return to exit 0

 scripts/pahole-flags.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tim Gardner Sept. 28, 2023, 2:08 p.m. UTC | #1
On 9/27/23 8:25 PM, Matthew Ruffell wrote:
> BugLink: https://bugs.launchpad.net/bugs/2035123
> 
> [Impact]
> 
> When building the Jammy linux-bluefield kernel tree on a system without pahole
> installed, the following warning is emitted:
> 
> ./scripts/pahole-flags.sh: line 7: return: can only `return' from a function or
> sourced script
> 
> scripts/pahole-flags.sh attempts to return from an if statement that is not
> within a function, and generates a warning.
> 
> The fix is straightforward, changing return to an exit 0.
> 
> --- a/scripts/pahole-flags.sh
> +++ b/scripts/pahole-flags.sh
> @@ -4,7 +4,7 @@
>   extra_paholeopt=
>   
>   if ! [ -x "$(command -v ${PAHOLE})" ]; then
> -       return
> +       exit 0
>   fi
> 
> [Testcase]
> 
> Clone the linux-bluefield kernel tree and build it on a arm64 system without
> pahole installed.
> 
> A test kernel is available with the fix applied in:
> 
> https://launchpad.net/~mruffell/+archive/ubuntu/sf368560-test
> 
> Both linux-bluefield and ubuntu-jammy build correctly.
> 
> [Fix]
> 
> This was fixed by Linus Torvalds in the following merge commit:
> 
> commit fc02cb2b37fe2cbf1d3334b9f0f0eab9431766c4
> Merge: bfc484fe6abb 84882cf72cd7
> Author: Linus Torvalds <torvalds@linux-foundation.org>
> Date:   Tue Nov 2 06:20:58 2021 -0700
> Subject: Merge tag 'net-next-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc02cb2b37fe2cbf1d3334b9f0f0eab9431766c4
> 
> Note, the original commit does not have the fix included:
> 
> commit 9741e07ece7c247dd65e1aa01e16b683f01c05a8
> Author: Jiri Olsa <jolsa@redhat.com>
> Date:   Fri Oct 29 14:57:29 2021 +0200
> Subject: kbuild: Unify options for BTF generation for vmlinux and modules
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9741e07ece7c247dd65e1aa01e16b683f01c05a8
> 
> The Ubuntu kernel cherry-picked the original commit and did not pick up the
> silent fix made in the merge commit. Submitting the silent fix as a SAUCE patch
> with changelog describing the change.
> 
> Note: I know SAUCE patches are bad, but in this scenario, to revert the initial
> commit and re-apply the fixed version would require us to revert two additional
> dependency commits, making six patches to review, vs, a one line change in a
> SAUCE commit that has a real changelog entry.
> 
> [Where problems could occur]
> 
> The Ubuntu kernel is built with pahole enabled, and requires pahole to be
> installed as a build dependency. It is extremely unlikely that any users are
> disabling pahole at build time, apart from linux-bluefield engineers.
> 
> If a regression were to occur, engineers would see errors during build time
> about scripts/pahole-flags.sh not executing properly.
> 
> [Other info]
> 
> Linus remarked about the issue in the following lkml discussion:
> 
> https://lore.kernel.org/lkml/CAHk-=wgdE6=ob5nF60GvRYAG24MKaJBGJf3jPufMe1k_UPBQTA@mail.gmail.com/
> https://lore.kernel.org/lkml/CAHk-=wgPZM4bN=LUCrMkG3FX808QSLm6Uv6ixm5P350_7c=xUw@mail.gmail.com/
> 
> This was silently Incorporated into the linux-stable commit:
> 
> commit 0baced0e0938f2895ceba54038eaf15ed91032e7 5.15.y
> From: Jiri Olsa <jolsa@redhat.com>
> Date: Sun, 4 Sep 2022 15:19:00 +0200
> Subject: kbuild: Unify options for BTF generation for vmlinux and modules
> Link: https://github.com/gregkh/linux/commit/0baced0e0938f2895ceba54038eaf15ed91032e7
> 
> Matthew Ruffell (1):
>    UBUNTU: SAUCE: scripts/pahole-flags.sh change return to exit 0
> 
>   scripts/pahole-flags.sh | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
Acked-by: Tim Gardner <tim.gardner@canonical.com>

Good sleuthing :)
Bartlomiej Zolnierkiewicz Oct. 16, 2023, 12:07 p.m. UTC | #2
Acked-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz@canonical.com>

On Thu, Sep 28, 2023 at 4:25 AM Matthew Ruffell
<matthew.ruffell@canonical.com> wrote:
>
> BugLink: https://bugs.launchpad.net/bugs/2035123
>
> [Impact]
>
> When building the Jammy linux-bluefield kernel tree on a system without pahole
> installed, the following warning is emitted:
>
> ./scripts/pahole-flags.sh: line 7: return: can only `return' from a function or
> sourced script
>
> scripts/pahole-flags.sh attempts to return from an if statement that is not
> within a function, and generates a warning.
>
> The fix is straightforward, changing return to an exit 0.
>
> --- a/scripts/pahole-flags.sh
> +++ b/scripts/pahole-flags.sh
> @@ -4,7 +4,7 @@
>  extra_paholeopt=
>
>  if ! [ -x "$(command -v ${PAHOLE})" ]; then
> -       return
> +       exit 0
>  fi
>
> [Testcase]
>
> Clone the linux-bluefield kernel tree and build it on a arm64 system without
> pahole installed.
>
> A test kernel is available with the fix applied in:
>
> https://launchpad.net/~mruffell/+archive/ubuntu/sf368560-test
>
> Both linux-bluefield and ubuntu-jammy build correctly.
>
> [Fix]
>
> This was fixed by Linus Torvalds in the following merge commit:
>
> commit fc02cb2b37fe2cbf1d3334b9f0f0eab9431766c4
> Merge: bfc484fe6abb 84882cf72cd7
> Author: Linus Torvalds <torvalds@linux-foundation.org>
> Date:   Tue Nov 2 06:20:58 2021 -0700
> Subject: Merge tag 'net-next-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc02cb2b37fe2cbf1d3334b9f0f0eab9431766c4
>
> Note, the original commit does not have the fix included:
>
> commit 9741e07ece7c247dd65e1aa01e16b683f01c05a8
> Author: Jiri Olsa <jolsa@redhat.com>
> Date:   Fri Oct 29 14:57:29 2021 +0200
> Subject: kbuild: Unify options for BTF generation for vmlinux and modules
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9741e07ece7c247dd65e1aa01e16b683f01c05a8
>
> The Ubuntu kernel cherry-picked the original commit and did not pick up the
> silent fix made in the merge commit. Submitting the silent fix as a SAUCE patch
> with changelog describing the change.
>
> Note: I know SAUCE patches are bad, but in this scenario, to revert the initial
> commit and re-apply the fixed version would require us to revert two additional
> dependency commits, making six patches to review, vs, a one line change in a
> SAUCE commit that has a real changelog entry.
>
> [Where problems could occur]
>
> The Ubuntu kernel is built with pahole enabled, and requires pahole to be
> installed as a build dependency. It is extremely unlikely that any users are
> disabling pahole at build time, apart from linux-bluefield engineers.
>
> If a regression were to occur, engineers would see errors during build time
> about scripts/pahole-flags.sh not executing properly.
>
> [Other info]
>
> Linus remarked about the issue in the following lkml discussion:
>
> https://lore.kernel.org/lkml/CAHk-=wgdE6=ob5nF60GvRYAG24MKaJBGJf3jPufMe1k_UPBQTA@mail.gmail.com/
> https://lore.kernel.org/lkml/CAHk-=wgPZM4bN=LUCrMkG3FX808QSLm6Uv6ixm5P350_7c=xUw@mail.gmail.com/
>
> This was silently Incorporated into the linux-stable commit:
>
> commit 0baced0e0938f2895ceba54038eaf15ed91032e7 5.15.y
> From: Jiri Olsa <jolsa@redhat.com>
> Date: Sun, 4 Sep 2022 15:19:00 +0200
> Subject: kbuild: Unify options for BTF generation for vmlinux and modules
> Link: https://github.com/gregkh/linux/commit/0baced0e0938f2895ceba54038eaf15ed91032e7
>
> Matthew Ruffell (1):
>   UBUNTU: SAUCE: scripts/pahole-flags.sh change return to exit 0
>
>  scripts/pahole-flags.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
Bartlomiej Zolnierkiewicz Oct. 16, 2023, 12:09 p.m. UTC | #3
Applied to jammy:linux-bluefield/master-next. Thanks.

--
Best regards,
Bartlomiej

On Thu, Sep 28, 2023 at 4:25 AM Matthew Ruffell
<matthew.ruffell@canonical.com> wrote:
>
> BugLink: https://bugs.launchpad.net/bugs/2035123
>
> [Impact]
>
> When building the Jammy linux-bluefield kernel tree on a system without pahole
> installed, the following warning is emitted:
>
> ./scripts/pahole-flags.sh: line 7: return: can only `return' from a function or
> sourced script
>
> scripts/pahole-flags.sh attempts to return from an if statement that is not
> within a function, and generates a warning.
>
> The fix is straightforward, changing return to an exit 0.
>
> --- a/scripts/pahole-flags.sh
> +++ b/scripts/pahole-flags.sh
> @@ -4,7 +4,7 @@
>  extra_paholeopt=
>
>  if ! [ -x "$(command -v ${PAHOLE})" ]; then
> -       return
> +       exit 0
>  fi
>
> [Testcase]
>
> Clone the linux-bluefield kernel tree and build it on a arm64 system without
> pahole installed.
>
> A test kernel is available with the fix applied in:
>
> https://launchpad.net/~mruffell/+archive/ubuntu/sf368560-test
>
> Both linux-bluefield and ubuntu-jammy build correctly.
>
> [Fix]
>
> This was fixed by Linus Torvalds in the following merge commit:
>
> commit fc02cb2b37fe2cbf1d3334b9f0f0eab9431766c4
> Merge: bfc484fe6abb 84882cf72cd7
> Author: Linus Torvalds <torvalds@linux-foundation.org>
> Date:   Tue Nov 2 06:20:58 2021 -0700
> Subject: Merge tag 'net-next-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc02cb2b37fe2cbf1d3334b9f0f0eab9431766c4
>
> Note, the original commit does not have the fix included:
>
> commit 9741e07ece7c247dd65e1aa01e16b683f01c05a8
> Author: Jiri Olsa <jolsa@redhat.com>
> Date:   Fri Oct 29 14:57:29 2021 +0200
> Subject: kbuild: Unify options for BTF generation for vmlinux and modules
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9741e07ece7c247dd65e1aa01e16b683f01c05a8
>
> The Ubuntu kernel cherry-picked the original commit and did not pick up the
> silent fix made in the merge commit. Submitting the silent fix as a SAUCE patch
> with changelog describing the change.
>
> Note: I know SAUCE patches are bad, but in this scenario, to revert the initial
> commit and re-apply the fixed version would require us to revert two additional
> dependency commits, making six patches to review, vs, a one line change in a
> SAUCE commit that has a real changelog entry.
>
> [Where problems could occur]
>
> The Ubuntu kernel is built with pahole enabled, and requires pahole to be
> installed as a build dependency. It is extremely unlikely that any users are
> disabling pahole at build time, apart from linux-bluefield engineers.
>
> If a regression were to occur, engineers would see errors during build time
> about scripts/pahole-flags.sh not executing properly.
>
> [Other info]
>
> Linus remarked about the issue in the following lkml discussion:
>
> https://lore.kernel.org/lkml/CAHk-=wgdE6=ob5nF60GvRYAG24MKaJBGJf3jPufMe1k_UPBQTA@mail.gmail.com/
> https://lore.kernel.org/lkml/CAHk-=wgPZM4bN=LUCrMkG3FX808QSLm6Uv6ixm5P350_7c=xUw@mail.gmail.com/
>
> This was silently Incorporated into the linux-stable commit:
>
> commit 0baced0e0938f2895ceba54038eaf15ed91032e7 5.15.y
> From: Jiri Olsa <jolsa@redhat.com>
> Date: Sun, 4 Sep 2022 15:19:00 +0200
> Subject: kbuild: Unify options for BTF generation for vmlinux and modules
> Link: https://github.com/gregkh/linux/commit/0baced0e0938f2895ceba54038eaf15ed91032e7
>
> Matthew Ruffell (1):
>   UBUNTU: SAUCE: scripts/pahole-flags.sh change return to exit 0
>
>  scripts/pahole-flags.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
Stefan Bader Oct. 25, 2023, 2:31 p.m. UTC | #4
On 28.09.23 04:25, Matthew Ruffell wrote:
> BugLink: https://bugs.launchpad.net/bugs/2035123
> 
> [Impact]
> 
> When building the Jammy linux-bluefield kernel tree on a system without pahole
> installed, the following warning is emitted:
> 
> ./scripts/pahole-flags.sh: line 7: return: can only `return' from a function or
> sourced script
> 
> scripts/pahole-flags.sh attempts to return from an if statement that is not
> within a function, and generates a warning.
> 
> The fix is straightforward, changing return to an exit 0.
> 
> --- a/scripts/pahole-flags.sh
> +++ b/scripts/pahole-flags.sh
> @@ -4,7 +4,7 @@
>   extra_paholeopt=
>   
>   if ! [ -x "$(command -v ${PAHOLE})" ]; then
> -       return
> +       exit 0
>   fi
> 
> [Testcase]
> 
> Clone the linux-bluefield kernel tree and build it on a arm64 system without
> pahole installed.
> 
> A test kernel is available with the fix applied in:
> 
> https://launchpad.net/~mruffell/+archive/ubuntu/sf368560-test
> 
> Both linux-bluefield and ubuntu-jammy build correctly.
> 
> [Fix]
> 
> This was fixed by Linus Torvalds in the following merge commit:
> 
> commit fc02cb2b37fe2cbf1d3334b9f0f0eab9431766c4
> Merge: bfc484fe6abb 84882cf72cd7
> Author: Linus Torvalds <torvalds@linux-foundation.org>
> Date:   Tue Nov 2 06:20:58 2021 -0700
> Subject: Merge tag 'net-next-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc02cb2b37fe2cbf1d3334b9f0f0eab9431766c4
> 
> Note, the original commit does not have the fix included:
> 
> commit 9741e07ece7c247dd65e1aa01e16b683f01c05a8
> Author: Jiri Olsa <jolsa@redhat.com>
> Date:   Fri Oct 29 14:57:29 2021 +0200
> Subject: kbuild: Unify options for BTF generation for vmlinux and modules
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9741e07ece7c247dd65e1aa01e16b683f01c05a8
> 
> The Ubuntu kernel cherry-picked the original commit and did not pick up the
> silent fix made in the merge commit. Submitting the silent fix as a SAUCE patch
> with changelog describing the change.
> 
> Note: I know SAUCE patches are bad, but in this scenario, to revert the initial
> commit and re-apply the fixed version would require us to revert two additional
> dependency commits, making six patches to review, vs, a one line change in a
> SAUCE commit that has a real changelog entry.
> 
> [Where problems could occur]
> 
> The Ubuntu kernel is built with pahole enabled, and requires pahole to be
> installed as a build dependency. It is extremely unlikely that any users are
> disabling pahole at build time, apart from linux-bluefield engineers.
> 
> If a regression were to occur, engineers would see errors during build time
> about scripts/pahole-flags.sh not executing properly.
> 
> [Other info]
> 
> Linus remarked about the issue in the following lkml discussion:
> 
> https://lore.kernel.org/lkml/CAHk-=wgdE6=ob5nF60GvRYAG24MKaJBGJf3jPufMe1k_UPBQTA@mail.gmail.com/
> https://lore.kernel.org/lkml/CAHk-=wgPZM4bN=LUCrMkG3FX808QSLm6Uv6ixm5P350_7c=xUw@mail.gmail.com/
> 
> This was silently Incorporated into the linux-stable commit:
> 
> commit 0baced0e0938f2895ceba54038eaf15ed91032e7 5.15.y
> From: Jiri Olsa <jolsa@redhat.com>
> Date: Sun, 4 Sep 2022 15:19:00 +0200
> Subject: kbuild: Unify options for BTF generation for vmlinux and modules
> Link: https://github.com/gregkh/linux/commit/0baced0e0938f2895ceba54038eaf15ed91032e7
> 
> Matthew Ruffell (1):
>    UBUNTU: SAUCE: scripts/pahole-flags.sh change return to exit 0
> 
>   scripts/pahole-flags.sh | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

Applied to jammy:linux/master-next. Thanks.

-Stefan
diff mbox

Patch

--- a/scripts/pahole-flags.sh
+++ b/scripts/pahole-flags.sh
@@ -4,7 +4,7 @@ 
 extra_paholeopt=
 
 if ! [ -x "$(command -v ${PAHOLE})" ]; then
-       return
+       exit 0
 fi

[Testcase]