From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ivan Vilata i Balaguer Subject: bug#38055: patchelf: Assertion failed when setting interpreter Date: Wed, 6 Nov 2019 16:42:21 -0500 Message-ID: <20191106214221.GL17621@sax.terramar.selidor.net> References: <20191104045614.GI17621@sax.terramar.selidor.net> <87muda1kfs.fsf@gnu.org> <20191105161822.GG14453@E5400> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:56463) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iST5v-0007Ae-8p for bug-guix@gnu.org; Wed, 06 Nov 2019 16:44:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iST5t-0003u9-VS for bug-guix@gnu.org; Wed, 06 Nov 2019 16:44:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:60748) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iST5t-0003tc-RY for bug-guix@gnu.org; Wed, 06 Nov 2019 16:44:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iST5t-0007Ne-Nc for bug-guix@gnu.org; Wed, 06 Nov 2019 16:44:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: Content-Disposition: inline In-Reply-To: <20191105161822.GG14453@E5400> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Efraim Flashner Cc: 38055@debbugs.gnu.org, Ivan Vilata i Balaguer Efraim Flashner (2019-11-05 18:18:22 +0200) wrote: > On Tue, Nov 05, 2019 at 03:12:23PM +0100, Ludovic Courtès wrote: > > > > Ivan Vilata i Balaguer skribis: > > > > > Hi, I'm using patchelf 0.8 from Guix commit 7f81cce3 on Debian Sid. > > > When trying to patch the `go` binary from > > > , I get the > > > following error: > > > > > > ivan@sax /tmp/tmps2Cv6w [env]$ patchelf --print-interpreter $SHELL > > > /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib/ld-linux-x86-64.so.2 > > > ivan@sax /tmp/tmps2Cv6w [env]$ patchelf --set-interpreter $(patchelf --print-interpreter $SHELL) /tmp/tmps2Cv6w/golang/bin/go > > > patchelf: patchelf.cc:701: void ElfFile::rewriteSectionsExecutable() \ > > > [with Elf_Ehdr = Elf64_Ehdr; Elf_Phdr = Elf64_Phdr; Elf_Shdr = Elf64_Shdr; Elf_Addr = long unsigned int; Elf_Off = long unsigned int; \ > > > Elf_Dyn = Elf64_Dyn; Elf_Sym = Elf64_Sym]: Assertion `(off_t) rdi(hdr->e_shoff) >= startOffset' failed. > > > Aborted > > > > I think it’s a bug you should report upstream to the PatchELF > > maintainers; it’s probably not Guix-specific. > > On the other hand, if I were the patchelf maintainers, I'd suggest > upgrading our package from 0.8 to a newer version. Yeah, as I mentioned in the original mail that particular problem does indeed seem to be fixed in 0.10. However when I try to build that source with `guix build patchelf --with-source=…`, tests fail. If I run `guix environment -C --pure patchelf` then unpack and build the source, the only test that actually fails is `no-rpath.sh`. If I run `sh -x no-rpath.sh` I get this: ``` ++ basename no-rpath.sh .sh + SCRATCH=scratch/no-rpath + rm -rf scratch/no-rpath + mkdir -p scratch/no-rpath + cp no-rpath scratch/no-rpath/ ++ ../src/patchelf --print-rpath scratch/no-rpath/no-rpath + oldRPath=/gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib:/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib:/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/../../..:/gnu/store/dcrwf5irwh39knld1wim1qkny659af9g-profile/lib + test -n /gnu/store/ahqgl4h89xqj695lgqvsaf6zh2nhy4pj-glibc-2.29/lib:/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib:/gnu/store/2plcy91lypnbbysb18ymnhaw3zwk8pg1-gcc-7.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.4.0/../../..:/gnu/store/dcrwf5irwh39knld1wim1qkny659af9g-profile/lib + exit 1 ``` To succeed, the output of `…/patchelf --print-rpath …/no-rpath` (i.e. `oldRPath`) should be empty. I'm not that familiar with Guix's GNU build system, but is that at all possible under Guix? I mean, maybe the test is pointless or must be altered in some Guix-specific way for the `no-rpath` binary not to have an rpath. Cheers, -- Ivan Vilata i Balaguer -- https://elvil.net/