Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brp-strip fails with Guile objects on Fedora 35 #1765

Closed
lantw44 opened this issue Aug 28, 2021 · 7 comments
Closed

brp-strip fails with Guile objects on Fedora 35 #1765

lantw44 opened this issue Aug 28, 2021 · 7 comments
Assignees

Comments

@lantw44
Copy link

lantw44 commented Aug 28, 2021

Guile 2.2 object files (*.go) are ELF files, but they can't be recognized by strip and shouldn't be stripped. Is there a way to tell RPM to skip these files when stripping? RPM used to skip strip on non-executable files, but it is no longer the case since commit 0ab151a.

To reproduce it, build my guile-bytestructures package on Fedora 35:

make[1]: Leaving directory '/builddir/build/BUILD/bytestructures-1.0.10'
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-ldconfig
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip /usr/bin/strip
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/vector.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/utils.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/union.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/struct.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/string.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/pointer.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/numeric.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/numeric-metadata.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/numeric-data-model.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/numeric-all.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/ffi.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/explicit-endianness.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/cstring-pointer.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/bytevectors.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/bitfields.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile/base.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/guile.go'
/usr/bin/strip: Unable to recognise the format of the input file `/builddir/build/BUILDROOT/guile-bytestructures-1.0.10-1.fc35.x86_64/usr/lib64/guile/2.2/site-ccache/bytestructures/r6/bytevectors.go'
@DemiMarie
Copy link
Contributor

Seems like *.go files should never be stripped. *.go can also be Go source code, and that can’t be stripped either.

@ffesti
Copy link
Contributor

ffesti commented Sep 16, 2021

Go files are not an issue here. Rpmbuild (brp-strip) classifies the files using the file utility and passes everything that is ELF.*, not stripped to the strip utility. One could argue this is an issue in the strip utility - or file. But as a workaround we can exclude *.go files from this procedure.

@ffesti ffesti self-assigned this Sep 16, 2021
@ffesti
Copy link
Contributor

ffesti commented Sep 16, 2021

If there is a way to tell the guile files from normal ELF files by the file output that'd be even better.

@lantw44
Copy link
Author

lantw44 commented Sep 18, 2021

$ file /sbin/ldconfig 
/sbin/ldconfig: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), static-pie linked, BuildID[sha1]=e524d23506ba0c75de1d253087146164328b13b8, for GNU/Linux 3.2.0, stripped
$ file /bin/file 
/bin/file: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a32704f3e43df7519c65f06adf61d4d9bdc549bf, for GNU/Linux 3.2.0, stripped
$ file /bin/gcc
/bin/gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=e3a77ec7634d2b4b939b7fb62d7bcdd3860f17bf, for GNU/Linux 3.2.0, stripped
$ file /usr/lib64/guile/2.2/ccache/ice-9/readline.go 
/usr/lib64/guile/2.2/ccache/ice-9/readline.go: ELF 64-bit LSB shared object, no machine, version 1 (embedded), dynamically linked, with debug_info, not stripped

Is the string no machine good enough for detecting Guile objects?

@DemiMarie
Copy link
Contributor

$ file /sbin/ldconfig 
/sbin/ldconfig: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), static-pie linked, BuildID[sha1]=e524d23506ba0c75de1d253087146164328b13b8, for GNU/Linux 3.2.0, stripped
$ file /bin/file 
/bin/file: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a32704f3e43df7519c65f06adf61d4d9bdc549bf, for GNU/Linux 3.2.0, stripped
$ file /bin/gcc
/bin/gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=e3a77ec7634d2b4b939b7fb62d7bcdd3860f17bf, for GNU/Linux 3.2.0, stripped
$ file /usr/lib64/guile/2.2/ccache/ice-9/readline.go 
/usr/lib64/guile/2.2/ccache/ice-9/readline.go: ELF 64-bit LSB shared object, no machine, version 1 (embedded), dynamically linked, with debug_info, not stripped

Is the string no machine good enough for detecting Guile objects?

Not sure. I would prefer just skipping *.go files entirely.

ffesti added a commit to ffesti/rpm that referenced this issue Sep 21, 2021
as those may be Guile object files. Those are ELF files but cannot be
stripped. This may also exclude other files (like Golang sources) but
that should not be an issue.

Resolves: rpm-software-management#1765
ffesti added a commit to ffesti/rpm that referenced this issue Sep 21, 2021
as strip fails on them (if they are Guile object files).
This adds another layer of protection as *.go files are already filtered
out.

Resolves:  rpm-software-management#1765
@ffesti
Copy link
Contributor

ffesti commented Sep 23, 2021

These changes do both to be on the save side.

On the longer term the question is if the Guile object really should not be stripped. eu-strip should be able to strip those, too. Not sure if we want to switch over to that in general.

lantw44 added a commit to lantw44/copr-rpm-spec that referenced this issue Sep 25, 2021
@ffesti ffesti closed this as completed in ee5d150 Sep 28, 2021
ffesti added a commit that referenced this issue Sep 28, 2021
as strip fails on them (if they are Guile object files).
This adds another layer of protection as *.go files are already filtered
out.

Resolves:  #1765
@DemiMarie
Copy link
Contributor

These changes do both to be on the save side.

On the longer term the question is if the Guile object really should not be stripped. eu-strip should be able to strip those, too. Not sure if we want to switch over to that in general.

Guile is often used as a REPL, so I am not sure if this is a good idea.

mikhailnov pushed a commit to mikhailnov/rpm that referenced this issue Sep 30, 2021
as those may be Guile object files. Those are ELF files but cannot be
stripped. This may also exclude other files (like Golang sources) but
that should not be an issue.

Resolves: rpm-software-management#1765
mikhailnov pushed a commit to mikhailnov/rpm that referenced this issue Sep 30, 2021
as strip fails on them (if they are Guile object files).
This adds another layer of protection as *.go files are already filtered
out.

Resolves:  rpm-software-management#1765
dmnks pushed a commit to dmnks/rpm that referenced this issue Jun 7, 2022
as those may be Guile object files. Those are ELF files but cannot be
stripped. This may also exclude other files (like Golang sources) but
that should not be an issue.

Resolves: rpm-software-management#1765
(cherry picked from commit ee5d150)
dmnks pushed a commit to dmnks/rpm that referenced this issue Jun 7, 2022
as strip fails on them (if they are Guile object files).
This adds another layer of protection as *.go files are already filtered
out.

Resolves:  rpm-software-management#1765
(cherry picked from commit 3161ce3)
dmnks pushed a commit to dmnks/rpm that referenced this issue Jun 7, 2022
as those may be Guile object files. Those are ELF files but cannot be
stripped. This may also exclude other files (like Golang sources) but
that should not be an issue.

Resolves: rpm-software-management#1765
(cherry picked from commit ee5d150)
dmnks pushed a commit to dmnks/rpm that referenced this issue Jun 7, 2022
as strip fails on them (if they are Guile object files).
This adds another layer of protection as *.go files are already filtered
out.

Resolves:  rpm-software-management#1765
(cherry picked from commit 3161ce3)
dmnks pushed a commit to dmnks/rpm that referenced this issue Jun 7, 2022
as those may be Guile object files. Those are ELF files but cannot be
stripped. This may also exclude other files (like Golang sources) but
that should not be an issue.

Resolves: rpm-software-management#1765
(cherry picked from commit ee5d150)
dmnks pushed a commit to dmnks/rpm that referenced this issue Jun 7, 2022
as strip fails on them (if they are Guile object files).
This adds another layer of protection as *.go files are already filtered
out.

Resolves:  rpm-software-management#1765
(cherry picked from commit 3161ce3)
dmnks pushed a commit to dmnks/rpm that referenced this issue Jun 8, 2022
as those may be Guile object files. Those are ELF files but cannot be
stripped. This may also exclude other files (like Golang sources) but
that should not be an issue.

Resolves: rpm-software-management#1765
(cherry picked from commit ee5d150)
dmnks pushed a commit to dmnks/rpm that referenced this issue Jun 8, 2022
as strip fails on them (if they are Guile object files).
This adds another layer of protection as *.go files are already filtered
out.

Resolves:  rpm-software-management#1765
(cherry picked from commit 3161ce3)
dmnks pushed a commit that referenced this issue Jul 1, 2022
as those may be Guile object files. Those are ELF files but cannot be
stripped. This may also exclude other files (like Golang sources) but
that should not be an issue.

Resolves: #1765
(cherry picked from commit ee5d150)
dmnks pushed a commit that referenced this issue Jul 1, 2022
as strip fails on them (if they are Guile object files).
This adds another layer of protection as *.go files are already filtered
out.

Resolves:  #1765
(cherry picked from commit 3161ce3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants