Commit 4c32ebc
authored
fix(uucore): use is_dir() instead of exists() for locale path resolution (#11851)
In release builds, resolve_locales_dir_from_exe_dir() used .exists()
to check for locale directories, which matches regular files (e.g.
binaries) too. When an individual utility binary like `target/release/wc`
exists alongside the multicall `coreutils` binary, the function
incorrectly treats it as a locale directory.
This causes setup_localization() to call init_localization() with a
wrong path, leading to a FluentBundle that may lack utility-specific
messages. The translate!() macro then returns the raw Fluent key
instead of the resolved message.
Observed in Debian builds where coreutils 0.8.0 is installed on the
host during the build, causing test_files0_stops_after_stdout_write_error
to fail because "wc-error-failed-to-print-result" is emitted verbatim
instead of "failed to print result for /dev/null".
Fix: use .is_dir() so only actual directories are accepted as locale
paths, allowing the embedded locale fallback to work correctly.1 parent 6995eb7 commit 4c32ebc
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
515 | 515 | | |
516 | 516 | | |
517 | 517 | | |
518 | | - | |
| 518 | + | |
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
525 | | - | |
| 525 | + | |
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
532 | | - | |
| 532 | + | |
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
| |||
0 commit comments