Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
rust postinst failed Expected exactly two files but found 1.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9838
Location: almost Mile High in the USA

PostPosted: Wed Nov 27, 2024 4:41 pm    Post subject: rust postinst failed Expected exactly two files but found 1. Reply with quote

I tried re-running and appears to have succeeded the second time but this was highly odd:
Code:
>>> Completed installing dev-lang/rust-1.80.1-r100 into /tmp/portage/dev-lang/rust-1.80.1-r100/image

 * Final size of build directory: 11271812 KiB ( 10.7 GiB)
 * Final size of installed tree:    431924 KiB (421.8 MiB)

 * QA Notice: The ebuild is installing to one or more unexpected directories:
 *
 *   /usr/share/doc/rust-1.80.1
 *
 * Please fix the ebuild to use correct FHS/Gentoo policy paths.
strip: x86_64-pc-linux-gnu-strip --strip-unneeded -N __gentoo_check_ldflags__ -R .comment -R .GCC.command.line -R .note.gnu.gold-version
   /usr/lib/rust/1.80.1/bin/rustc
   /usr/lib/rust/1.80.1/bin/rustc-1.80.1
   /usr/lib/rust/1.80.1/lib/rustlib/i686-unknown-linux-gnu/lib/libstd-0c48060941855a6c.so
   /usr/lib/rust/1.80.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-aa35babf0b4bbde6.so
   /usr/lib/rust/1.80.1/bin/rustdoc
   /usr/lib/rust/1.80.1/bin/rustdoc-1.80.1
   /usr/lib/rust/1.80.1/lib/librustc_driver-06db74bcd3736db8.so
   /usr/lib/rust/1.80.1/lib/libstd-aa35babf0b4bbde6.so
   /usr/lib/rust/1.80.1/bin/cargo-1.80.1
   /usr/lib/rust/1.80.1/bin/cargo
 * Found old .rlib and .so files in the old rust lib directory
 * ERROR: dev-lang/rust-1.80.1-r100::gentoo failed (postinst phase):
 *   Expected exactly two files matching /usr/lib/rust/1.80.1/lib/rustlib/i686-unknown-linux-gnu/lib/libcore-\*.rlib, but found 1
 *
 * Call stack:
 *     ebuild.sh, line 136:  Called pkg_postinst

Not sure what to make of the error since I can't reproduce and no longer have the full build log. Perhaps just look the other way?
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Kangie
Developer
Developer


Joined: 21 May 2023
Posts: 5
Location: Brisbane, Australia

PostPosted: Wed Nov 27, 2024 9:51 pm    Post subject: Reply with quote

How interesting.

You seem to have hit an edge case in my attempt to work around breakage where `--keep-going` combined with a build failure could result in installing two copies of rust with the same version over the top of each other, but would leave the old copy installed (the uninstall action doesn't run until the next depclean).

The error here is that we attempt work around that in postinst, however if we don't find a match for a file (in this case we should find two files that match `/usr/lib/rust/1.80.1/lib/rustlib/i686-unknown-linux-gnu/lib/libcore-*`) we bail out rather than continue removing files.

I can't see a reason for you to have encountered this; libcore is not optional. We generate the list of files in preinst so we know it used to exist. Maybe you had a hash collision? Seems very unlikely but it's the best guess I have right now.

Code:
$ equery f dev-lang/rust:1.80.1 | grep -i libcore
/usr/lib/rust/1.80.1/lib/rustlib/i686-unknown-linux-gnu/lib/libcore-df5993c644c6a958.rlib
/usr/lib/rust/1.80.1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-ccfb3e0972f09e06.rlib



I've just noticed that we say rlib when we also check for a few so files; I should update that.

Long term this needs to be fixed in Portage when someone has time to investigate. Related bugs:
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9838
Location: almost Mile High in the USA

PostPosted: Thu Nov 28, 2024 6:27 am    Post subject: Reply with quote

As a personal note that might be helpful for others is that I was running --jobs=4 and indeed with --keep-going on my 10 core machine machine with distcc enabled. The first time around it gave up trying to --resume but it was able to finish when restarting emerge from the top.

The actions regarding the -r100 was weird and I think it eventually depcleaned.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
undrwater
Guru
Guru


Joined: 28 Jan 2003
Posts: 314
Location: Caucasia

PostPosted: Sat Nov 30, 2024 6:53 am    Post subject: Reply with quote

If there is interest, I have a full log of a very similar error, but not the exact one. Mine ends with:

Code:
* Removing old .rlib file /usr/lib/rust/1.81.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libsysroot-db2bd41680f067c1.rlib
 * ERROR: dev-lang/rust-1.81.0-r100::gentoo failed (postinst phase):
 *   Expected exactly two files matching /usr/lib/rust/1.81.0/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-\*.rlib, but found 1


Paste is here: http://0x0.st/XREQ.log
_________________
Open-mindedness is painful...
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9838
Location: almost Mile High in the USA

PostPosted: Sat Nov 30, 2024 4:59 pm    Post subject: Reply with quote

Were you also using --jobs and --keep-going? Happen to know what was running at the time of failure perhaps?

At least we can probably assume that this is not a hash collision, I don't think hash collisions could happen this frequently?
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
undrwater
Guru
Guru


Joined: 28 Jan 2003
Posts: 314
Location: Caucasia

PostPosted: Sun Dec 01, 2024 11:25 pm    Post subject: Reply with quote

eccerr0r wrote:
Were you also using --jobs and --keep-going? Happen to know what was running at the time of failure perhaps?

At least we can probably assume that this is not a hash collision, I don't think hash collisions could happen this frequently?


It looks like I was not using --jobs or --keep-going.

It is a home server, so some services etc were running at the same time. No parallel ebuilds or anything like that.
_________________
Open-mindedness is painful...
Back to top
View user's profile Send private message
Kangie
Developer
Developer


Joined: 21 May 2023
Posts: 5
Location: Brisbane, Australia

PostPosted: Thu Dec 05, 2024 9:52 pm    Post subject: Reply with quote

To close the loop here, it seems that fingerprints on rust libraries are not as unique as I had assumed. The ebuilds have been updated to show the apparent hash collisions but will continue in that case now.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum