Skip to content

Fix file handling of --all-files to properly handle non-ascii filenames.#86

Merged
suo merged 3 commits into
suo:mainfrom
aorenste:main
May 8, 2026
Merged

Fix file handling of --all-files to properly handle non-ascii filenames.#86
suo merged 3 commits into
suo:mainfrom
aorenste:main

Conversation

@aorenste
Copy link
Copy Markdown
Contributor

@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).

@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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
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

@aorenste
Copy link
Copy Markdown
Contributor Author

aorenste commented Apr 8, 2026

@suo I just got bit by this again - I've rebased + updated. Let's try this again? (You should have access to my branch, I think)

@suo
Copy link
Copy Markdown
Owner

suo commented Apr 9, 2026

alright let's do the thing

@suo
Copy link
Copy Markdown
Owner

suo commented Apr 9, 2026

@aorenste some clippy checks?

@aorenste
Copy link
Copy Markdown
Contributor Author

aorenste commented Apr 9, 2026

@suo Ready for another CI run

@aorenste
Copy link
Copy Markdown
Contributor Author

aorenste commented May 6, 2026

@suo ping?

@suo
Copy link
Copy Markdown
Owner

suo commented May 7, 2026

lol sorry

aorenste added 3 commits May 7, 2026 09:59
Use `if let Some(val)` instead of `.is_some()` + `.unwrap()`.

Authored with Claude.
@aorenste
Copy link
Copy Markdown
Contributor Author

aorenste commented May 7, 2026

@suo fixed lint issues - approve again?

@suo suo merged commit 7eb7261 into suo:main May 8, 2026
15 checks passed
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