[PATCH] meson: src: Fix DESTDIR handling while creating dirs

Daniel P. Berrangé berrange at redhat.com
Wed Sep 9 16:05:57 UTC 2020


On Wed, Sep 09, 2020 at 05:06:19PM +0200, Jan Kiszka wrote:
> On 09.09.20 16:38, Erik Skultety wrote:
> > On Mon, Sep 07, 2020 at 11:25:34PM +0200, Jan Kiszka wrote:
> >> From: Jan Kiszka <jan.kiszka at siemens.com>
> >>
> >> If the target path contains a link with an absolute path (e.g.
> >> /var/run -> /run), makedirs will target the wrong location. Resolve the
> >> path first, then append DESTDIR again if needed.
> >
> > Can you elaborate on this? os.makedirs should follow the symlinks before
> > actually creating the directory hierarchy, so I'm failing to see the problem
> > this patch is trying to address.
> >
> 
> mkdir -p /my/destdir/var /my/destdir/run
> ln -s /run /my/destdir/var/run

This looks dubious to me as you're trying to install into a private
root dir, but the root dir is pointing to directories outside of it.

Instead it should be

ln -s /my/destdir/run /my/destdir/var/run

to let installation work normally, then when creating the package
the destdir needs to be stripped from the symlink.

Or alternatively don't use the symlink at all, and instead tell
libvirt to install straight to /my/destdir/run

> meson build --prefix=/usr

ie pass  -Drunstatedir=/run  

> DESTDIR=/my/destdir ninja -C build install
> 
> -> PermissionError: [Errno 13] Permission denied:
> '/my/destdir/var/run/libvirt'
> 
> Jan
> 
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list