From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jelle Licht Subject: bug#23723: patch-shebang phase breaks symlinks Date: Wed, 08 Jun 2016 01:42:31 +0200 Message-ID: <87fusowopk.fsf@fsfe.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAQvi-0000oX-3D for bug-guix@gnu.org; Tue, 07 Jun 2016 20:01:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAQve-0002Wt-VE for bug-guix@gnu.org; Tue, 07 Jun 2016 20:01:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:46932) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAQve-0002Wo-Ry for bug-guix@gnu.org; Tue, 07 Jun 2016 20:01:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bAQve-0005Hj-JW for bug-guix@gnu.org; Tue, 07 Jun 2016 20:01:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAQdp-00072O-UF for bug-guix@gnu.org; Tue, 07 Jun 2016 19:42:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAQdl-0007ET-Os for bug-guix@gnu.org; Tue, 07 Jun 2016 19:42:36 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:38502) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAQdl-0007EO-JG for bug-guix@gnu.org; Tue, 07 Jun 2016 19:42:33 -0400 Received: by mail-wm0-f46.google.com with SMTP id m124so134478931wme.1 for ; Tue, 07 Jun 2016 16:42:33 -0700 (PDT) Received: from veritas ([179.43.151.66]) by smtp.gmail.com with ESMTPSA id h8sm2480278wjg.9.2016.06.07.16.42.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jun 2016 16:42:31 -0700 (PDT) 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: 23723@debbugs.gnu.org Hi Guix, It seems that the patch-shebang functionality does not deal gracefully with symlinks: it just overwrites them! After struggling somewhat with getting the recently packaged node 6.0.0 to behave, I found out that `patch-shebang' in (guix build gnu-build-system) does not work properly on symlinks. To illustrate, in this specific case, there was an executable script included with the node tarball, namely `lib/node-modules/npm/bin/npm-cli.js' with an env-based shebang: `/usr/bin/env node'. As the `node' executable will only be available after the `install' phase of the build system, it is not patched before hand. During the `install' phase, a symlink is created from `bin/npm' to `lib/node-modules/npm/bin/npm-cli.js' (in the store output directory this time, of course). Then the `patch-shebangs' phase finds this symlink and proceeds to patch it. Instead of transparently following the symlink and patching the `npm-cli.js' script, the `npm' symlink is overwritten with a shebang-patched copy of `npm-cli.js'. For node, this is a problem because of how node loads run-time dependencies; load paths are resolved relative to the actual file, not the symlink. - Jelle