diff mbox series

rpm: disable the RPM 6 script interpreter dependency generator

Message ID 20261022084635.3702905-1-roshs@qti.qualcomm.com
State Changes Requested
Headers show
Series rpm: disable the RPM 6 script interpreter dependency generator | expand

Commit Message

Roshan Sivakumar Oct. 22, 2026, 8:46 a.m. UTC
RPM 4 generated dependencies with the external __find_requires /
__find_provides generator, which OE disabled entirely via
_use_internal_dependency_generator 0. RPM 6 removed that mechanism; for
v6-format packages only the internal fileattr generators run.

rpm's script.attr generator therefore runs for the first time in OE
builds. For every packaged executable whose first line is a #! shebang
it emits an interpreter dependency. kernel-devsrc ships
scripts/mksysmap (#!/bin/sed -f) as an executable, so its package gains:

  Requires: /bin/sed

OE manages build and runtime dependencies explicitly through
DEPENDS / RDEPENDS and does not want these. They break real use cases:

- The interpreter path is taken verbatim from the shebang. A #!/bin/sed
  script requires /bin/sed, but under usrmerge the only provider
  (busybox) offers /usr/bin/sed. The literal paths never match and the
  package becomes uninstallable.
- In the SDK the sole interpreter providers (busybox, coreutils, bash,
  perl) are deliberately banned by target-sdk-provides-dummy, so these
  auto-generated requires make -dev/-src packages uninstallable during
  do_populate_sdk ("nothing provides /bin/sed needed by kernel-devsrc").
- The requires are non-reproducible: they are only emitted when the
  interpreter is scanned from the shebang during packaging, so the same
  recipe can produce different packages between the reproducible A and
  B builds.

This is the same class of regression already handled for the pkgconfig
generator; see "rpm: disable the RPM 6 pkgconfig dependency generator".

Suppressing the generator from the rpmbuild command line
(__requires_exclude / __script_requires set to %{nil}) is not reliable:
rpm reloads the fileattr macros during dependency generation and
clobbers the --define. Remove script.attr and its helper script.req
from rpm's install lists via a source patch. This changes
do_unpack/do_patch, so the whole rpm recipe and everything downstream
re-hash and no stale rpm-native is reused.

Signed-off-by: Roshan Sivakumar <roshs@qti.qualcomm.com>
---
 ...he-script-interpreter-dependency-gen.patch | 72 +++++++++++++++++++
 meta/recipes-devtools/rpm/rpm_6.0.2.bb        |  1 +
 2 files changed, 73 insertions(+)
 create mode 100644 meta/recipes-devtools/rpm/files/0004-Do-not-install-the-script-interpreter-dependency-gen.patch

Comments

Peter Kjellerstedt Oct. 22, 2026, 12:19 p.m. UTC | #1
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Roshan Sivakumar via lists.openembedded.org
> Sent: den 22 oktober 2026 10:47
> To: openembedded-core@lists.openembedded.org
> Cc: Sumanth Gavini <sumanth.gavini@windriver.com>; Roshan Sivakumar <roshs@qti.qualcomm.com>
> Subject: [OE-core][PATCH] rpm: disable the RPM 6 script interpreter dependency generator
> 
> RPM 4 generated dependencies with the external __find_requires /
> __find_provides generator, which OE disabled entirely via
> _use_internal_dependency_generator 0. RPM 6 removed that mechanism; for
> v6-format packages only the internal fileattr generators run.
> 
> rpm's script.attr generator therefore runs for the first time in OE
> builds. For every packaged executable whose first line is a #! shebang
> it emits an interpreter dependency. kernel-devsrc ships
> scripts/mksysmap (#!/bin/sed -f) as an executable, so its package gains:
> 
>   Requires: /bin/sed
> 
> OE manages build and runtime dependencies explicitly through
> DEPENDS / RDEPENDS and does not want these. They break real use cases:

I am not sure about the explicitly part. AFAIK, installed scripts with a 
#!/bin/bash shebang leads to an automatic dependency on bash. Whether it 
is RPM and/or bitbake doing that, I don't know.

> 
> - The interpreter path is taken verbatim from the shebang. A #!/bin/sed
>   script requires /bin/sed, but under usrmerge the only provider
>   (busybox) offers /usr/bin/sed. The literal paths never match and the
>   package becomes uninstallable.
> - In the SDK the sole interpreter providers (busybox, coreutils, bash,
>   perl) are deliberately banned by target-sdk-provides-dummy, so these
>   auto-generated requires make -dev/-src packages uninstallable during
>   do_populate_sdk ("nothing provides /bin/sed needed by kernel-devsrc").
> - The requires are non-reproducible: they are only emitted when the
>   interpreter is scanned from the shebang during packaging, so the same
>   recipe can produce different packages between the reproducible A and
>   B builds.
> 
> This is the same class of regression already handled for the pkgconfig
> generator; see "rpm: disable the RPM 6 pkgconfig dependency generator".
> 
> Suppressing the generator from the rpmbuild command line
> (__requires_exclude / __script_requires set to %{nil}) is not reliable:
> rpm reloads the fileattr macros during dependency generation and
> clobbers the --define. Remove script.attr and its helper script.req
> from rpm's install lists via a source patch. This changes
> do_unpack/do_patch, so the whole rpm recipe and everything downstream
> re-hash and no stale rpm-native is reused.
> 
> Signed-off-by: Roshan Sivakumar <roshs@qti.qualcomm.com>
> ---
>  ...he-script-interpreter-dependency-gen.patch | 72 +++++++++++++++++++
>  meta/recipes-devtools/rpm/rpm_6.0.2.bb        |  1 +
>  2 files changed, 73 insertions(+)
>  create mode 100644 meta/recipes-devtools/rpm/files/0004-Do-not-install-the-script-interpreter-dependency-gen.patch
> 
> diff --git a/meta/recipes-devtools/rpm/files/0004-Do-not-install-the-script-interpreter-dependency-gen.patch b/meta/recipes-devtools/rpm/files/0004-Do-not-install-the-script-interpreter-dependency-gen.patch
> new file mode 100644
> index 0000000000..8c3d1769c8
> --- /dev/null
> +++ b/meta/recipes-devtools/rpm/files/0004-Do-not-install-the-script-
> interpreter-dependency-gen.patch
> @@ -0,0 +1,72 @@
> +From: Roshan Sivakumar <roshs@qti.qualcomm.com>
> +Date: Thu, 16 Oct 2026 00:00:00 +0000
> +Subject: [PATCH] Do not install the script interpreter dependency generator
> +
> +RPM 4 generated dependencies with the external __find_requires /
> +__find_provides generator, which OE disabled entirely via
> +_use_internal_dependency_generator 0. RPM 6 removed that mechanism; for
> +v6-format packages only the internal fileattr generators run.
> +
> +rpm's script.attr generator therefore runs for the first time in OE
> +builds. For every packaged executable whose first line is a #! shebang
> +it adds an interpreter dependency, e.g. a kernel-devsrc package shipping
> +scripts/mksysmap (#!/bin/sed -f) gains:
> +
> +  Requires: /bin/sed
> +
> +OpenEmbedded manages build and runtime dependencies explicitly via
> +DEPENDS/RDEPENDS and does not want these. They break real use cases:
> +
> +- The literal interpreter path is taken verbatim from the shebang, so a
> +  #!/bin/sed script requires /bin/sed while the only provider (busybox)
> +  offers /usr/bin/sed under usrmerge. The paths never match and the
> +  package is uninstallable.
> +- In the SDK the sole interpreter providers (busybox, coreutils, bash,
> +  perl) are deliberately banned by target-sdk-provides-dummy, so these
> +  auto-generated requires make -dev/-src packages uninstallable during
> +  do_populate_sdk ("nothing provides /bin/sed").
> +- The requires are non-reproducible: they are only emitted when the
> +  interpreter happens to be scanned from the shebang in the build
> +  sysroot, so the same recipe can produce different packages.
> +
> +This is the same class of problem fixed for pkgconfig.attr; see
> +"rpm: disable the RPM 6 pkgconfig dependency generator".
> +
> +Suppressing the generator from the rpmbuild command line is not
> +reliable: rpm reloads the fileattr macros during dependency generation
> +and clobbers any --define. Remove script.attr and its helper script.req
> +from rpm's install lists via a source patch. This changes
> +do_unpack/do_patch, so the whole rpm recipe and everything downstream
> +re-hash and no stale rpm-native is reused.
> +
> +Upstream-Status: Inappropriate [OE policy: dependencies are managed by
> the build system, not generated by rpmbuild]
> +
> +Signed-off-by: Roshan Sivakumar <roshs@qti.qualcomm.com>
> +---
> + fileattrs/CMakeLists.txt | 2 +-
> + scripts/CMakeLists.txt   | 2 +-
> + 2 files changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/fileattrs/CMakeLists.txt b/fileattrs/CMakeLists.txt
> +--- a/fileattrs/CMakeLists.txt
> ++++ b/fileattrs/CMakeLists.txt
> +@@ -1,6 +1,6 @@
> + install(FILES
> +       debuginfo.attr desktop.attr elf.attr font.attr metainfo.attr
> +       ocaml.attr
> +-      rpm_macro.attr rpm_lua.attr script.attr sysusers.attr usergroup.attr
> ++      rpm_macro.attr rpm_lua.attr sysusers.attr usergroup.attr
> +       DESTINATION ${RPM_CONFIGDIR}/fileattrs
> + )
> +diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
> +--- a/scripts/CMakeLists.txt
> ++++ b/scripts/CMakeLists.txt
> +@@ -6,7 +6,7 @@ install(PROGRAMS
> +       check-buildroot check-rpaths check-rpaths-worker
> +       find-lang.sh find-requires find-provides
> +       ocamldeps.sh
> +-      fontconfig.prov script.req
> ++      fontconfig.prov
> +       rpm_macros_provides.sh
> +       rpmdb_dump rpmdb_load
> +       rpm2cpio.sh tgpg
> diff --git a/meta/recipes-devtools/rpm/rpm_6.0.2.bb b/meta/recipes-devtools/rpm/rpm_6.0.2.bb
> index c27f58a0e8..6c80c839ca 100644
> --- a/meta/recipes-devtools/rpm/rpm_6.0.2.bb
> +++ b/meta/recipes-devtools/rpm/rpm_6.0.2.bb
> @@ -40,6 +40,7 @@ SRC_URI = "git://github.com/rpm-software-management/rpm;protocol=https;branch=rp
>             file://0001-tools-elfdeps.cc-Remove-format-module.patch \
>             file://0001-macros.in-Set-_pkgverify_level-to-digest-as-RCPM-4.2.patch \
>             file://0003-Do-not-install-the-pkgconfig-dependency-generator.patch \
> +           file://0004-Do-not-install-the-script-interpreter-dependency-gen.patch \
>             "
> 
>  PE = "1"
> --
> 2.34.1

//Peter
Roshan Sivakumar Oct. 23, 2026, 7:37 a.m. UTC | #2
I believe this dependency belongs here: openembedded-core/meta/recipes-kernel/linux/kernel-devsrc.bb at master · openembedded/openembedded-core ( https://github.com/openembedded/openembedded-core/blob/master/meta/recipes-kernel/linux/kernel-devsrc.bb#L460 )

RDEPENDS:${PN} += "sed" in the above recipe is the right way to do it?

There should probably be a separate patch to satisfy that dependency.
Roshan Sivakumar Oct. 23, 2026, 7:41 a.m. UTC | #3
>>Replying here again since the previous reply was sent in a separate thread.

I believe this dependency belongs here: openembedded-core/meta/recipes-kernel/linux/kernel-devsrc.bb at master · openembedded/openembedded-core<https://github.com/openembedded/openembedded-core/blob/master/meta/recipes-kernel/linux/kernel-devsrc.bb#L460>

RDEPENDS:${PN} += "sed" in the above recipe is the right way to do it?

There should probably be a separate patch to satisfy that dependency.



Thanks,

Roshan.
diff mbox series

Patch

diff --git a/meta/recipes-devtools/rpm/files/0004-Do-not-install-the-script-interpreter-dependency-gen.patch b/meta/recipes-devtools/rpm/files/0004-Do-not-install-the-script-interpreter-dependency-gen.patch
new file mode 100644
index 0000000000..8c3d1769c8
--- /dev/null
+++ b/meta/recipes-devtools/rpm/files/0004-Do-not-install-the-script-interpreter-dependency-gen.patch
@@ -0,0 +1,72 @@ 
+From: Roshan Sivakumar <roshs@qti.qualcomm.com>
+Date: Thu, 16 Oct 2026 00:00:00 +0000
+Subject: [PATCH] Do not install the script interpreter dependency generator
+
+RPM 4 generated dependencies with the external __find_requires /
+__find_provides generator, which OE disabled entirely via
+_use_internal_dependency_generator 0. RPM 6 removed that mechanism; for
+v6-format packages only the internal fileattr generators run.
+
+rpm's script.attr generator therefore runs for the first time in OE
+builds. For every packaged executable whose first line is a #! shebang
+it adds an interpreter dependency, e.g. a kernel-devsrc package shipping
+scripts/mksysmap (#!/bin/sed -f) gains:
+
+  Requires: /bin/sed
+
+OpenEmbedded manages build and runtime dependencies explicitly via
+DEPENDS/RDEPENDS and does not want these. They break real use cases:
+
+- The literal interpreter path is taken verbatim from the shebang, so a
+  #!/bin/sed script requires /bin/sed while the only provider (busybox)
+  offers /usr/bin/sed under usrmerge. The paths never match and the
+  package is uninstallable.
+- In the SDK the sole interpreter providers (busybox, coreutils, bash,
+  perl) are deliberately banned by target-sdk-provides-dummy, so these
+  auto-generated requires make -dev/-src packages uninstallable during
+  do_populate_sdk ("nothing provides /bin/sed").
+- The requires are non-reproducible: they are only emitted when the
+  interpreter happens to be scanned from the shebang in the build
+  sysroot, so the same recipe can produce different packages.
+
+This is the same class of problem fixed for pkgconfig.attr; see
+"rpm: disable the RPM 6 pkgconfig dependency generator".
+
+Suppressing the generator from the rpmbuild command line is not
+reliable: rpm reloads the fileattr macros during dependency generation
+and clobbers any --define. Remove script.attr and its helper script.req
+from rpm's install lists via a source patch. This changes
+do_unpack/do_patch, so the whole rpm recipe and everything downstream
+re-hash and no stale rpm-native is reused.
+
+Upstream-Status: Inappropriate [OE policy: dependencies are managed by the build system, not generated by rpmbuild]
+
+Signed-off-by: Roshan Sivakumar <roshs@qti.qualcomm.com>
+---
+ fileattrs/CMakeLists.txt | 2 +-
+ scripts/CMakeLists.txt   | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/fileattrs/CMakeLists.txt b/fileattrs/CMakeLists.txt
+--- a/fileattrs/CMakeLists.txt
++++ b/fileattrs/CMakeLists.txt
+@@ -1,6 +1,6 @@
+ install(FILES
+ 	debuginfo.attr desktop.attr elf.attr font.attr metainfo.attr
+ 	ocaml.attr
+-	rpm_macro.attr rpm_lua.attr script.attr sysusers.attr usergroup.attr
++	rpm_macro.attr rpm_lua.attr sysusers.attr usergroup.attr
+ 	DESTINATION ${RPM_CONFIGDIR}/fileattrs
+ )
+diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
+--- a/scripts/CMakeLists.txt
++++ b/scripts/CMakeLists.txt
+@@ -6,7 +6,7 @@ install(PROGRAMS
+ 	check-buildroot check-rpaths check-rpaths-worker
+ 	find-lang.sh find-requires find-provides
+ 	ocamldeps.sh
+-	fontconfig.prov script.req
++	fontconfig.prov
+ 	rpm_macros_provides.sh
+ 	rpmdb_dump rpmdb_load
+ 	rpm2cpio.sh tgpg
diff --git a/meta/recipes-devtools/rpm/rpm_6.0.2.bb b/meta/recipes-devtools/rpm/rpm_6.0.2.bb
index c27f58a0e8..6c80c839ca 100644
--- a/meta/recipes-devtools/rpm/rpm_6.0.2.bb
+++ b/meta/recipes-devtools/rpm/rpm_6.0.2.bb
@@ -40,6 +40,7 @@  SRC_URI = "git://github.com/rpm-software-management/rpm;protocol=https;branch=rp
            file://0001-tools-elfdeps.cc-Remove-format-module.patch \
            file://0001-macros.in-Set-_pkgverify_level-to-digest-as-RCPM-4.2.patch \
            file://0003-Do-not-install-the-pkgconfig-dependency-generator.patch \
+           file://0004-Do-not-install-the-script-interpreter-dependency-gen.patch \
            "
 
 PE = "1"