[elbe-devel] [PATCH 5/8] efilesystem: fix copy_filelist symlink to non existant directory copy

Torben Hohn torben.hohn at linutronix.de
Thu Mar 5 12:19:24 CET 2020


On Wed, Mar 04, 2020 at 11:40:40AM -0500, Olivier Dion wrote:
> On Wed, 04 Mar 2020, Torben Hohn <torben.hohn at linutronix.de> wrote:
> > The example armel-rescue-busybox-cpio.xml triggers this bug:
> >
> > ----------------------------------------------------------------------------------------
> > [ERROR] Build failed
> > Traceback (most recent call last):
> >   File "/usr/lib/python2.7/dist-packages/elbepack/asyncworker.py", line 186, in execute
> >     skip_pbuild=self.skip_pbuilder)
> >   File "/usr/lib/python2.7/dist-packages/elbepack/elbeproject.py", line 551, in build
> >     self.get_rpcaptcache())
> >   File "/usr/lib/python2.7/dist-packages/elbepack/efilesystem.py", line 83, in extract_target
> >     copy_filelist(src, file_list, dst)
> >   File "/usr/lib/python2.7/dist-packages/elbepack/efilesystem.py", line 40, in copy_filelist
> >     dst.fname(f)))
> >   File "/usr/lib/python2.7/dist-packages/elbepack/shellhelper.py", line 39, in system
> >     raise CommandError(cmd, ret)
> > CommandError: Error: 1 returned from Command cp -a --reflink=auto "/var/cache/elbe/d6bda8a8-fd79-4eba-a443-98ea0a8fefcb/chroot/bin/busybox" "/var/cache/elbe/d6bda8a8-fd79-4eba-a443-98ea0a8fefcb/target/bin/busybox"
> > Project build was not successful, current status: build_failed
> > elbe control wait_busy Failed
> > ----------------------------------------------------------------------------------------
> >
> > this is caused by /bin being a symlink to /usr bin.
> > The /bin symlink has already been copied at that point.
> > but /usr/bin has not.
> >
> > Fix that by making sure, that the target directory of a symlink exists,
> > when its copied.
> >
> > Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
> > ---
> >  elbepack/efilesystem.py | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
> > index 5bc20afda..55dda7bf2 100644
> > --- a/elbepack/efilesystem.py
> > +++ b/elbepack/efilesystem.py
> > @@ -36,6 +36,10 @@ def copy_filelist(src, filelist, dst):
> >              st = src.stat(f)
> >              dst.chown(f, st.st_uid, st.st_gid)
> >          else:
> > +            if src.isdir(f) and src.islink(f):
> > +                tgt = src.readlink(f)
> 
> Would you not prefer to use src.realpath(f) instead of src.readlink(f).  In
> case there's multiple symlinks

Good point.
Although src.realpath() is not the correct solution either.

we would not make sure, that the links leading to the target directory
exist.

i have sent a queue with some tests.








> 
> > +                if not dst.isdir(tgt):
> > +                    dst.mkdir(tgt)
> >              system('cp -a --reflink=auto "%s" "%s"' % (src.fname(f),
> >                                                         dst.fname(f)))
> >      # update utime which will change after a file has been copied into
> > -- 
> > 2.20.1
> >
> >
> > _______________________________________________
> > elbe-devel mailing list
> > elbe-devel at linutronix.de
> > https://lists.linutronix.de/mailman/listinfo/elbe-devel
> -- 
> Olivier Dion
> Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list