high-yak-85899
11/15/2023, 6:53 PM2.18.0
. We were getting cryptic errors like
Failed to exec pants at "/home/buildbot/.cache/nce/3d6643e46b53e4cc0b2a0d5c768866226ddce3de1f57f80c4a02d8d39800fa8e/bindings/venvs/2.18.0/bin/pants": Exec format error
We confirmed there weren't any special characters in the file it was trying to execute down by using sha256sum
and verifying with a working deployment. We noticed the file was trying to execute as a shell script and not respecting the shebang line. That looked like
#!/home/buildbot/.cache/nce/3d6643e46b53e4cc0b2a0d5c768866226ddce3de1f57f80c4a02d8d39800fa8e/bindings/venvs/2.18.0/bin/python3.9 -sE
2.16.0
worked happily and we noticed its shebang looked like this
#!/home/buildbot/.cache/nce/3d6643e46b53e4cc0b2a0d5c768866226ddce3de1f57f80c4a02d8d39800fa8e/bindings/venvs/2.16.0/bin/python
We realized that there is a character limit on shebang lines set at the kernel level. On a lot of deployments, this limit is 127 characters (ref). On our user machines, we happen to have a buffer configured to 255 characters limit.
It turns out the working case about is 124 characters while the broken version is 132. We're still trying to root cause why the specific machine we have is limiting at a different number than what its buffer suggests it should be, but we wanted to raise awareness for pants developers/users since its clearly flirting with a default limit on linux distributions.high-yak-85899
11/15/2023, 6:55 PMbroad-processor-92400
11/15/2023, 7:18 PMhigh-yak-85899
11/15/2023, 7:20 PMfast-nail-55400
11/15/2023, 7:24 PMflat-zoo-31952
11/15/2023, 8:24 PMflat-zoo-31952
11/15/2023, 8:27 PMdir=$(mktemp -d)
executable=$dir/python
ln -s $interpreter_path $dir/python
echo "#!$executable" | cat - $script_content_source > $script_destination
broad-processor-92400
11/15/2023, 9:19 PM#!/home/buildbot/.cache/nce/PWZD5GtT5MwLKg1cdohmIm3c494fV_gMSgLY05gA-o4/bindings/venv/2.18.0/bin/python3.9 -sE
is 110 bytes long, which gives space for longer user name and/or longer binding pathhappy-kitchen-89482
11/16/2023, 12:42 AMwide-midnight-78598
11/16/2023, 1:38 AMcurved-television-6568
11/28/2023, 2:43 PM