-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Leading spaces before shebang break custom cargo runner #11254
Comments
I did reproduce it with the script you provided, but it is broken in every version of Cargo (on my macbook with either bash v3 or v5). Would it be that the script itself is broken? I spotted that the last line echo is missing a
Though I got a slightly different error message.
Is it possible to provide a minimal reproducible example? Also helps if we could have the full version info of cargo, how rust toolchain is installed, environment info (distro?), and bash version info. Thank you. |
I am not sure why, but current beta and nightly channels are providing more error contexts, for example.
Could you also try it out on beta/nightly channel? |
Under what situations are spaces legal? I've not personally dealt with this corner case but in looking around, wikipedia lists
@andre-richter has anything else about the system changed? I wonder if something else broke this and the symptom is just visible through cargo since weihanglo couldn't reproduce it. |
Sorry, it was a copy paste error that the closing With #!/bin/bash
echo "I don't work" I get
With (four leading spaces) #!/bin/bash
echo "I don't work" I get
I haven't found a resource yet whether leading spaces are legal. If the script with leading spaces is provided to cargo from nightly version |
What if you try something with syntax that is incompatible with your runner (bash, zsh), like: #!/usr/bin/env python3
import pathlib
print("Running in {}".format(pathlib.Path.cwd()))
```
for me
```console
$ ./shebang.py # without spaces
Running in /home/epage/src/personal/dump
$ ./shebang.py # with spaces (it "hung", hence ^C)
^C./shebang.py: line 5: syntax error near unexpected token `"Running in {}".format'
./shebang.py: line 5: `print("Running in {}".format(pathlib.Path.cwd()))'
``` |
Attached is a minimal reproducer. In |
I think this is a duplicate of rust-lang/rust#101511, and based on that discussion it looks like it is "wontfix". This is due to a change in glibc. |
Labelled this as such to be aligned with rust-lang/rust#101511. @rustbot label +P-low +S-blocked-external -S-needs-info |
Problem
Newer versions of cargo fail to execute a test runner shell script which has leading spaces before the shebang.
Earlier versions of cargo were immune to this.
Steps
.cargo/config.toml
:indented_bash_script.sh
:Possible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: