Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check build path isn't too long #429

Closed
legoktm opened this issue Mar 17, 2023 · 1 comment
Closed

Check build path isn't too long #429

legoktm opened this issue Mar 17, 2023 · 1 comment

Comments

@legoktm
Copy link
Member

legoktm commented Mar 17, 2023

https://github.com/pypa/distlib/blob/5cc90837e38db4b37a3c33474774c82233b14e90/distlib/scripts.py#L148

pip (via distlib) has behavior to use a different variation on the shebang if the build path is too long to fit in a linux shebang (see https://rosettacode.org/wiki/Multiline_shebang#Python for an explanation of how the polyglot file works).

In the most recent securedrop-client release, a build path was used that was 1 character over the limit

>>> len("#!/home/user/securedrop-builder/build/debbuild/packaging/securedrop-client/debian/securedrop-client/opt/venvs/securedrop-client\n")
128

This results in a weird diffoscope diff of:

│ │ ├── ./opt/venvs/securedrop-client/bin/alembic
│ │ │ @@ -1,10 +1,8 @@
│ │ │ -#!/bin/sh
│ │ │ -'''exec' /opt/venvs/securedrop-client/bin/python "$0" "$@"
│ │ │ -' '''
│ │ │ +#!/opt/venvs/securedrop-client/bin/python
│ │ │  # -*- coding: utf-8 -*-
│ │ │  import re
│ │ │  import sys
│ │ │  from alembic.config import main
│ │ │  if __name__ == '__main__':
│ │ │      sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
│ │ │      sys.exit(main())

We should add a check to one of the scripts to abort if the build path is too long

@legoktm
Copy link
Member Author

legoktm commented Feb 6, 2024

As of freedomofpress/securedrop-client#1741 builds are now done in a container that uses a fixed path that is short enough.

@legoktm legoktm closed this as completed Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant