Skip to content

Duplicated newline in shebang of windows launcher #220

Closed
@A2uria

Description

@A2uria
0001a600: 2321 2243 3a5c 5072 6f67 7261 6d20 4669  #!"C:\Program Fi
0001a610: 6c65 735c 5079 7468 6f6e 3331 305c 7079  les\Python310\py
0001a620: 7468 6f6e 2e65 7865 220a 0d0a 504b 0304  thon.exe"...PK..
                                ^^^^^^^

ScriptMaker._build_shebang hardcoded a b'\n'.

distlib/distlib/scripts.py

Lines 169 to 170 in 888c48b

if simple_shebang:
result = b'#!' + executable + post_interp + b'\n'

However, ScriptMaker._write_script will check for b'\r\n', which is non existant.

distlib/distlib/scripts.py

Lines 255 to 257 in 888c48b

linesep = os.linesep.encode('utf-8')
if not shebang.endswith(linesep):
shebang += linesep

Remove the hardcoded b'\n' and let ScriptMaker._write_script to generate newline for shebang is more universal but check for a single b'\n' on windows might be better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions