utils.bbclass: Avoid recursive symlink in oe_soinstall
PATCH 1/1 utils.bbclass: Avoid recursive symlink in oe_soinstall
This patch fixes an issue when oe_soinstall function creates non-functional recursive symlinks in case library soname is equal to library real (file) name.
--- meta/classes/utils.bbclass | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
meta/classes/utils.bbclass +6 -2
@@ -25,7 +25,7 @@ oe_soinstall() { libname=`basename $1` case "$libname" in *.so) - bbfatal "oe_soinstall: Shared library must haved versioned filename (e.g. libfoo.so.1.2.3)" + bbfatal "oe_soinstall: Shared library must haved versioned filename (e.g. libfoo.so.1.2.3 instead of libfoo.so)" ;; esac install -m 755 $1 $2/$libname
@@ -33,8 +33,12 @@ oe_soinstall() { if [ -z $sonamelink ]; then bbfatal "oe_soinstall: $libname is missing ELF tag 'SONAME'." fi + if [ "$sonamelink" == "$libname" ]; then + bbwarn "oe_soinstall: $libname soname is equal to real (file) name. Minor version should be added to a real name (e.g. libfoo.so.1.2 instead of libfoo.so.1)" + else + ln -sf $libname $2/$sonamelink + fi solink=`echo $libname | sed -e 's/\.so\..*/.so/'` - ln -sf $libname $2/$sonamelink ln -sf $libname $2/$solink }
Signature · 1 line
2.25.1
Quoted 15 lines · Yevhenii Shchehlov
This patch fixes an issue when
oe_soinstallfunction creates non-functional recursive symlinks in case library soname is equal to library real (file) name.Signed-off-by Yevhenii Shchehlov <[email protected]>--- meta/classes/utils.bbclass | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)meta/classes/utils.bbclass +0
-0
meta/classes/utils.bbclass oe_soinstall() { · line 28
Quoted 5 lines
meta/classes/utils.bbclass +1
-1@@ -25,7 +25,7 @@ oe_soinstall() { libname=`basename $1` case "$libname" in *.so) - bbfatal "oe_soinstall: Shared library must haved versioned filename (e.g. libfoo.so.1.2.3)" + bbfatal "oe_soinstall: Shared library must haved versioned filename (e.g. libfoo.so.1.2.3 instead of libfoo.so)"
This patch look OK but it might be nice to also clean up this error message (and the Example comment a few lines above it) to drop the 3 levels of version number. There should only be 2, ie the fully versioned filename would be libfoo.so.1.2 instead of libfoo.so.1.2.3
meta/classes/utils.bbclass oe_soinstall() { · line 37
Quoted 9 lines
meta/classes/utils.bbclass +2
-0;; esac install -m 755 $1 $2/$libname@@ -33,8 +33,12 @@ oe_soinstall() { if [ -z $sonamelink ]; then bbfatal "oe_soinstall: $libname is missing ELF tag 'SONAME'." fi + if [ "$sonamelink" == "$libname" ]; then + bbwarn "oe_soinstall: $libname soname is equal to real (file) name. Minor version should be added to a real name (e.g. libfoo.so.1.2 instead of libfoo.so.1)"
It might be clearer to say:
"oe_soinstall: $libname soname is equal to fully versioned real (file) name. The soname should include the major version only (e.g. libfoo.so.1 instead of libfoo.so.1.2)"
Quoted 16 lines
meta/classes/utils.bbclass +3
-2+ else + ln -sf $libname $2/$sonamelink + fi solink=`echo $libname | sed -e 's/\.so\..*/.so/'` - ln -sf $libname $2/$sonamelink ln -sf $libname $2/$solink } --2.25.1
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 1 line
This patch look OK but it might be nice to also clean up this error
message (and the Example comment a few lines above it) to drop the 3 levels of version number. There should only be 2, ie the fully versioned filename would be libfoo.so.1.2 instead of libfoo.so.1.2.3
Yeah, sound reasonable. According to the tLDP (
http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html)
there can be be 3 levels, but last one is optional. Quote from tLDP:
*"The real name adds to the soname a period, a minor *
*number, another period, and the release number. The last period and release number are optional". *
So yes, correct fully versioned name should contain at least two numbers
Quoted 1 line
"
oe_soinstall: $libname soname is equal to fully versioned real (file)
name. The soname should include the major version only (e.g.libfoo.so.1 instead of libfoo.so.1.2)"
Good point. But what if library real name is libfoo.so.1 and soname is libfoo.so.1 too? In my opinion there is two ways:
1) Add one more check: parse $sonamelink and throw bbwarn if soname is incorrect. "Incorrect" in this case means that
soname contain more than one version (libfoo.so.1.2)
2) Mention both possible problems in bbwarn. Like: " $libname soname is equal to fully versioned real (file)
name. The soname should include the major version only (e.g. libfoo.so.1 instead of libfoo.so.1.2) or minor version
should be added to library real name (e.g. libfoo.so.1.2 instead of libfoo.so.1) ; "
First one is definitely clearer. So I'm going to implement it and send version 2 of patch
Quoted 66 lines · Andre McCurdy
Quoted 15 lines · Yevhenii Shchehlov
This patch fixes an issue when
oe_soinstallfunction creates non-functional recursive symlinks in case library soname is equal to library real (file) name.Signed-off-by Yevhenii Shchehlov <[email protected]>--- meta/classes/utils.bbclass | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)meta/classes/utils.bbclass +0
-0meta/classes/utils.bbclass oe_soinstall() { · line 28
Quoted 4 lines
meta/classes/utils.bbclass +0
-1@@ -25,7 +25,7 @@ oe_soinstall() { libname=`basename $1` case "$libname" in *.so) - bbfatal "oe_soinstall: Shared library must havedversioned filename (e.g. libfoo.so.1.2.3)"
meta/classes/utils.bbclass oe_soinstall() { · line 28
Quoted 1 line
meta/classes/utils.bbclass +1
-0+ bbfatal "oe_soinstall: Shared library must havedversioned filename (e.g. libfoo.so.1.2.3 instead of libfoo.so)"
This patch look OK but it might be nice to also clean up this error message (and the Example comment a few lines above it) to drop the 3 levels of version number. There should only be 2, ie the fully versioned filename would be libfoo.so.1.2 instead of libfoo.so.1.2.3
meta/classes/utils.bbclass oe_soinstall() { · line 34
Quoted 6 lines
meta/classes/utils.bbclass +0
-0;; esac install -m 755 $1 $2/$libname@@ -33,8 +33,12 @@ oe_soinstall() { if [ -z $sonamelink ]; then bbfatal "oe_soinstall: $libname is missing ELF tag'SONAME'."
meta/classes/utils.bbclass oe_soinstall() {
Quoted 3 lines
meta/classes/utils.bbclass +2
-0fi + if [ "$sonamelink" == "$libname" ]; then + bbwarn "oe_soinstall: $libname soname is equal to real(file) name. Minor version should be added to a real name (e.g. libfoo.so.1.2 instead of libfoo.so.1)"
It might be clearer to say:
"
oe_soinstall: $libname soname is equal to fully versioned real (file) name. The soname should include the major version only (e.g. libfoo.so.1 instead of libfoo.so.1.2)"Quoted 16 lines
meta/classes/utils.bbclass +3
-2+ else + ln -sf $libname $2/$sonamelink + fi solink=`echo $libname | sed -e 's/\.so\..*/.so/'` - ln -sf $libname $2/$sonamelink ln -sf $libname $2/$solink } --2.25.1
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 9 lines · Eugeny Shcheglov
Quoted 2 lines
This patch look OK but it might be nice to also clean up this error
message (and the Example comment a few lines above it) to drop the 3 levels of version number. There should only be 2, ie the fully versioned filename would be libfoo.so.1.2 instead of libfoo.so.1.2.3
Yeah, sound reasonable. According to the tLDP (http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html)
there can be be 3 levels, but last one is optional. Quote from tLDP: "The real name adds to the soname a period, a minor number, another period, and the release number. The last period and release number are optional".
In terms of creating symlinks there are only two levels to the version
number: .so is a symlink to .so.<major> and .so.<major> is a symlink to a file called .so.<major>.<everythingelse> (and soname matches .so.<major>). You can define the structure of <everythingelse> to be just a minor number, a minor number and a release number, or something else it still works fine from the point of view of this function. The common case is for <everythingelse> to just be the minor release number and I think it's clearer if the the comments and error messages for this function reflect that.
Quoted 5 lines
So yes, correct fully versioned name should contain at least two numbers
Quoted 1 line
"
oe_soinstall: $libname soname is equal to fully versioned real (file) name. The soname should include the major version only (e.g.libfoo.so.1 instead of libfoo.so.1.2)"Good point. But what if library real name is libfoo.so.1 and soname is libfoo.so.1 too? In my opinion there is two ways:
That's a case where you only need one symlink (ie .so is a symlink to a file called .so.<major> and soname matches .so.<major>) and it doesn't seem to have been considered when this function was originally written. I agree it's a valid use case though (and I guess trying to fix that is the original motivation behind sending this patch?).
Ideally the function should be able to distinguish between needing to create a single symlink and needing to create two symlinks but the soname is incorrect... and give a meaningful error in the second case.
Quoted 71 lines
1) Add one more check: parse $sonamelink and throw bbwarn if soname is incorrect. "Incorrect" in this case means that soname contain more than one version (libfoo.so.1.2)
2) Mention both possible problems in bbwarn. Like: " $libname soname is equal to fully versioned real (file) name. The soname should include the major version only (e.g. libfoo.so.1 instead of libfoo.so.1.2) or minor version should be added to library real name (e.g. libfoo.so.1.2 instead of libfoo.so.1) ; "
First one is definitely clearer. So I'm going to implement it and send version 2 of patch
Quoted 61 lines · Andre McCurdy
Quoted 15 lines · Yevhenii Shchehlov
This patch fixes an issue when
oe_soinstallfunction creates non-functional recursive symlinks in case library soname is equal to library real (file) name.Signed-off-by Yevhenii Shchehlov <[email protected]>--- meta/classes/utils.bbclass | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)meta/classes/utils.bbclass +0
-0meta/classes/utils.bbclass oe_soinstall() { · line 28
Quoted 5 lines
meta/classes/utils.bbclass +1
-1@@ -25,7 +25,7 @@ oe_soinstall() { libname=`basename $1` case "$libname" in *.so) - bbfatal "oe_soinstall: Shared library must haved versioned filename (e.g. libfoo.so.1.2.3)" + bbfatal "oe_soinstall: Shared library must haved versioned filename (e.g. libfoo.so.1.2.3 instead of libfoo.so)"This patch look OK but it might be nice to also clean up this error message (and the Example comment a few lines above it) to drop the 3 levels of version number. There should only be 2, ie the fully versioned filename would be libfoo.so.1.2 instead of libfoo.so.1.2.3
meta/classes/utils.bbclass oe_soinstall() { · line 37
Quoted 9 lines
meta/classes/utils.bbclass +2
-0;; esac install -m 755 $1 $2/$libname@@ -33,8 +33,12 @@ oe_soinstall() { if [ -z $sonamelink ]; then bbfatal "oe_soinstall: $libname is missing ELF tag 'SONAME'." fi + if [ "$sonamelink" == "$libname" ]; then + bbwarn "oe_soinstall: $libname soname is equal to real (file) name. Minor version should be added to a real name (e.g. libfoo.so.1.2 instead of libfoo.so.1)"It might be clearer to say:
"
oe_soinstall: $libname soname is equal to fully versioned real (file) name. The soname should include the major version only (e.g. libfoo.so.1 instead of libfoo.so.1.2)"Quoted 16 lines
meta/classes/utils.bbclass +3
-2+ else + ln -sf $libname $2/$sonamelink + fi solink=`echo $libname | sed -e 's/\.so\..*/.so/'` - ln -sf $libname $2/$sonamelink ln -sf $libname $2/$solink } --2.25.1
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 24 lines · Yevhenii Shchehlov
This patch fixes an issue when
oe_soinstallfunction creates non-functional recursive symlinks in case library soname is equal to library real (file) name.Signed-off-by Yevhenii Shchehlov <[email protected]>--- meta/classes/utils.bbclass | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)meta/classes/utils.bbclass +1
-1@@ -25,7 +25,7 @@ oe_soinstall() { libname=`basename $1` case "$libname" in *.so) - bbfatal "oe_soinstall: Shared library must haved versioned filename (e.g. libfoo.so.1.2.3)" + bbfatal "oe_soinstall: Shared library must haved versioned filename (e.g. libfoo.so.1.2.3 instead oflibfoo.so)"
meta/classes/utils.bbclass +0
-0;; esac install -m 755 $1 $2/$libname
meta/classes/utils.bbclass oe_soinstall() { · line 36
Quoted 4 lines
meta/classes/utils.bbclass +1
-0@@ -33,8 +33,12 @@ oe_soinstall() { if [ -z $sonamelink ]; then bbfatal "oe_soinstall: $libname is missing ELF tag 'SONAME'." fi + if [ "$sonamelink" == "$libname" ]; then
^^
== is a bashism, please use only one (1) =
Cheers,
Andre'
Quoted 13 lines
meta/classes/utils.bbclass +1
-0+ bbwarn "oe_soinstall: $libname soname is equal to real (file) name. Minor version should be added to areal name (e.g. libfoo.so.1.2 instead of libfoo.so.1)"
meta/classes/utils.bbclass +3
-1+ else + ln -sf $libname $2/$sonamelink + fi solink=`echo $libname | sed -e 's/\.so\..*/.so/'` - ln -sf $libname $2/$sonamelink ln -sf $libname $2/$solink }Signature · 2 lines
-- 2.25.1