FS#39560 - [mkinitcpio] bug in the function add_binary

Attached to Project: Arch Linux
Opened by jim945 (jim945) - Thursday, 20 March 2014, 21:16 GMT
Last edited by Dave Reisner (falconindy) - Saturday, 05 April 2014, 17:59 GMT
Task Type Bug Report
Category Arch Projects
Status Closed
Assigned To Thomas Bächler (brain0)
Dave Reisner (falconindy)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No

Details

Not create recursive symlinks.
Example.
/usr/lib/libEGL.so.1 -> libEGL.so.1.0.0
/usr/lib/libEGL.so.1.0.0 -> /usr/lib/mesa/libEGL.so.1.0.0
This task depends upon

Closed by  Dave Reisner (falconindy)
Saturday, 05 April 2014, 17:59 GMT
Reason for closing:  Fixed
Additional comments about closing:  https://projects.archlinux.org/mkinitcpi o.git/commit/?id=d90c1fb02faa0a5aeca6410 a72d52d53ddf2455e
Comment by Dave Reisner (falconindy) - Friday, 21 March 2014, 00:16 GMT
Well, /usr/lib/libEGL.so.1 should point to /usr/lib/mesa/libEGL.so.1.0.0 -- the mesa package is wrong.

You're right that the logic in add_binary surrounding symlinks is a little strange, though.
Comment by Thomas Bächler (brain0) - Friday, 21 March 2014, 08:58 GMT
How is it "wrong" when the symlink points to another symlink?
Comment by Dave Reisner (falconindy) - Friday, 21 March 2014, 13:40 GMT
In this case? Because we're hand crafting the soname symlinks in the mesa package. Find me a libtool project which links libfoo.so -> libfoo.so.1 -> libfoo.so.1.0.0.

I'm surprised ldconfig is okay with this.
Comment by Thomas Bächler (brain0) - Friday, 21 March 2014, 15:30 GMT
How is that important? There is no guarantee for a binary or library to not be hidden behind several layers of symlinks. There is nothing in any spec that limits the depth of recursion during symlink resolution to a number as small as 1. So I don't understand why this should be a problem with another package, when it is actually a shortcoming in mkinitcpio.

Shouldn't add_file simply resolve symlinks recursively until it hits the real file? Or, alternatively, shouldn't we just ignore symlinks entirely in add_binary or add_file and just dereference during the copy ('install' has no option for this, sadly)?
Comment by Dave Reisner (falconindy) - Friday, 21 March 2014, 15:39 GMT
> How is that important? [...]
I'm opting out of this discussion -- it's not going to lead to anything useful.

> Shouldn't add_file simply resolve symlinks recursively until it hits the real file? Or, alternatively, shouldn't we just ignore symlinks entirely in add_binary or add_file and just dereference during the copy ('install' has no option for this, sadly)?
The latter. add_binary can probably be fixed as simply as:

- add_symlink "$sodep" "$(readlink "$sodep")"
+ add_symlink "$sodep" "$resolved"

add_file doesn't need to be fixed -- install already dereferences symlinks.
Comment by Thomas Bächler (brain0) - Friday, 21 March 2014, 15:50 GMT
> add_file doesn't need to be fixed -- install already dereferences symlinks.

Then why bother with symlinks at all?

if [[ -f $sodep && ! -e $BUILDROOT$sodep ]]; then
add_file "$sodep" "$sodep" "$(stat -Lc %a "$sodep")"
fi

This should "just work". Is there a special reason why /usr/lib/$SONAME must be symlink to /usr/lib/$SONAME.a.b where a.b is some arbitrary magic version number?
Comment by Dave Reisner (falconindy) - Sunday, 23 March 2014, 15:38 GMT
Well, the extra tests aren't necessary since add_file already performs them.

You make an interesting observation though -- because we run ldconfig on the image, we can use that to generate the right symlinks and add_binary can just add the resolved lib.

edit: or not, since mesa decides to use some dir other than /usr/lib.

Loading...