[elbe-devel] [PATCH] Copy usr files before corresponding [s]bin and lib

Torben Hohn torben.hohn at linutronix.de
Wed Jan 15 15:36:17 CET 2020


On Fri, Dec 06, 2019 at 04:53:43PM +0100, Bastian Germann wrote:
> Am 04.12.19 um 18:08 schrieb Torben Hohn:
> > On Tue, Dec 03, 2019 at 01:35:06AM +0100, bage at linutronix.de wrote:
> >> From: Bastian Germann <bage at linutronix.de>
> >>
> >> Sorting the file list that is copied from chroot to target has the following
> >> effect: The files from /bin, /lib, and /sbin fail to copy on buster targets
> >> because they are dangling symlinks to the /usr/... hierarchy at the copy time.
> >>
> >> Change the order to fix the problem.
> > 
> > I am not happy with this.
> > 
> > No comment explains, why this shall happen.
> > 
> > Its already not obvious, that the sorting is there
> > to make sure, that all the directories are created, before files are
> > copied.
> > 
> > Why do we have these problem in the first place ?
> > Do some packages contain files in /lib ? 
> 
> Yes, some packages have /lib/... or /[s]bin/... files. I noticed the bug
> because busybox has /bin/busybox which silently failed to copy. Using it
> then in finetuning gave an error on non-existing file. You can see the
> issue by changing examples/armel-rescue-busybox-cpio.xml to buster and
> building it.
> 
> > 
> > The proper fix would be to fix copy_filelist to make it handle the
> > symlinks. 
> 
> I do not think so. You would have to check on copying each symlink if
> the target exists and if not, create it. for the /usr/lib and
> /usr/[s]bin targets you would have to mkdir the target. What would you
> need to do in general? I think my solution is a more elegant solution.

ok... lets take this...

Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>

> 
> What I would suggest additionally is making the build fail or generate a
> warning on copy failures (subprocess.call -> subprocess.check_call).
> 
> > 
> >>
> >> Signed-off-by: Bastian Germann <bage at linutronix.de>
> >> ---
> >>  elbepack/efilesystem.py | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
> >> index ef26c21bd..8d7ccd3b2 100644
> >> --- a/elbepack/efilesystem.py
> >> +++ b/elbepack/efilesystem.py
> >> @@ -78,7 +78,8 @@ def extract_target(src, xml, dst, cache):
> >>                  "var/lib/dpkg/info/%s:%s.conffiles" %
> >>                  (line, arch))
> >>  
> >> -        file_list = list(sorted(set(file_list)))
> >> +        file_list = sorted(set(file_list),
> >> +                           key = lambda k: k[4:] if k.startswith('/usr') else k)
> >>          copy_filelist(src, file_list, dst)
> >>      else:
> >>          # first copy most diretories
> >> -- 
> >> 2.20.1
> >>
> >>
> >> _______________________________________________
> >> elbe-devel mailing list
> >> elbe-devel at linutronix.de
> >> https://lists.linutronix.de/mailman/listinfo/elbe-devel
> > 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
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