Le samedi 12 juillet à 10h 39mn 01s (-0700), Jameson Graef Rollins a écrit :
> On Fri, Jul 11 2014, jhcha54008 <jhcha54...@free.fr> wrote:
> > As stated in http://cmrg.fifthhorseman.net/ticket/80 : in a debirf instance 
> > built with
> > ROOT_BUILD=false, ldconfig and ldd are not the fully functional executables 
> > but the
> > scripts which come with fakechroot. There is no /etc/ld.so.cache.
> >
> > As a result, softwares which rely on /etc/ld.so.cache (and paths in 
> > /etc/ld.so.conf.d/*
> > files) to find their libraries may break when run in a debirf instance, 
> > e.g. fakechroot : in a booted debirf instance
> >
> > # dpkg -l fakechroot
> > ||/ Name        Version   Architecture  Description
> > +++-===========-=========-=============-===========================================
> > ii  fakechroot  2.17.2-1  all           gives a fake chroot environment - 
> > utilities
> > # FAKECHROOT_DETECT=1 fakechroot echo
> > fakechroot: preload library not found, aborting.
> 
> Just for clarification, the above error comes from running fakechroot on
> a booted debirf instance?

Yes

> 
> > diff -Naur a/usr/share/debirf/modules/z1_clean-root 
> > b/usr/share/debirf/modules/z1_clean-root
> > --- a/usr/share/debirf/modules/z1_clean-root        2014-07-09 
> > 22:28:14.000000000 +0200
> > +++ b/usr/share/debirf/modules/z1_clean-root        2014-07-09 
> > 22:37:49.000000000 +0200
> > @@ -28,3 +28,16 @@
> >  
> >  # setup dynamically updated /etc/mtab
> >  ln -sf /proc/mounts "$DEBIRF_ROOT/etc/mtab"
> > +
> > +# remove diversions added by debootstrap
> > +# (debootstrap 1.0.60, function install_fakechroot_tools,
> > +# file /usr/share/debootstrap/functions lines 1397-1582 )
> > +if [ "$ROOT_BUILD" = 'false' ]; then
> > +    debirf_exec dpkg-divert --remove /sbin/ldconfig
> > +    mv -f "$DEBIRF_ROOT/sbin/ldconfig.REAL" "$DEBIRF_ROOT/sbin/ldconfig"
> > +    debirf_exec dpkg-divert --remove /usr/bin/ldd
> > +    mv -f "$DEBIRF_ROOT/usr/bin/ldd.REAL" "$DEBIRF_ROOT/usr/bin/ldd"
> > +fi
> > +
> > +# setup ld.so cache
> > +/sbin/ldconfig -r "$DEBIRF_ROOT"
> 
> I think it would good to have more comments around these snippets to
> describe why all this is necessary.


That's right. Here is a first try. How could we make this clear for the reader 
of the script in
some months or years ?

diff -Naur a/usr/share/debirf/modules/z1_clean-root 
b/usr/share/debirf/modules/z1_clean-root
--- a/usr/share/debirf/modules/z1_clean-root    2014-07-09 22:28:14.000000000 
+0200
+++ b/usr/share/debirf/modules/z1_clean-root    2014-07-14 17:12:20.000000000 
+0200
@@ -28,3 +28,20 @@
 
 # setup dynamically updated /etc/mtab
 ln -sf /proc/mounts "$DEBIRF_ROOT/etc/mtab"
+
+# ldconfig can't work in a fakechroot environment (see fakechroot(1))
+# So we use the build host ldconfig to setup ld.so cache
+/sbin/ldconfig -r "$DEBIRF_ROOT"
+
+# debootstrap's variant 'fakechroot' replaced ldconfig with a dummy
+# version, and ldd with a script devised for a fakechroot environment.
+# At this point we restore the original ldconfig and ldd in the final
+# debirf image, and remove diversions added by debootstrap
+# (see debootstrap 1.0.60, function install_fakechroot_tools,
+# file /usr/share/debootstrap/functions lines 1397-1582 )
+if [ "$ROOT_BUILD" = 'false' ]; then
+    debirf_exec dpkg-divert --remove /sbin/ldconfig
+    mv -f "$DEBIRF_ROOT/sbin/ldconfig.REAL" "$DEBIRF_ROOT/sbin/ldconfig"
+    debirf_exec dpkg-divert --remove /usr/bin/ldd
+    mv -f "$DEBIRF_ROOT/usr/bin/ldd.REAL" "$DEBIRF_ROOT/usr/bin/ldd"
+fi




> 
> jamie.

Regards,
JH Chatenet


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to