Repository navigation
rtk ls returns "(empty)" with non-English locales (LANG=de_DE.UTF-8, fr_FR.UTF-8) #1475
Description
Summary
rtk ls silently returns "(empty)" on any directory when LANG is set to a non-English UTF-8 locale. Exit code is 0, no error message. The parser appears to be hardcoded to English/C locale output formats.
Environment
- rtk 0.37.2 (installed via Homebrew)
- macOS (Apple Silicon)
- iTerm2 with "Set locale environment variables automatically" enabled (iTerm's default behavior on systems with non-English system language)
Minimal Reproduction
mkdir /tmp/rtk-bugtest
cd /tmp/rtk-bugtest
touch a.txt b.txt c.txt
mkdir src
# Works correctly:
env -i HOME=$HOME PATH=/opt/homebrew/bin:/usr/bin:/bin \
LANG=en_US.UTF-8 rtk ls /tmp/rtk-bugtest
# Output:
# src/
# a.txt 0B
# b.txt 0B
# c.txt 0B
# Summary: 3 files, 1 dirs (3 .txt)
env -i HOME=$HOME PATH=/opt/homebrew/bin:/usr/bin:/bin \
LANG=C.UTF-8 rtk ls /tmp/rtk-bugtest
# Output: same as above, correct
# Broken:
env -i HOME=$HOME PATH=/opt/homebrew/bin:/usr/bin:/bin \
LANG=de_DE.UTF-8 rtk ls /tmp/rtk-bugtest
# Output: (empty)
# Exit code: 0
env -i HOME=$HOME PATH=/opt/homebrew/bin:/usr/bin:/bin \
LANG=fr_FR.UTF-8 rtk ls /tmp/rtk-bugtest
# Output: (empty)
# Exit code: 0Root Cause Analysis
macOS ls -l produces locale-dependent output:
LANG=en_US.UTF-8:Apr 23 14:55LANG=de_DE.UTF-8:23 Apr. 14:55(different order, period after month abbreviation)LANG=fr_FR.UTF-8:23 avril 14:55
File size formatting also differs (e.g. 1.5K vs 1,5K with comma as decimal separator).
rtk's ls output parser appears to only match English-locale formats, resulting in zero parsed entries → (empty) displayed regardless of actual directory contents.
Debug Notes
- Other rtk subcommands (
rtk git status,rtk git log, etc.) work correctly under all locales — onlyrtk lsis affected RUST_BACKTRACE=fullproduces no output (silent failure)-vvvflag also produces no debug info- Exit code is always 0, masking the failure from callers
Impact
Affects all users in non-English locales. On macOS, iTerm2's "Set locale environment variables automatically" (the default) propagates the system language as LANG, so any user with a non-English macOS installation hits this. Estimated significant portion of the user base.
Suggested Fix
Spawn the ls subprocess with a forced C/English locale to get parseable, locale-independent output:
Command::new("ls")
.env("LC_ALL", "C")
.args(...)
.output()This is the same pattern git, cargo, and most locale-sensitive CLI tools use internally. The user's locale is preserved for their own interactive shell; only the tool's internal ls invocation runs in C.
Workaround
Until fixed, users in non-English locales can either:
- Change iTerm2 (or their terminal) locale setting to English
- Wrap rtk in shell config:
rtk() { LC_ALL=en_US.UTF-8 command rtk "$@"; }
Activity
pszymkowiak commentedon Apr 23, 2026
🔍 Automated Triage
bughighSummary
rtk ls parser is hardcoded to English locale output; fix by spawning the ls subprocess with LC_ALL=C — note similarity to #2058 (same empty-output symptom, different trigger)
📁 Relevant files
src/commands/ls.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
juanlopez87 commentedon Apr 23, 2026
Using rtk on CachyOS/OpenCode. If anyone is having issues, here is a quick fix using a fish function to set LC_TIME=C:
Works perfectly for me!
aeppling commentedon Apr 24, 2026
#1338 on it
rushabhpasad commentedon Apr 30, 2026
Workaround
For affected users, setting
LC_ALL=Cin Claude Code'ssettings.jsonenvblock scopes the locale override to bash tool calls and restoresrtk ls:{ "env": { "LC_ALL": "C" } }Verified working
aeppling commentedon May 6, 2026
Should be resolved in #1692 aka 0.39.0
shalk commentedon May 27, 2026
hi @aeppling Look like rtk is rely on LANG=C
so Is #1692 work on this ? and 1692 is merged.
for my case #1266 My LANG is
zh_CN.UTF-8so i can close my pr and this issue can be closed ?aeppling commentedon Jun 3, 2026
@shalk Two separate things:
This issue (rtk ls empty on non-English locales) is fixed by #1692 (0.39.0): ls now runs with LC_ALL=C and falls back to raw output on unrecognized locales. Closing.
Your PR #1266 is a different bug. The commit-hash parser in git.rs byte-slices hash[..7], which still panics on [master(根提交) fb597ec] on current develop. The ls locale fix does not cover it, and commit messages and branch names can contain multibyte chars regardless of locale. Please keep #1266 open, I've reviewed it and we want to merge it.