Skip to contentSkip to conversation

package.bbclass: fix image_debugfs symlinks

GIT PULL William Hauser 2 participants 4 messages Oct 8, 2020 – Nov 4, 2020

lore
Share & tools
lore
#0 lore raw

The debugfs does not contain any symlinks, causing gdb to be unable to locate libraries whose minor versions are abstracted out by using symlinks. i.e. executables link against libpcap.so/libpcap.so.1, not libpcap.so.1.9.1

This is a result a flawed fstat meant to stop broken symlinks from being copied to the debugfs. My suggested change removes this fstat in favor of an earlier check for broken symlinks that is already performed. More details in the commit message.

This change was tested by examining libpcap's build artifacts.

debugfs/usr/lib/.debug/ contents before:
libpcap.so.1.9.1

debugfs/usr/lib/.debug/ contents after:
libpcap.so -> libpcap.so.1
libpcap.so.1 -> libpcap.so.1.9.1
libpcap.so.1.9.1

William Hauser (1):
package.bbclass: fix image_debugfs symlinks

 meta/classes/package.bbclass | 8 --------
 1 file changed, 8 deletions(-)
Signature · 1 line
2.15.1
#1 lore raw

Allow symlinks to be made in the debugfs by removing an incorrect check that would always prevent symlinks from being transferred over.

The comment in this code indicates that the code is meant to ensure symlinks are only copied to the debugfs if their target has already been copied, but instead checks for the existence of the symlink that has yet to be created. As a result this check always fails.

This check is safe to get rid of since we will only attempt to copy a symlink to the debugfs if it's original target exists and is an ELF. It is, however, still possible for a dead symlink to end up in the debugfs if its original target was stripped.

---
 meta/classes/package.bbclass | 8 --------
 1 file changed, 8 deletions(-)
