[yocto] Pointless unlink-link in strip_execs?

Richard Purdie richard.purdie at linuxfoundation.org
Mon Sep 9 23:15:35 PDT 2019


On Fri, 2019-09-06 at 11:52 -0700, Kaz Kylheku wrote:
> Hi,
> 
> I'm looking at meta/lib/oe/package.py, function strip_execs, under
> Yocto 
> 2.5.
> 
> It has this tidbit:
> 
>                      if s.st_ino in inodes:
>                          os.unlink(file)                     # <---
> of 
> interest
>                          os.link(inodes[s.st_ino], file)     #
>                      else:
>                          # break hardlinks so that we do not strip
> the 
> original.
>                          inodes[s.st_ino] = file
>                          bb.utils.copyfile(file, file)
>                          elffiles[file] = elf_file
> 
> If s.st_ino is in the inodes dictionary, doesn't that mean that the 
> paths
> inodes[s.st_ino] and file are already hard links to the same object?
> 
> In other words, those two link and unlink lines don't achieve
> anything?

I think its more subtle than this.

It will be in that inodes list if we already want to break hardlinks to
the copy having gone through the "else" section once before already. We
want one copy and all the hardlinks pointing to that copy.

The reason is so that we have one stripped copy and in our packaged
data, all copies hardlink to that copy.

Cheers,

Richard





More information about the yocto mailing list