Re: [PATCH 2/2] libselinux: do not use relative path when creating libselinux symlinks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2011-09-14 at 15:18 -0400, Stephen Smalley wrote:
> On Wed, 2011-09-14 at 14:50 -0400, Eric Paris wrote:
> > At the moment we create a symlink:
> > 
> > /usr/lib/libselinux.so -> ../../lib/libselinux.so.1
> > 
> > This works if (and only if) $SHLIBDIR and $LIBDIR are different only by
> > ../../.  Instead create a symlink from
> > 
> > $LIBDIR/libselinux.so->$SHLIBDIR/libselinux.so.1
> > 
> > Thus it works no matter what values one might use for LIBDIR and
> > SHLIBDIR.
> 
> I'm not sure this works the way you would want.  Consider rpm build of
> libselinux - it does:
> make DESTDIR="%{buildroot}" LIBDIR="%{buildroot}%{_libdir}"
> SHLIBDIR="%{buildroot}/%{_lib}" BINDIR="%{buildroot}%{_sbindir}" install
> 
> And then rpm collects up the files into the package.

Yes, for example, as we were speculating earlier on in a different but
related thread, Fedora generally sorts out things in standard and
development packages at least for the libraries (because the libraries
can be both used "passively" or "actively" for further development).

So the executable belongs to the standard package and the link belongs
to the development package. Many other distributions also split
libraries in two packages (a standard one and a development one).

> But if the symlink encodes the full pathname used at make install time,
> then it will be wrong on the final system when the rpm is installed.

Ideally the link should be (re)created by the spec file. Otherwise, I
agree, a relative link should be used.

> Haven't actually tested that theory, but I think it is true.  Welcome to
> hell.

We can use a relative link instead of an absolute path and we could
install the link both in SHLIBDIR and LIBDIR. The rest would need to be
sorted out by distributions' automated build systems or individual
installers.

What do you say ?

Guido

> > 
> > Signed-off-by: Eric Paris <eparis@xxxxxxxxxx>
> > ---
> >  libselinux/src/Makefile |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> > index 78874be..bccc777 100644
> > --- a/libselinux/src/Makefile
> > +++ b/libselinux/src/Makefile
> > @@ -126,7 +126,7 @@ install: all
> >  	install -m 755 $(LIBSO) $(SHLIBDIR)
> >  	test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig
> >  	install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig
> > -	cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET)
> > +	ln -sf $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET)
> >  
> >  install-pywrap: pywrap
> >  	test -d $(PYLIBDIR)/site-packages/selinux || install -m 755 -d $(PYLIBDIR)/site-packages/selinux
> 



--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.


[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux