Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla at busybox.net <bugzilla@busybox.net>
To: buildroot@busybox.net
Subject: [Buildroot] [Bug 13461] New: patchelf tool crashes with 'std::out_of_range' exception, but is probably failing to work in all cases when --make-rpath-relative isn't a canonical path
Date: Wed, 20 Jan 2021 07:45:56 +0000	[thread overview]
Message-ID: <bug-13461-163@https.bugs.busybox.net/> (raw)

https://bugs.busybox.net/show_bug.cgi?id=13461

            Bug ID: 13461
           Summary: patchelf tool crashes with 'std::out_of_range'
                    exception, but is probably failing to work in all
                    cases when --make-rpath-relative isn't a canonical
                    path
           Product: buildroot
           Version: 2020.08.1
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P5
         Component: Other
          Assignee: unassigned at buildroot.uclibc.org
          Reporter: andyg1001 at hotmail.co.uk
                CC: buildroot at uclibc.org
  Target Milestone: ---

Hi,

Building buildroot image causes a number of failures with the patchelf tool,
for example from the output log:

>>>   Sanitizing RPATH in target tree
PER_PACKAGE_DIR=/media/SSD/Toolchains/my-toolchain/build/buildroot-2020.08/per-package
/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/support/scripts/fix-rpath
target
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 72) > this->size() (which is
49)
/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/support/scripts/fix-rpath:
line 61: 27743 Aborted                 ${PATCHELF} --make-rpath-relative
"${rootdir}" ${sanitize_extra_args[@]} "${file}"
FAILED:
/media/SSD/Toolchains/my-toolchain/build/buildroot-2020.08/host/bin/patchelf
--make-rpath-relative
'/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target'
--no-standard-lib-dirs
'/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target/usr/libexec/lzo/examples/lzopack'
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 72) > this->size() (which is
49)
/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/support/scripts/fix-rpath:
line 61: 27750 Aborted                 ${PATCHELF} --make-rpath-relative
"${rootdir}" ${sanitize_extra_args[@]} "${file}"
FAILED:
/media/SSD/Toolchains/my-toolchain/build/buildroot-2020.08/host/bin/patchelf
--make-rpath-relative
'/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target'
--no-standard-lib-dirs
'/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target/usr/libexec/lzo/examples/lzotest'
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 72) > this->size() (which is
49)
/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/support/scripts/fix-rpath:
line 61: 27766 Aborted                 ${PATCHELF} --make-rpath-relative
"${rootdir}" ${sanitize_extra_args[@]} "${file}"
FAILED:
/media/SSD/Toolchains/my-toolchain/build/buildroot-2020.08/host/bin/patchelf
--make-rpath-relative
'/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target'
--no-standard-lib-dirs
'/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target/usr/libexec/lzo/examples/simple'
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 72) > this->size() (which is
49)
/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/support/scripts/fix-rpath:
line 61: 28047 Aborted                 ${PATCHELF} --make-rpath-relative
"${rootdir}" ${sanitize_extra_args[@]} "${file}"
FAILED:
/media/SSD/Toolchains/my-toolchain/build/buildroot-2020.08/host/bin/patchelf
--make-rpath-relative
'/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target'
--no-standard-lib-dirs
'/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target/usr/lib/libturbojpeg.so.0.2.0'
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 72) > this->size() (which is
49)
/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/support/scripts/fix-rpath:
line 61: 28081 Aborted                 ${PATCHELF} --make-rpath-relative
"${rootdir}" ${sanitize_extra_args[@]} "${file}"
FAILED:
/media/SSD/Toolchains/my-toolchain/build/buildroot-2020.08/host/bin/patchelf
--make-rpath-relative
'/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target'
--no-standard-lib-dirs
'/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target/usr/lib/libjpeg.so.8.2.2'
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 72) > this->size() (which is
49)
/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/support/scripts/fix-rpath:
line 61: 28096 Aborted                 ${PATCHELF} --make-rpath-relative
"${rootdir}" ${sanitize_extra_args[@]} "${file}"
FAILED:
/media/SSD/Toolchains/my-toolchain/build/buildroot-2020.08/host/bin/patchelf
--make-rpath-relative
'/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target'
--no-standard-lib-dirs
'/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target/usr/lib/libhistory.so.8.0'
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 72) > this->size() (which is
49)
/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/support/scripts/fix-rpath:
line 61: 28118 Aborted                 ${PATCHELF} --make-rpath-relative
"${rootdir}" ${sanitize_extra_args[@]} "${file}"
FAILED:
/media/SSD/Toolchains/my-toolchain/build/buildroot-2020.08/host/bin/patchelf
--make-rpath-relative
'/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target'
--no-standard-lib-dirs
'/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target/usr/lib/libreadline.so.8.0'
touch
/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target/usr


I have managed to track down the error to a change brought in by the patch
0003-Add-option-to-make-the-rpath-relative-under-a-specif.patch.

Please see
https://git.busybox.net/buildroot/tree/package/patchelf/0003-Add-option-to-make-the-rpath-relative-under-a-specif.patch#n257,
at line 257.

At this point canonicalPath is
"/media/SSD/Toolchains/my-toolchain/target/usr/lib" but rootDir is longer:
"/media/SSD/Toolchains/my-toolchain/source/buildroot-2020.08/../../target",
hence the exception.

It seems that the tool is missing the ability to resolve the "../" components
of the rootDir path to make it canonical and I would guess that therefore the
tool cannot be working in any case since the paths inside the target executable
will never match the passed-in rootDir...

Cheers,
Andy

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2021-01-20  7:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20  7:45 bugzilla at busybox.net [this message]
2024-06-15 14:56 ` [Buildroot] [Bug 13461] patchelf tool crashes with 'std::out_of_range' exception, but is probably failing to work in all cases when --make-rpath-relative isn't a canonical path bugzilla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-13461-163@https.bugs.busybox.net/ \
    --to=bugzilla@busybox.net \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox