[Libguestfs] [PATCH] appliance: Make sure /tmp and /var/tmp are real directories.

Richard W.M. Jones rjones at redhat.com
Sat Jun 6 13:03:46 UTC 2015


On Fri, Jun 05, 2015 at 04:40:26PM +0200, Pino Toscano wrote:
> In data mercoledì 3 giugno 2015 18:57:38, Richard W.M. Jones ha scritto:
> > Currently if /tmp (on the host) is a symlink, then the symlink is
> > copied into the appliance, probably pointing to a non-existent
> > directory, and everything goes downhill from there.
> > 
> > Avoid this by making sure that /tmp and /var/tmp are real directories.
> > ---
> >  appliance/init | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/appliance/init b/appliance/init
> > index 3c5ef1b..3973f18 100755
> > --- a/appliance/init
> > +++ b/appliance/init
> > @@ -10,6 +10,11 @@ RUNLEVEL=S
> >  PREVLEVEL=N
> >  export RUNLEVEL PREVLEVEL
> >  
> > +# Make sure /tmp /var/tmp are real directories, not symlinks.
> > +rm -f /tmp /var/tmp
> > +mkdir /tmp /var/tmp
> > +chmod 1777 /tmp /var/tmp
> 
> Maybe just do that if they are not existing already?
> 
>   if [ ! -d /tmp ]; then ...

Yup, that's likely to be better.  I'll push a modified patch.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list