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

Bastian Germann bage at linutronix.de
Fri Dec 6 16:53:43 CET 2019


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.

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
> 



More information about the elbe-devel mailing list