Public bug reported:

See upstream bug https://github.com/spotify/dh-virtualenv/issues/316 :
Shebang line is sometimes not rewritten because it is #!/bin/sh

We have a package called s11stack-manager which is built for Ubuntu 16.04LTS 
Xenial and 18.04LTS Bionic on Launchpad and installs a virtualenv.
In the installed files, the scripts in the bin directory (such as bin/pip) 
refer to a non-existing python:
```
#!/bin/sh
'''exec' 
/build/s11stack-manager-3u9Lm2/s11stack-manager-0.18.1+syseleven+bionic/debian/s11stack-manager/opt/syseleven/venvs/s11stack-manager/bin/python3
 "$0" "$@"
' '''
```

The build process leaves a reference to the build directory 
`/build/s11stack-manager-3u9Lm2/s11stack-manager-0.18.1+syseleven+bionic/debian/s11stack-manager/opt/syseleven/venvs/s11stack-manager/bin/python`
 instead of correcting it to `/opt/syseleven/venvs/s11stack-manager/bin/python`.
This seems to be a bug in `dh_virtualenv`. It has code to changes the paths, 
but it expects those paths to be in the first line of the scripts, following 
#!. However, sometimes, `virtualenv` creates a different script beginning, like 
so:

```
#!/bin/sh
'''exec' 
/home/syseleven/s11stack-manager-0.18.1+syseleven+bionic/debian/s11stack-manager/opt/syseleven/venvs/s11stack-manager/bin/python3
 "$0" "$@"
' '''
```
and that pattern is not recognised, so it is not fixed.
(that is from a manual invocation on a Bionic installation)

See code: /usr/lib/python2.7/dist-packages/dh_virtualenv/deployment.py
fix_shebangs(self).

This bug is also visible when I invoke the `dh_virtualenv` command
myself on Ubuntu 16.04 and 18.04. There is apparently no package of
`dh_virtualenv` for Ubuntu 20.04LTS; this matches with what's listed on
https://packages.ubuntu.com/search?keywords=dh-virtualenv .

Our `debian/rules` file is
```
#!/usr/bin/make -f
export DH_VIRTUALENV_INSTALL_ROOT=/opt/syseleven/venvs
export S11STACK_MANAGER_CONFIG=

%:
        dh $@ --with python-virtualenv

override_dh_virtualenv:
        dh_virtualenv --extra-virtualenv-arg "--never-download" --extra-pip-arg 
"--no-index" --extra-pip-arg "--find-links=file://${PWD}/debian/pypi" 
--extra-pip-arg "--no-cache-dir" --python /usr/bin/python3 --builtin-venv 
--requirements requirements-builddeb.txt
```

This bug is also visible when I invoke the `dh_virtualenv` command
myself on Ubuntu 16.04 and 18.04. There is apparently no package of
`dh_virtualenv` for Ubuntu 20.04LTS; this matches with what's listed on
https://packages.ubuntu.com/search?keywords=dh-virtualenv .

Looking at the upstream git repo the bug may be fixed in the main branch
but the latest THREE Ubuntu LTS releases have old versions of this
package (16.04, 18.04), or are missing the package altogether (20.04).

** Affects: dh-virtualenv (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1905425

Title:
  dh_virtualenv is buggy or absent in the latest THREE LTS releases

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dh-virtualenv/+bug/1905425/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to