meta/classes/package.bbclass +0 -8
index e6236c0bb2..47f3df2e13 100644
@@ -1258,14 +1258,6 @@ python split_and_strip_files () {
             src = file[len(dvar):]
             dest = debuglibdir + os.path.dirname(src) + debugdir + "/" + os.path.basename(src) + debugappend
             fpath = dvar + dest
-            # Skip it if the target doesn't exist
-            try:
-                s = os.stat(fpath)
-            except OSError as e:
-                (err, strerror) = e.args
-                if err != errno.ENOENT:
-                    raise
-                continue
 
             ltarget = symlinks[file]
             lpath = os.path.dirname(ltarget)
Signature · 1 line
2.15.1
#2 lore raw
Quoted 24 lines · William Hauser via lists.yoctoproject.org

The comment in this code indicates that the code is meant to ensure symlinks are only copied to the debugfs if their target has already been copied, but instead checks for the existence of the symlink that has yet to be created. As a result this check always fails.

This check is safe to get rid of since we will only attempt to copy a symlink to the debugfs if it's original target exists and is an ELF. It is, however, still possible for a dead symlink to end up in the debugfs if its original target was stripped.

---
  meta/classes/package.bbclass | 8 --------
  1 file changed, 8 deletions(-)
meta/classes/package.bbclass +0 -1
index e6236c0bb2..47f3df2e13 100644
@@ -1258,14 +1258,6 @@ python split_and_strip_files () {
              src = file[len(dvar):]
              dest = debuglibdir + os.path.dirname(src) + debugdir + "/" + os.path.basename(src) + debugappend
              fpath = dvar + dest
-            # Skip it if the target doesn't exist

meta/classes/package.bbclass python split_and_strip_files () { · line 1263

Quoted 10 lines
meta/classes/package.bbclass +0 -7
-            try:
-                s = os.stat(fpath)
-            except OSError as e:
-                (err, strerror) = e.args
-                if err != errno.ENOENT:
-                    raise
-                continue
 
              ltarget = symlinks[file]
              lpath = os.path.dirname(ltarget)

Hi William,

I think this patch/email got lost because it was sent to the wrong list and we've been in the last stretch of the gatesgarth release. Could you please re-send to oe-core if it wasn't merged?

See the README.poky below.

Thanks,

../Randy

Contribution Guidelines
=======================

A guide to submitting patches to OpenEmbedded is available at:

http://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

There is good documentation on how to write/format patches at:

https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines

Where to Send Patches
=====================

As Poky is an integration repository (built using a tool called combo-layer), patches against the various components should be sent to their respective upstreams:

bitbake:
    Git repository: http://git.openembedded.org/bitbake/
    Mailing list: [email protected]

documentation:
    Git repository: http://git.yoctoproject.org/cgit/cgit.cgi/yocto-docs/
    Mailing list: [email protected]

meta-poky, meta-yocto-bsp:
    Git repository: http://git.yoctoproject.org/cgit/cgit.cgi/meta-yocto(-bsp)
    Mailing list: [email protected]

Everything else should be sent to the OpenEmbedded Core mailing list.  If in doubt, check the oe-core git repository for the content you intend to modify. Before sending, be sure the patches apply cleanly to the current oe-core git repository.

    Git repository: http://git.openembedded.org/openembedded-core/
    Mailing list: [email protected]

Note: The scripts directory should be treated with extra care as it is a mix of oe-core and poky-specific files from meta-poky.

Quoted 3 lines
Signature · 2 lines
# Randy MacLeod
# Wind River Linux
#3 lore raw

Sent to [email protected]. Thanks, Randy.

Quoted 108 lines · Randy MacLeod

On 2020-10-08 12:59 p.m., William Hauser via lists.yoctoproject.org wrote:

The comment in this code indicates that the code is meant to ensure symlinks are only copied to the debugfs if their target has already been copied, but instead checks for the existence of the symlink that has yet to be created. As a result this check always fails.

This check is safe to get rid of since we will only attempt to copy a symlink to the debugfs if it's original target exists and is an ELF. It is, however, still possible for a dead symlink to end up in the debugfs if its original target was stripped.

---
 meta/classes/package.bbclass | 8 --------
 1 file changed, 8 deletions(-)
meta/classes/package.bbclass +0 -8
index e6236c0bb2..47f3df2e13 100644
@@ -1258,14 +1258,6 @@ python split_and_strip_files () {
             src = file[len(dvar):]
             dest = debuglibdir + os.path.dirname(src) + debugdir + "/" + os.path.basename(src) + debugappend
             fpath = dvar + dest
-            # Skip it if the target doesn't exist
-            try:
-                s = os.stat(fpath)
-            except OSError as e:
-                (err, strerror) = e.args
-                if err != errno.ENOENT:
-                    raise
-                continue
 
             ltarget = symlinks[file]
             lpath = os.path.dirname(ltarget)

Hi William,

I think this patch/email got lost because it was sent to the wrong list and we've been in the last stretch of the gatesgarth release. Could you please re-send to oe-core if it wasn't merged?

See the README.poky below.

Thanks,

../Randy

Contribution Guidelines
=======================

A guide to submitting patches to OpenEmbedded is available at:

http://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

There is good documentation on how to write/format patches at:

https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines

Where to Send Patches
=====================

As Poky is an integration repository (built using a tool called combo-layer),
patches against the various components should be sent to their respective upstreams:

bitbake:
Git repository: http://git.openembedded.org/bitbake/
Mailing list: [email protected]

documentation:
Git repository: http://git.yoctoproject.org/cgit/cgit.cgi/yocto-docs/
Mailing list: [email protected]

meta-poky, meta-yocto-bsp:
Git repository:
http://git.yoctoproject.org/cgit/cgit.cgi/meta-yocto(-bsp)
Mailing list: [email protected]

Everything else should be sent to the OpenEmbedded Core mailing list. If in
doubt, check the oe-core git repository for the content you intend to modify.
Before sending, be sure the patches apply cleanly to the current oe-core git
repository.

Git repository: http://git.openembedded.org/openembedded-core/
Mailing list: [email protected]

Note: The scripts directory should be treated with extra care as it is a mix of
oe-core and poky-specific files from meta-poky.

--
# Randy MacLeod
# Wind River Linux