cargo icon indicating copy to clipboard operation
cargo copied to clipboard

Load `libsecret` by its `SONAME`, `libsecret-1.so.0`

Open cuviper opened this issue 1 year ago • 2 comments

The library name libsecret-1.so is only found in -dev or -devel packages on many distros, and it's usually only a symlink. For example, this is what I have on Fedora:

/usr/lib64/libsecret-1.so -> libsecret-1.so.0
/usr/lib64/libsecret-1.so.0 -> libsecret-1.so.0.0.0
/usr/lib64/libsecret-1.so.0.0.0

$ rpm -qf /usr/lib64/libsecret*
libsecret-devel-0.21.4-2.fc40.x86_64
libsecret-0.21.4-2.fc40.x86_64
libsecret-0.21.4-2.fc40.x86_64

The middle libsecret-1.so.0 filename matches the actual SONAME in the library, which you can see with readelf -d, and this is what programs built directly against this library will use. It's a better choice for dynamic loaders too, so devel packages aren't needed.

cuviper avatar May 17 '24 23:05 cuviper

r? @weihanglo

rustbot has assigned @weihanglo. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rustbot avatar May 17 '24 23:05 rustbot

I see that #12518 was tested on Arch -- its libsecret is all one package for devel and runtime.

cuviper avatar May 17 '24 23:05 cuviper

Just check ArchLinux and yes it should be compatible.

[root@5dbfc70bf9f7 lib]# ls -l /usr/lib/libsecret*
lrwxrwxrwx 1 root root     16 Feb 23 18:02 /usr/lib/libsecret-1.so -> libsecret-1.so.0
lrwxrwxrwx 1 root root     20 Feb 23 18:02 /usr/lib/libsecret-1.so.0 -> libsecret-1.so.0.0.0
-rwxr-xr-x 1 root root 383008 Feb 23 18:02 /usr/lib/libsecret-1.so.0.0.0
[root@5dbfc70bf9f7 lib]# readelf -d /usr/lib/libsecret-1.so | grep SONAME
 0x000000000000000e (SONAME)             Library soname: [libsecret-1.so.0]

We should have some container tests for this dlopen integration (and credential providers in general), though no need to block this PR.

weihanglo avatar May 20 '24 16:05 weihanglo

@bors r+

weihanglo avatar May 20 '24 16:05 weihanglo

:pushpin: Commit 4ee7b9c260e8fddf614b904616399be31b931b10 has been approved by weihanglo

It is now in the queue for this repository.

bors avatar May 20 '24 16:05 bors

:hourglass: Testing commit 4ee7b9c260e8fddf614b904616399be31b931b10 with merge bb6e446067d436acd14dda163f269cb295051e98...

bors avatar May 20 '24 16:05 bors

:sunny: Test successful - checks-actions Approved by: weihanglo Pushing bb6e446067d436acd14dda163f269cb295051e98 to master...

bors avatar May 20 '24 17:05 bors