Skip to content

fix(ls): force LC_ALL=C for predictable parsing#463

Open
zhzy0077 wants to merge 1 commit intortk-ai:developfrom
zhzy0077:fix-ls-locale-empty-output
Open

fix(ls): force LC_ALL=C for predictable parsing#463
zhzy0077 wants to merge 1 commit intortk-ai:developfrom
zhzy0077:fix-ls-locale-empty-output

Conversation

@zhzy0077
Copy link

@zhzy0077 zhzy0077 commented Mar 10, 2026

On non-English locales (e.g. zh_CN), ls -la output has a different number of columns than the 9 columns assumed by compact_ls. This change forces the C locale to ensure consistent 9-column output for reliable parsing.

e.g. for chinese it's

> ls -lh /etc
总计 1.2M
-rw-r--r-- 1 root root    44  3月 9日 21:44 adjtime
drwxr-xr-x 1 root root    12  3月 9日 21:43 alsa
drwxr-xr-x 1 root root   122  3月10日 10:57 ananicy.d
-rw-r--r-- 1 root root     1 10月13日 00:21 arch-release
-rw-r--r-- 1 root root     0 2025年 4月 1日 arptables.conf

@pszymkowiak
Copy link
Collaborator

Hi! Thanks for the contribution! Since March 6, all PRs should target the develop branch instead of master (see CONTRIBUTING.md).

Could you update the base branch? Click Edit at the top right of this PR and change it from master to develop.

Thanks!

@zhzy0077 zhzy0077 changed the base branch from master to develop March 12, 2026 02:53
@zhzy0077
Copy link
Author

Hi! Thanks for the contribution! Since March 6, all PRs should target the develop branch instead of master (see CONTRIBUTING.md).

Could you update the base branch? Click Edit at the top right of this PR and change it from master to develop.

Thanks!

DONE. Thanks for the reminder.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@4fuu
Copy link

4fuu commented Mar 25, 2026

Hi @zhzy0077, apologies for the oversight — I opened #810 without noticing this PR already existed and addressed the same locale issue.

That said, #810 covers two additional bugs on top of the LC_ALL=C fix:

  1. Hidden files leaking without -a: rtk ls internally runs ls -la but never filtered out dotfile entries when show_all=false, so .dotnet/, .local/ etc. always appeared in the output.
  2. *.egg-info glob never matching: NOISE_DIRS contains "*.egg-info" but the filter used strict equality (==), so directories like mypackage.egg-info were never actually suppressed.

If you're open to it, it might make sense to close this PR in favor of #810 which bundles all three fixes together. Either way, thanks for finding and fixing the locale issue first — sorry again for the duplicate.

I've also added you as a co-author on the commit in #810 to make sure your contribution is properly credited.

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.

4 participants