Package: dh-virtualenv
Version: 1.2.2-3
Severity: normal

The dh_virtualenv debhelper buildsystem (dh $@ --buildsystem=dh_virtualenv)
only rewrites the "#!.../bin/python" shebangs when it copies the
virtualenv to its final location. Two kinds of files keep the build
directory:

1. bin/activate, bin/activate.csh, bin/activate.fish, bin/activate.nu
   and bin/activate.xsh are never changed, so after installing the
   package sourcing them sets VIRTUAL_ENV to the build directory, e.g.
   /build/foo/build/usr/share/python/foo, and python from the
   virtualenv is not found, in bash, fish and tcsh alike.

2. When the build path is longer than the shebang limit, pip writes the
   console scripts with a /bin/sh trampoline instead of a shebang:

       #!/bin/sh
       '''exec' /very/long/build/path/usr/share/python/foo/bin/python "$0" "$@"
       ' '''

   The exec line is not rewritten, so the installed scripts (the
   package entry points, but also bin/pip) fail with:

       exec: /very/long/build/path/.../bin/python: Permission denied

Steps to reproduce: build a package with

    export DH_VIRTUALENV_INSTALL_SUFFIX = foo
    %:
        dh $@ --buildsystem=dh_virtualenv

install it and source /usr/share/python/foo/bin/activate. For the
second issue, build it from a directory whose path is longer than about
100 characters.



-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 7.2.9+deb14-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8), LANGUAGE=it
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Reply via email to