enforce LC_ALL=C for ls, fix #1715#1716
Open
yangjuncode wants to merge 1 commit intortk-ai:masterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
enforce LC_ALL=C for ls, fix #1715
RTK
lsLocale Bug — Root Cause AnalysisSymptom
lsshows normal directory outputrtk lsreturns(empty)even when the directory contains filesRoot Cause
RTK's
lsparser relies on a date regex that only matches English month names (@src/cmds/system/ls.rs:15-18):This regex is used in
parse_ls_line()(@ls.rs:124) to anchor the line and extract the filename:When the system locale is non-English (e.g., Chinese
zh_CN.UTF-8),ls -laoutputs localized month names:The regex fails to match
5月(or any non-English month), soparse_ls_line()returnsNonefor every line. All lines are skipped bycontinueincompact_ls()(@ls.rs:166). With zero directories and zero files parsed, the function falls into the empty case (@ls.rs:193-195):