New comment by tornaria on void-packages repository https://github.com/void-linux/void-packages/pull/34053#issuecomment-968435224 Comment: @ericonr thanks for your detailed answer. Let me add a few things: - I misread the code and in fact `#!/usr/bin/env sage-python` is not rewritten. The first grep will match that, but there is a more precise regexp in the loop that will only match python when preceded by space or / and followed by numbers. - the hook was failing for sagemath because some shebangs refer to `python` without a version. That's not a bug: these are standalone binaries intended to run with whatever python is already installed in the system, regardless of version (sage will force install python3 if only python2 is available; these binaries may run before that). - adding `python_version=3` fixes that breakage in a proper way. - allowing xbps-src to rewrite the shebangs doesn't cause terrible breakage (maybe some things are broken, I don't know yet, but if so they are relatively minor). Maybe sage is not relying on shebangs to run python files that must be run on its own venv with its own python. I think we can close this PR for now and I'll probably drop the commit from the sagemath branch as well. If / when we discover issues with some of the rewritten shebangs, we can try to find workarounds.