* [PATCH] package.bbclass: only one hardlink of separated debug info file in each directory
@ 2018-08-24 7:00 Hongxu Jia
2018-08-24 7:16 ` Hongxu Jia
0 siblings, 1 reply; 4+ messages in thread
From: Hongxu Jia @ 2018-08-24 7:00 UTC (permalink / raw)
To: openembedded-core
While multiple hardlinks of binary located in different dirs,
there are also multiple hardlinks of separated debug info file
with the same binary name in same debug dirs. But in each dir,
only one debug file with original name works. Because all of
binary hardlinks have one `.gnu_debuglink' which is added in
`splitdebuginfo'. It caused gdb could not find debugging
symbols.
[Before the patch]
$ find .
./usr/bin/foo
./usr/bin/foo-hd1
./usr/bin/.debug
./usr/bin/.debug/foo
./usr/bin/.debug/foo-hd1
./usr/libexec/foo-hd2
./usr/libexec/.debug
./usr/libexec/.debug/foo-hd2
$ readelf --debug-dump usr/libexec/foo-hd2
Contents of the .gnu_debuglink section:
Separate debug info file: foo
$ gdb usr/libexec/foo-hd2
Reading symbols from usr/libexec/foo-hd2...(no debugging symbols found)...done.
[Before the patch]
[Apply the patch]
$ find .
./usr/bin/foo
./usr/bin/foo-hd1
./usr/bin/.debug
./usr/bin/.debug/foo
./usr/libexec/foo-hd2
./usr/libexec/.debug
./usr/libexec/.debug/foo
$ gdb usr/libexec/foo-hd2
Reading symbols from usr/libexec/foo-hd2...Reading symbols from usr/libexec/.debug/foo...done.
[Apply the patch]
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
meta/classes/package.bbclass | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 4ce9de2..a2a45f6 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1048,15 +1048,18 @@ python split_and_strip_files () {
for ref in inodes:
if len(inodes[ref]) == 1:
continue
+
+ target = inodes[ref][0][len(dvar):]
for file in inodes[ref][1:]:
src = file[len(dvar):]
- dest = debuglibdir + os.path.dirname(src) + debugdir + "/" + os.path.basename(src) + debugappend
+ dest = debuglibdir + os.path.dirname(src) + debugdir + "/" + os.path.basename(target) + debugappend
fpath = dvar + dest
- target = inodes[ref][0][len(dvar):]
ftarget = dvar + debuglibdir + os.path.dirname(target) + debugdir + "/" + os.path.basename(target) + debugappend
bb.utils.mkdirhier(os.path.dirname(fpath))
- #bb.note("Link %s -> %s" % (fpath, ftarget))
- os.link(ftarget, fpath)
+ # Only one hardlink of separated debug info file in each directory
+ if not os.access(fpath, os.R_OK):
+ #bb.note("Link %s -> %s" % (fpath, ftarget))
+ os.link(ftarget, fpath)
# Create symlinks for all cases we were able to split symbols
for file in symlinks:
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] package.bbclass: only one hardlink of separated debug info file in each directory
2018-08-24 7:00 [PATCH] package.bbclass: only one hardlink of separated debug info file in each directory Hongxu Jia
@ 2018-08-24 7:16 ` Hongxu Jia
2018-08-24 8:39 ` richard.purdie
0 siblings, 1 reply; 4+ messages in thread
From: Hongxu Jia @ 2018-08-24 7:16 UTC (permalink / raw)
To: openembedded-core, Richard Purdie
Hi RP,
With this fix, we could not use yesterday's workaround fix
`git: create symlink rather than hardlink between bin/ and libexec/',
But it is no harm for us, btw, Ubuntu use symlink in git , and Fedora
use hardlink in git
[Ubuntu 1604/1804]
$ ls /usr/bin/git* -al
-rwxr-xr-x 1 root root 2343536 6月 1 01:50 /usr/bin/git
-rwxr-xr-x 1 root root 6094 7月 5 22:00 /usr/bin/git-deborig
lrwxrwxrwx 1 root root 3 6月 1 01:50 /usr/bin/git-receive-pack ->
git
-rwxr-xr-x 1 root root 1304912 6月 1 01:50 /usr/bin/git-shell
lrwxrwxrwx 1 root root 3 6月 1 01:50 /usr/bin/git-upload-archive
-> git
-rwxr-xr-x 1 root root 1313024 6月 1 01:50 /usr/bin/git-upload-pack
[Ubuntu 1604/1804]
[Fedora 25]
$ ls /usr/bin/git* -al
-rwxr-xr-x. 115 root root 2033328 1月 19 2017 /usr/bin/git
-rwxr-xr-x. 115 root root 2033328 1月 19 2017 /usr/bin/git-receive-pack
-rwxr-xr-x. 2 root root 1004840 1月 19 2017 /usr/bin/git-shell
-rwxr-xr-x. 115 root root 2033328 1月 19 2017 /usr/bin/git-upload-archive
-rwxr-xr-x. 2 root root 1084152 1月 19 2017 /usr/bin/git-upload-pack
[Fedora 25]
//Hongxu
On 2018年08月24日 15:00, Hongxu Jia wrote:
> While multiple hardlinks of binary located in different dirs,
> there are also multiple hardlinks of separated debug info file
> with the same binary name in same debug dirs. But in each dir,
> only one debug file with original name works. Because all of
> binary hardlinks have one `.gnu_debuglink' which is added in
> `splitdebuginfo'. It caused gdb could not find debugging
> symbols.
>
> [Before the patch]
> $ find .
> ./usr/bin/foo
> ./usr/bin/foo-hd1
> ./usr/bin/.debug
> ./usr/bin/.debug/foo
> ./usr/bin/.debug/foo-hd1
> ./usr/libexec/foo-hd2
> ./usr/libexec/.debug
> ./usr/libexec/.debug/foo-hd2
>
> $ readelf --debug-dump usr/libexec/foo-hd2
> Contents of the .gnu_debuglink section:
> Separate debug info file: foo
>
> $ gdb usr/libexec/foo-hd2
> Reading symbols from usr/libexec/foo-hd2...(no debugging symbols found)...done.
> [Before the patch]
>
> [Apply the patch]
> $ find .
> ./usr/bin/foo
> ./usr/bin/foo-hd1
> ./usr/bin/.debug
> ./usr/bin/.debug/foo
> ./usr/libexec/foo-hd2
> ./usr/libexec/.debug
> ./usr/libexec/.debug/foo
>
> $ gdb usr/libexec/foo-hd2
> Reading symbols from usr/libexec/foo-hd2...Reading symbols from usr/libexec/.debug/foo...done.
> [Apply the patch]
>
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
> meta/classes/package.bbclass | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> index 4ce9de2..a2a45f6 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -1048,15 +1048,18 @@ python split_and_strip_files () {
> for ref in inodes:
> if len(inodes[ref]) == 1:
> continue
> +
> + target = inodes[ref][0][len(dvar):]
> for file in inodes[ref][1:]:
> src = file[len(dvar):]
> - dest = debuglibdir + os.path.dirname(src) + debugdir + "/" + os.path.basename(src) + debugappend
> + dest = debuglibdir + os.path.dirname(src) + debugdir + "/" + os.path.basename(target) + debugappend
> fpath = dvar + dest
> - target = inodes[ref][0][len(dvar):]
> ftarget = dvar + debuglibdir + os.path.dirname(target) + debugdir + "/" + os.path.basename(target) + debugappend
> bb.utils.mkdirhier(os.path.dirname(fpath))
> - #bb.note("Link %s -> %s" % (fpath, ftarget))
> - os.link(ftarget, fpath)
> + # Only one hardlink of separated debug info file in each directory
> + if not os.access(fpath, os.R_OK):
> + #bb.note("Link %s -> %s" % (fpath, ftarget))
> + os.link(ftarget, fpath)
>
> # Create symlinks for all cases we were able to split symbols
> for file in symlinks:
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] package.bbclass: only one hardlink of separated debug info file in each directory
2018-08-24 7:16 ` Hongxu Jia
@ 2018-08-24 8:39 ` richard.purdie
2018-08-24 9:11 ` Hongxu Jia
0 siblings, 1 reply; 4+ messages in thread
From: richard.purdie @ 2018-08-24 8:39 UTC (permalink / raw)
To: Hongxu Jia, openembedded-core
On Fri, 2018-08-24 at 15:16 +0800, Hongxu Jia wrote:
> Hi RP,
>
> With this fix, we could not use yesterday's workaround fix
> `git: create symlink rather than hardlink between bin/ and libexec/',
>
> But it is no harm for us, btw, Ubuntu use symlink in git , and Fedora
> use hardlink in git
Thanks, I was thinking there probably was a problem in package.bbclass
which your change to git was working around and you've now fixed it!
I think I'd prefer to leave git using hardlinks so that we can
potentially spot problems like this in future. There are other recipes
that use hardlinks where the breakage may be more subtle (e.g.
e2fsprogs) so having some recipes using hardlinks is good.
I wondered if you'd fancy creating a new additional oqea test for this
debug hardlink issue so that we'd detect any problems in future? The
test I added was:
http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=318595754b66e8e4f3db1bce1ac086a2409e2eca
and with the addition of a few directories, it could probably be extended?
Cheers,
Richard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] package.bbclass: only one hardlink of separated debug info file in each directory
2018-08-24 8:39 ` richard.purdie
@ 2018-08-24 9:11 ` Hongxu Jia
0 siblings, 0 replies; 4+ messages in thread
From: Hongxu Jia @ 2018-08-24 9:11 UTC (permalink / raw)
To: richard.purdie, openembedded-core
On 2018年08月24日 16:39, richard.purdie@linuxfoundation.org wrote:
> On Fri, 2018-08-24 at 15:16 +0800, Hongxu Jia wrote:
>> Hi RP,
>>
>> With this fix, we could not use yesterday's workaround fix
>> `git: create symlink rather than hardlink between bin/ and libexec/',
>>
>> But it is no harm for us, btw, Ubuntu use symlink in git , and Fedora
>> use hardlink in git
> Thanks, I was thinking there probably was a problem in package.bbclass
> which your change to git was working around and you've now fixed it!
>
> I think I'd prefer to leave git using hardlinks so that we can
> potentially spot problems like this in future. There are other recipes
> that use hardlinks where the breakage may be more subtle (e.g.
> e2fsprogs) so having some recipes using hardlinks is good.
>
> I wondered if you'd fancy creating a new additional oqea test for this
> debug hardlink issue so that we'd detect any problems in future? The
> test I added was:
>
> http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=318595754b66e8e4f3db1bce1ac086a2409e2eca
>
> and with the addition of a few directories, it could probably be extended?
Got it, I am very pleasure to do it, I will extend the case with
multiple dirs
//Hongxu
> Cheers,
>
> Richard
>
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-24 9:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-24 7:00 [PATCH] package.bbclass: only one hardlink of separated debug info file in each directory Hongxu Jia
2018-08-24 7:16 ` Hongxu Jia
2018-08-24 8:39 ` richard.purdie
2018-08-24 9:11 ` Hongxu Jia
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox