All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Ťulák" <jan@tulak.me>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Christoph Hellwig <hch@infradead.org>,
	Brian Foster <bfoster@redhat.com>,
	XFS mail list <xfs@oss.sgi.com>
Subject: Re: symlink loop for /lib64/libhandle.so
Date: Fri, 11 Jul 2014 12:47:58 +0200	[thread overview]
Message-ID: <1405075678.28203.56.camel@jtulak> (raw)
In-Reply-To: <53BEC1E7.1070904@sandeen.net>

On Thu, 2014-07-10 at 11:40 -0500, Eric Sandeen wrote:
> Here's what the current RPM build does; I don't claim that it's elegant or
> beautiful:
> 
> %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



_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2014-07-11 10:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-09  9:30 symlink loop for /lib64/libhandle.so Jan Ťulák
2014-07-09 13:28 ` Brian Foster
2014-07-10 13:48   ` Christoph Hellwig
2014-07-10 16:31     ` Jan Ťulák
2014-07-10 16:40       ` Eric Sandeen
2014-07-11 10:47         ` Jan Ťulák [this message]
2014-07-14  8:04           ` Jan Ťulák
2014-07-14  8:26             ` Christoph Hellwig
2014-07-15 10:28               ` Jan Ťulák
2014-07-15 15:48                 ` Christoph Hellwig
2014-07-18  6:07                   ` Jan Ťulák
2014-08-11 18:02                   ` Christoph Hellwig
2014-09-13 19:47                     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405075678.28203.56.camel@jtulak \
    --to=jan@tulak.me \
    --cc=bfoster@redhat.com \
    --cc=hch@infradead.org \
    --cc=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.