Discussion:
symlink loop for /lib64/libhandle.so
Jan Ťulák
2014-07-09 09:30:12 UTC
Permalink
Hi,

when I install xfsprogs from Git, I get a symlink loop:
$ ls -l /lib64/libhandle.so
lrwxrwxrwx. 1 root root 19 Jul 9 09:56 /lib64/libhandle.so
-> /lib64/libhandle.so

I guess it should point to libhandle.so.1.


I'm using this repo: git://oss.sgi.com/xfs/cmds/xfsprogs
And just the usual "make && sudo make install" commands.

Also, I have made sure the libhandle library was not installed before
this installation.


Used HW/SW:
- A virtual machine in KVM.
- Fedora 20 x86_64

If it not an intended behavior, I can try to find the source of the bug
and make a patch (I'm new here :-).

Thanks,
Jan Tulak
Brian Foster
2014-07-09 13:28:36 UTC
Permalink
Post by Jan Ťulák
Hi,
$ ls -l /lib64/libhandle.so
lrwxrwxrwx. 1 root root 19 Jul 9 09:56 /lib64/libhandle.so
-> /lib64/libhandle.so
I guess it should point to libhandle.so.1.
I'm using this repo: git://oss.sgi.com/xfs/cmds/xfsprogs
And just the usual "make && sudo make install" commands.
Also, I have made sure the libhandle library was not installed before
this installation.
- A virtual machine in KVM.
- Fedora 20 x86_64
If it not an intended behavior, I can try to find the source of the bug
and make a patch (I'm new here :-).
I can reproduce this on fedora rawhide via 'make install-qa.' This is
not intended behavior. I couldn't tell you what the problem is, but
patches are certainly welcome. :)

Brian
Post by Jan Ťulák
Thanks,
Jan Tulak
_______________________________________________
xfs mailing list
http://oss.sgi.com/mailman/listinfo/xfs
Christoph Hellwig
2014-07-10 13:48:51 UTC
Permalink
Post by Brian Foster
Post by Jan Ťulák
If it not an intended behavior, I can try to find the source of the bug
and make a patch (I'm new here :-).
I can reproduce this on fedora rawhide via 'make install-qa.' This is
not intended behavior. I couldn't tell you what the problem is, but
patches are certainly welcome. :)
This sounds like an fallout from the /lib -> /usr/lib symlink mess in
Fedora. Might be worth taking a look at the specfile how Eric worked
around that for the RPM..
Jan Ťulák
2014-07-10 16:31:12 UTC
Permalink
Post by Christoph Hellwig
Post by Brian Foster
Post by Jan Ťulák
If it not an intended behavior, I can try to find the source of the bug
and make a patch (I'm new here :-).
I can reproduce this on fedora rawhide via 'make install-qa.' This is
not intended behavior. I couldn't tell you what the problem is, but
patches are certainly welcome. :)
This sounds like an fallout from the /lib -> /usr/lib symlink mess in
Fedora. Might be worth taking a look at the specfile how Eric worked
around that for the RPM..
Yes. I'm trying to find out what exactly is causing the difference. I
have tried to use the same tarball which is used in Eric's RPM and it
did the same thing as the git version, so it is not something that
would change since his last build.

So far It seems that if I add DIST_ROOT, PKG_ROOT_SBIN_DIR and
PKG_ROOT_LIB_DIR arguments to the "make install-qa" commandm it works OK and
the libhandle.so placed in PKG_ROOT_LIB_DIR points correctly to
libandle.so.1.

Does this makes some sense to you?

Jan Tulak
Eric Sandeen
2014-07-10 16:40:07 UTC
Permalink
This post might be inappropriate. Click to display it.
Jan Ťulák
2014-07-11 10:47:58 UTC
Permalink
Post by Eric Sandeen
Here's what the current RPM build does; I don't claim that it's elegant or
%install
rm -rf $RPM_BUILD_ROOT
make V=1 DIST_ROOT=$RPM_BUILD_ROOT install install-dev install-qa \
PKG_ROOT_SBIN_DIR=%{_sbindir} PKG_ROOT_LIB_DIR=%{_libdir}
so that sounds like what you're doing, too.
I think I found it. In short: On Fedora, /lib64 is a symlink
into /usr/lib64, but "install/buildmacros" script thinks it as two
different directories and mess it. Proposed solution: better condition
on line 79 to avoid symlink changes.


Long version:

I looked for the variables and maybe found something more in files
"include/buildmacros" and "install-sh". In the buildmacros file on line
around 80 is command:

../$(INSTALL) -S $(PKG_ROOT_LIB_DIR)/$(LIBNAME).so
$(PKG_LIB_DIR)/$(LIBNAME).so;

It is invoked just once and its arguments are [/lib64/libhandle.so] and
[/usr/lib64/libhandle.so] (in this order). This is at the end translated
into this call in "install-sh" on line 172:

ln -s -f /lib64/libhandle.so //usr/lib64/libhandle.so


It seems to be OK, , but when I put a "ls -li" before and after this
command on line 172, this is what I got (I just added few echos):

----------------
before:
1668 lrwxrwxrwx. 1 root root 14 Jul 11 10:36 /lib64/libhandle.so ->
libhandle.so.1
1668 lrwxrwxrwx. 1 root root 14 Jul 11 10:36 //usr/lib64/libhandle.so ->
libhandle.so.1
......
ln -s -f /lib64/libhandle.so //usr/lib64/libhandle.so
......
after:
1668 lrwxrwxrwx. 1 root root 19 Jul 11 10:36 /lib64/libhandle.so
-> /lib64/libhandle.so
1668 lrwxrwxrwx. 1 root root 19 Jul 11 10:36 //usr/lib64/libhandle.so
-> /lib64/libhandle.so
-----------

Then I have done "ls -l /" and found the reason:
lrwxrwxrwx. 1 root root 9 Dec 12 2013 lib64 -> usr/lib64

So the loop is because on Fedora, /lib64 and /usr/lib64 are the same
directory. The "buildmacros" script does some check before doing the
symlinking, but it just checks the paths as strings. I think that a
better condition on line 80 of "include/buildmacros" file should fix it.
I tried to make a new condition and it works, but I'm not sure about
portability of using the "$(shell ...)" extension of GNU Make. Is there
some more portable way how to do it and keep the condition short?

Proposed condition:

if test "x$(PKG_LIB_DIR)" != "x$(PKG_ROOT_LIB_DIR)"\
-a "x$(shell readlink -f $(PKG_ROOT_LIB_DIR))" != "x$(PKG_LIB_DIR)"\
-a "x$(shell readlink -f $(PKG_LIB_DIR))" != "x$(PKG_ROOT_LIB_DIR)";\
then \

Instead of:

if test "x$(PKG_LIB_DIR)" != "x$(PKG_ROOT_LIB_DIR)"; then \


And by the way: It seems to me that the command on line 83 in
"buildmacros" has swapped arguments. In two other symlinks around,
PKG_LIB_DIR and PKG_ROOT_LIB_DIR for .a and .la files are in other
order. Is this all right?


Jan Tulak
Jan Ťulák
2014-07-14 08:04:47 UTC
Permalink
Post by Jan Ťulák
I think I found it. In short: On Fedora, /lib64 is a symlink
into /usr/lib64, but "install/buildmacros" script thinks it as two
different directories and mess it. Proposed solution: better condition
on line 79 to avoid symlink changes.
Just a correction, the file is in "include" directory, not in
"install".

And I have created a bug report and added the proposed change as a
patch: http://oss.sgi.com/bugzilla/show_bug.cgi?id=1059

Jan Tulak
Christoph Hellwig
2014-07-14 08:26:07 UTC
Permalink
Post by Jan Ťulák
And I have created a bug report and added the proposed change as a
patch: http://oss.sgi.com/bugzilla/show_bug.cgi?id=1059
Can you just send the properly formatted and signed off patch to the
list? That's the usual process for XFS changes and makes everyones life
simpler.
Jan Ťulák
2014-07-15 10:28:26 UTC
Permalink
Post by Christoph Hellwig
Can you just send the properly formatted and signed off patch to the
list? That's the usual process for XFS changes and makes everyones life
simpler.
I hope this is all right.
And sorry Chris, I mistakenly replied just to you instead of into the
mailing list.


Reported-by: Jan Tulak <jan at tulak.me>
Signed-off-by: Jan Tulak <jan at tulak.me>
---
include/buildmacros | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/buildmacros b/include/buildmacros
index 7a01880..657b82a 100644
--- a/include/buildmacros
+++ b/include/buildmacros
@@ -76,7 +76,11 @@ INSTALL_LTLIB_DEV = \
../$(INSTALL) -m 644 $(LIBNAME).lai $(PKG_LIB_DIR)/$(LIBNAME).la ; \
../$(INSTALL) -m 755 -d $(PKG_ROOT_LIB_DIR); \
../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_ROOT_LIB_DIR); \
- if test "x$(PKG_LIB_DIR)" != "x$(PKG_ROOT_LIB_DIR)" ; then \
+ if test "x$(PKG_LIB_DIR)" != "x$(PKG_ROOT_LIB_DIR)"\
+ -a "x$(shell readlink -f $(PKG_ROOT_LIB_DIR))" != "x$(PKG_LIB_DIR)"\
+ -a "x$(shell readlink -f $(PKG_LIB_DIR))" != "x$(PKG_ROOT_LIB_DIR)"\
+ -a "x$(shell readlink -f $(PKG_LIB_DIR))" != "x$(shell
readlink -f $(PKG_ROOT_LIB_DIR))";\
+ then \
../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).a
$(PKG_ROOT_LIB_DIR)/$(LIBNAME)
.a; \
../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).la
$(PKG_ROOT_LIB_DIR)/$(LIBNAME).la; \
../$(INSTALL) -S $(PKG_ROOT_LIB_DIR)/$(LIBNAME).so
$(PKG_LIB_DIR)/$(LIBNAME).so; \
Post by Christoph Hellwig
Post by Jan Ťulák
And I have created a bug report and added the proposed change as a
patch: http://oss.sgi.com/bugzilla/show_bug.cgi?id=1059
Can you just send the properly formatted and signed off patch to the
list? That's the usual process for XFS changes and makes everyones life
simpler.
Christoph Hellwig
2014-07-15 15:48:57 UTC
Permalink
Hi Jan,

there were still some small isues with the patch format, I've attached
a version of your patch that has the expected format.

Note that I also changed it to only check the canonical names instead of
testing the passed in one and the one readlink was called on. This
should be enough I think, but please test that it still works for you.

Thanks for tracking this down!
Jan Ťulák
2014-07-18 06:07:36 UTC
Permalink
Post by Christoph Hellwig
Hi Jan,
there were still some small isues with the patch format, I've attached
a version of your patch that has the expected format.
Note that I also changed it to only check the canonical names instead of
testing the passed in one and the one readlink was called on. This
should be enough I think, but please test that it still works for you.
Thanks for tracking this down!
<libhandle.diff>
Hi Christoph,

thanks for the checking. This version works too, so it can be used.

I’m glad I could help.

Jan
Christoph Hellwig
2014-08-11 18:02:27 UTC
Permalink
Dave, can you pick up this patch for xfsprogs?
Post by Christoph Hellwig
Hi Jan,
there were still some small isues with the patch format, I've attached
a version of your patch that has the expected format.
Note that I also changed it to only check the canonical names instead of
testing the passed in one and the one readlink was called on. This
should be enough I think, but please test that it still works for you.
Thanks for tracking this down!
Subject: [PATCH] libhandle: fix instalation for symlinked /usr
Canonicalize the pathnames for PKG_LIB_DIR and PKG_ROOT_LIB_DIR before
checking if they are the same. This is required for Fedora which doesn't
have a separate /usr/lib directory anymore.
diff --git a/include/buildmacros b/include/buildmacros
index 7a01880..4e4e8fa 100644
--- a/include/buildmacros
+++ b/include/buildmacros
@@ -76,10 +76,11 @@ INSTALL_LTLIB_DEV = \
../$(INSTALL) -m 644 $(LIBNAME).lai $(PKG_LIB_DIR)/$(LIBNAME).la ; \
../$(INSTALL) -m 755 -d $(PKG_ROOT_LIB_DIR); \
../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_ROOT_LIB_DIR); \
- if test "x$(PKG_LIB_DIR)" != "x$(PKG_ROOT_LIB_DIR)" ; then \
- ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).a $(PKG_ROOT_LIB_DIR)/$(LIBNAME).a; \
- ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).la $(PKG_ROOT_LIB_DIR)/$(LIBNAME).la; \
- ../$(INSTALL) -S $(PKG_ROOT_LIB_DIR)/$(LIBNAME).so $(PKG_LIB_DIR)/$(LIBNAME).so; \
+ if [ "x$(shell readlink -f $(PKG_LIB_DIR))" != \
+ "x$(shell readlink -f $(PKG_ROOT_LIB_DIR))"; ]; then \
+ ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).a $(PKG_ROOT_LIB_DIR)/$(LIBNAME).a; \
+ ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).la $(PKG_ROOT_LIB_DIR)/$(LIBNAME).la; \
+ ../$(INSTALL) -S $(PKG_ROOT_LIB_DIR)/$(LIBNAME).so $(PKG_LIB_DIR)/$(LIBNAME).so; \
fi
else
INSTALL_LTLIB_DEV = $(INSTALL_LTLIB_STATIC)
_______________________________________________
xfs mailing list
http://oss.sgi.com/mailman/listinfo/xfs
---end quoted text---
Christoph Hellwig
2014-09-13 19:47:51 UTC
Permalink
ping?
Post by Christoph Hellwig
Dave, can you pick up this patch for xfsprogs?
Post by Christoph Hellwig
Hi Jan,
there were still some small isues with the patch format, I've attached
a version of your patch that has the expected format.
Note that I also changed it to only check the canonical names instead of
testing the passed in one and the one readlink was called on. This
should be enough I think, but please test that it still works for you.
Thanks for tracking this down!
Subject: [PATCH] libhandle: fix instalation for symlinked /usr
Canonicalize the pathnames for PKG_LIB_DIR and PKG_ROOT_LIB_DIR before
checking if they are the same. This is required for Fedora which doesn't
have a separate /usr/lib directory anymore.
diff --git a/include/buildmacros b/include/buildmacros
index 7a01880..4e4e8fa 100644
--- a/include/buildmacros
+++ b/include/buildmacros
@@ -76,10 +76,11 @@ INSTALL_LTLIB_DEV = \
../$(INSTALL) -m 644 $(LIBNAME).lai $(PKG_LIB_DIR)/$(LIBNAME).la ; \
../$(INSTALL) -m 755 -d $(PKG_ROOT_LIB_DIR); \
../$(INSTALL) -T so_base $(LIBNAME).lai $(PKG_ROOT_LIB_DIR); \
- if test "x$(PKG_LIB_DIR)" != "x$(PKG_ROOT_LIB_DIR)" ; then \
- ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).a $(PKG_ROOT_LIB_DIR)/$(LIBNAME).a; \
- ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).la $(PKG_ROOT_LIB_DIR)/$(LIBNAME).la; \
- ../$(INSTALL) -S $(PKG_ROOT_LIB_DIR)/$(LIBNAME).so $(PKG_LIB_DIR)/$(LIBNAME).so; \
+ if [ "x$(shell readlink -f $(PKG_LIB_DIR))" != \
+ "x$(shell readlink -f $(PKG_ROOT_LIB_DIR))"; ]; then \
+ ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).a $(PKG_ROOT_LIB_DIR)/$(LIBNAME).a; \
+ ../$(INSTALL) -S $(PKG_LIB_DIR)/$(LIBNAME).la $(PKG_ROOT_LIB_DIR)/$(LIBNAME).la; \
+ ../$(INSTALL) -S $(PKG_ROOT_LIB_DIR)/$(LIBNAME).so $(PKG_LIB_DIR)/$(LIBNAME).so; \
fi
else
INSTALL_LTLIB_DEV = $(INSTALL_LTLIB_STATIC)
_______________________________________________
xfs mailing list
http://oss.sgi.com/mailman/listinfo/xfs
---end quoted text---
---end quoted text---

Loading...