utilities always open and parse translation files, even when they're not needed
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
When tracing (via strace) the uutils coreutils, I've noticed that they always open and fully read the translation files, for example:
$ strace -e trace=open,openat,read -- target/debug/cat /dev/null
...
openat(AT_FDCWD, "/home/andrea/src/coreutils/src/uucore/locales/en-US.ftl", O_RDONLY|O_CLOEXEC) = 3
read(3, "# Common strings shared across a"..., 2553) = 2553
read(3, "", 32) = 0
openat(AT_FDCWD, "/home/andrea/src/coreutils/src/uucore/../uu/cat/locales/en-US.ftl", O_RDONLY|O_CLOEXEC) = 3
read(3, "cat-about = Concatenate FILE(s),"..., 965) = 965
read(3, "", 32) = 0
openat(AT_FDCWD, "/home/andrea/src/coreutils/src/uucore/locales/en-US.ftl", O_RDONLY|O_CLOEXEC) = 3
read(3, "# Common strings shared across a"..., 2553) = 2553
read(3, "", 32) = 0
openat(AT_FDCWD, "/home/andrea/src/coreutils/src/uucore/../uu/cat/locales/en-US.ftl", O_RDONLY|O_CLOEXEC) = 3
read(3, "cat-about = Concatenate FILE(s),"..., 965) = 965
read(3, "", 32) = 0
openat(AT_FDCWD, "/dev/null", O_RDONLY|O_CLOEXEC) = 3
read(3, "", 65536) = 0
+++ exited with 0 +++
In release mode, it seems like the tools can't generate the correct path (this happens both when building using cargo run --release from a fresh checkout, and also with the version of coreutils shipped with Ubuntu 25.10), but that's a separate problem from the one in this bug report:
$ strace -e trace=open,openat,read -- target/release/cat /dev/null
...
openat(AT_FDCWD, "/home/andrea/src/coreutils/target/release/cat/en-US.ftl", O_RDONLY|O_CLOEXEC) = -1 ENOTDIR (Not a directory)
openat(AT_FDCWD, "/home/andrea/src/coreutils/target/release/cat/en-US.ftl", O_RDONLY|O_CLOEXEC) = -1 ENOTDIR (Not a directory)
openat(AT_FDCWD, "/dev/null", O_RDONLY|O_CLOEXEC) = 3
read(3, "", 65536) = 0
+++ exited with 0 +++
In the majority of the cases however, the utilities don't need any of these messages: most utilities in fact won't ever print a message when used correctly. Utilities only print messages when (1) the user specifies --help or similar, or (2) an error has occurred. For most scripts, these two scenarios are relatively rare. I believe that implementing a "lazy loading" strategy for translation would give a significant performance boost for all utilities.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the provided strace command against target/debug/cat and target/release/cat, then trace where the uutils coreutils translation files are loaded. Compare the normal execution path with --help and error paths. Done means ordinary successful invocations no longer open or read translation files, while messages remain available when needed and the release-path issue is addressed or clearly separated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, localization, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100