Skip to content

Annotation crashes on shebang #958

@carmenbianca

Description

@carmenbianca

The following terminal extract contains all relevant information:

(protokolo-py3.11) 🐚 carmenbianca protokolo i18n $ cat generate_pot.sh
#!/usr/bin/env sh
(protokolo-py3.11) 🐚 carmenbianca protokolo i18n $ reuse annotate --copyright 'me' generate_pot.sh
Traceback (most recent call last):
  File "/home/carmenbianca/.cache/pypoetry/virtualenvs/protokolo-Gp8COqWt-py3.11/bin/reuse", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/carmenbianca/.cache/pypoetry/virtualenvs/protokolo-Gp8COqWt-py3.11/lib/python3.11/site-packages/reuse/_main.py", line 310, in main
    return parsed_args.func(parsed_args, project, out)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/carmenbianca/.cache/pypoetry/virtualenvs/protokolo-Gp8COqWt-py3.11/lib/python3.11/site-packages/reuse/_annotate.py", line 523, in run
    result += add_header_to_file(
              ^^^^^^^^^^^^^^^^^^^
  File "/home/carmenbianca/.cache/pypoetry/virtualenvs/protokolo-Gp8COqWt-py3.11/lib/python3.11/site-packages/reuse/_annotate.py", line 170, in add_header_to_file
    output = find_and_replace_header(
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/carmenbianca/.cache/pypoetry/virtualenvs/protokolo-Gp8COqWt-py3.11/lib/python3.11/site-packages/reuse/header.py", line 278, in find_and_replace_header
    before, after = _extract_shebang(shebang, after)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/carmenbianca/.cache/pypoetry/virtualenvs/protokolo-Gp8COqWt-py3.11/lib/python3.11/site-packages/reuse/header.py", line 221, in _extract_shebang
    return (shebang, text)
            ^^^^^^^
UnboundLocalError: cannot access local variable 'shebang' where it is not associated with a value
(protokolo-py3.11) 🐚 carmenbianca protokolo i18n $ reuse --version
reuse 3.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomersregressionRegression, something worked before, but not any more

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions