Skip to content

Conversation

@aorenste
Copy link

@aorenste aorenste commented Apr 18, 2025

On my setup lintrunner was failing like this:

(py39) $ lintrunner --take RUFF --all-files
error:        No such file or directory (os error 2)

The underlying error was because there's a file with non-ascii characters in the name.

There are two problems:

  1. When a file reported by git wasn't found it was reporting the error without any context about the filename.
  2. The files being returned by git are escaped by git and then passed through a utf-8 String.

This PR adds context for the names so when an error does occur the user can at least tell what file had the problem.

Additionally it changes how --all-files gets its filenames so it doesn't pass them through String (which incorrectly does utf-8 encoding on them).

There are some additional incorrect handling of paths in other areas of the code (get_paths_from_cmd for example) which should probably be fixed in a similar manner in the future (or maybe merged with the all-files handling).

Summary:

Test Plan: unit tests

Reviewers:

Subscribers:

Tasks:

Tags:
@aorenste aorenste changed the title Fix file handling of --all-files to properly handle non-utf8 filenames. Fix file handling of --all-files to properly handle non-ascii filenames. Apr 18, 2025
@suo
Copy link
Owner

suo commented May 8, 2025

sorry for the late response—I ran the CI, mind taking a look at the issues?

@aorenste
Copy link
Author

aorenste commented May 8, 2025

@suo Huh. Looks like a bunch of the CI is failing with an infra issue:

Getting action download info
Error: This request has been automatically failed because it uses a deprecated version of `actions/upload-artifact: v3`. Learn more: https://github.blog/changelog/[20](https://github.com/suo/lintrunner/actions/runs/14915998547/job/41902324071?pr=86#step:1:24)24-04-16-deprecation-notice-v3-of-the-artifact-actions/

@suo
Copy link
Owner

suo commented Jun 19, 2025

Can you give me permission to push to your branch? I want to try rebasing to see if that fixes things

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants