reuse-tool icon indicating copy to clipboard operation
reuse-tool copied to clipboard

message to stderr if output IOErrors in lint

Open aspiers opened this issue 4 years ago • 5 comments

This is a specific fix for #266 that only covers the lint() output

Written by @fwolfst.

aspiers avatar Sep 05 '21 10:09 aspiers

Thanks for the contribution! Could you please provide a test case?

I used a large uncompliant repo and piped to head, but it failed with both your and @fwolfst's solution with the BrokenPipeError.

mxmehl avatar Sep 17 '21 14:09 mxmehl

What was the failure exactly? Worked nicely for me.

aspiers avatar Sep 17 '21 18:09 aspiers

I cloned go-gitea/gitea and ran reuse lint | head with your version:

$ reuse --version
reuse 0.13.1.dev20+ga26c2d5

$ reuse lint | head
# MISSING LICENSES

'MIT' found in:
* vendor/github.com/issue9/identicon/block.go
* vendor/github.com/issue9/identicon/doc.go
* vendor/github.com/issue9/identicon/identicon.go
* vendor/github.com/issue9/identicon/polygon.go


# MISSING COPYRIGHT AND LICENSING INFORMATION
Traceback (most recent call last):
  File "/home/max/Repositories/fsfe/reuse-tool/venv/bin/reuse", line 33, in <module>
    sys.exit(load_entry_point('reuse', 'console_scripts', 'reuse')())
  File "/home/max/Repositories/fsfe/reuse-tool/src/reuse/_main.py", line 256, in main
    return parsed_args.func(parsed_args, project, out)
  File "/home/max/Repositories/fsfe/reuse-tool/src/reuse/lint.py", line 335, in run
    result = lint(report, out=out)
  File "/home/max/Repositories/fsfe/reuse-tool/src/reuse/lint.py", line 32, in lint
    files_without_cali = lint_files_without_copyright_and_licensing(
  File "/home/max/Repositories/fsfe/reuse-tool/src/reuse/lint.py", line 220, in lint_files_without_copyright_and_licensing
    _write_element(file_, out=out)
  File "/home/max/Repositories/fsfe/reuse-tool/src/reuse/lint.py", line 20, in _write_element
    out.write(str(element))
BrokenPipeError: [Errno 32] Broken pipe

Can you confirm it?

mxmehl avatar Sep 20 '21 09:09 mxmehl

@aspiers Do you have time to answer Max's question and provide a test?

floriansnow avatar May 06 '22 06:05 floriansnow

Not in the next week or two unfortunately, but if no one else can help soon, then I would aim to do it at some point.

aspiers avatar May 06 '22 12:05 aspiers