Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
c2ef996
Initial commit
kimono-koans Sep 19, 2025
4f16995
Fix first test
kimono-koans Sep 19, 2025
d8dc0cb
Fix 2nd test for broken links
kimono-koans Sep 19, 2025
3918da7
Cleanup
kimono-koans Sep 19, 2025
6127017
Fix lints
kimono-koans Sep 19, 2025
ba59811
Cleanup
kimono-koans Sep 19, 2025
2355369
Remove the need to pass around out bufwriter
kimono-koans Sep 19, 2025
3c42725
Cleanup
kimono-koans Sep 19, 2025
f8fc4a9
Cleanup
kimono-koans Sep 19, 2025
18ab2e0
Cleanup
kimono-koans Sep 19, 2025
0914fca
Do not re request metadata for coloring
kimono-koans Sep 19, 2025
106dfd2
Using DirEntry forces more metadata syscalls
kimono-koans Sep 19, 2025
70cf0b1
Cleanup
kimono-koans Sep 19, 2025
a97cadd
Cleanup lints
kimono-koans Sep 19, 2025
1c4d108
Merge branch 'main' into lazily_obtain_file_type
kimono-koans Sep 19, 2025
97d7d47
Merge branch 'main' into lazily_obtain_file_type
kimono-koans Sep 20, 2025
8bd40c8
Lazily obtain security context
kimono-koans Sep 21, 2025
7a95cb3
Cleanup
kimono-koans Sep 21, 2025
cd15f48
Cleanup
kimono-koans Sep 21, 2025
2625cfe
Merge branch 'main' into lazily_obtain_file_type
kimono-koans Sep 21, 2025
c42295a
Fix lints
kimono-koans Sep 21, 2025
758022a
Fix lints
kimono-koans Sep 22, 2025
34cbcb3
Perhaps fix GNU test
kimono-koans Sep 22, 2025
264a431
Revert "Perhaps fix GNU test"
kimono-koans Sep 22, 2025
1b85fd8
Fix GNU test
kimono-koans Sep 22, 2025
c9fa581
Try again to pass GNU test
kimono-koans Sep 22, 2025
025136a
Cleanup
kimono-koans Sep 22, 2025
e347761
Merge branch 'uutils:main' into lazily_obtain_file_type
kimono-koans Sep 22, 2025
aed0445
Cleanup
kimono-koans Sep 22, 2025
ba222c4
Cleanup
kimono-koans Sep 22, 2025
1a7ead9
Reduce unnecessary metadata calls re: symlink targets
kimono-koans Sep 22, 2025
c1446dd
No need to call functions twice
kimono-koans Sep 22, 2025
16bca97
Reduce size of PathData struct by more than 1000 bytes
kimono-koans Sep 22, 2025
51ede86
Merge branch 'main' into lazily_obtain_file_type
kimono-koans Sep 22, 2025
fdd99f6
Fix lints
kimono-koans Sep 22, 2025
a56e6b4
Fix GNU test?
kimono-koans Sep 22, 2025
8cc6772
Fix lints
kimono-koans Sep 22, 2025
5cfc351
Cleanup
kimono-koans Sep 23, 2025
313b8d6
Fix lint
kimono-koans Sep 23, 2025
c10a6f8
Cleanup
kimono-koans Sep 23, 2025
924e183
Never make a syscall when some non-deref metadata is available
kimono-koans Sep 23, 2025
e72dd91
Lazily wait for file_type and metadata
kimono-koans Sep 23, 2025
41afd56
Cleanup
kimono-koans Sep 23, 2025
3360ae4
Cleanup
kimono-koans Sep 23, 2025
ed63bf5
Cleanup
kimono-koans Sep 23, 2025
e504572
Cleanup
kimono-koans Sep 23, 2025
1970a94
Fix lints
kimono-koans Sep 23, 2025
c316a16
Fix lints
kimono-koans Sep 23, 2025
290e8b4
Fix lints
kimono-koans Sep 23, 2025
3b90412
Fix lints
kimono-koans Sep 23, 2025
dd78a35
Fix lints
kimono-koans Sep 23, 2025
c1623e1
Merge branch 'main' into lazily_obtain_file_type
kimono-koans Sep 23, 2025
9c37a8e
Merge branch 'main' into lazily_obtain_file_type
kimono-koans Sep 24, 2025
e205d76
Initial commit
kimono-koans Sep 24, 2025
d8ef736
Cleanup hot path
kimono-koans Sep 24, 2025
f3c2b83
Cleanup
kimono-koans Sep 24, 2025
958f950
Fix GNU test?
kimono-koans Sep 24, 2025
14aff2b
Fix lints
kimono-koans Sep 24, 2025
476c0cf
Merge branch 'main' into lazily_obtain_file_type
kimono-koans Sep 24, 2025
42c7568
No need to convert to strings
kimono-koans Sep 24, 2025
3c0e32f
Cleanup
kimono-koans Sep 24, 2025
4775608
Remove dep for non-Windows platforms which causes additional statx calls
kimono-koans Sep 24, 2025
6bb52bb
Fix lints
kimono-koans Sep 24, 2025
77fa475
Fix lints
kimono-koans Sep 24, 2025
20ffda3
Fix lints
kimono-koans Sep 24, 2025
1254352
Merge branch 'main' into lazily_obtain_file_type
kimono-koans Sep 24, 2025
dac83bd
Fix lints
kimono-koans Sep 24, 2025
acf6635
Merge branch 'lazily_obtain_file_type' of https://github.com/kimono-k…
kimono-koans Sep 24, 2025
1eb4193
Revert "Fix lints"
kimono-koans Sep 24, 2025
99f0fed
Revert "Fix lints"
kimono-koans Sep 24, 2025
d064a9f
Revert "Fix lints"
kimono-koans Sep 24, 2025
e9447a4
Revert "Fix lints"
kimono-koans Sep 24, 2025
cb90d1d
Revert "Remove dep for non-Windows platforms which causes additional …
kimono-koans Sep 24, 2025
bc7e878
Merge branch 'uutils:main' into create_fewer_small_strings
kimono-koans Sep 24, 2025
0dd0709
Merge branch 'lazily_obtain_file_type' into create_fewer_small_strings
kimono-koans Sep 24, 2025
9081262
Revert "Merge branch 'uutils:main' into create_fewer_small_strings"
kimono-koans Sep 24, 2025
905173e
Merge branch 'create_fewer_small_strings' of https://github.com/kimon…
kimono-koans Sep 24, 2025
3f0fe76
Revert "Merge branch 'create_fewer_small_strings' of https://github.c…
kimono-koans Sep 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,6 @@ jobs:
echo "Running benchmarks for packages: ${{ steps.benchmark_list.outputs.benchmark_packages }}"
for package in ${{ steps.benchmark_list.outputs.benchmark_packages }}; do
echo "Running benchmarks for $package"
cargo codspeed run -p $package > /dev/null
cargo codspeed run -p $package
done
token: ${{ secrets.CODSPEED_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/GnuTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ env:
TEST_ROOT_FULL_SUMMARY_FILE: 'gnu-root-full-result.json'
TEST_SELINUX_FULL_SUMMARY_FILE: 'selinux-gnu-full-result.json'
TEST_SELINUX_ROOT_FULL_SUMMARY_FILE: 'selinux-root-gnu-full-result.json'
REPO_GNU_REF: "v9.8"
REPO_GNU_REF: "v9.7"

jobs:
native:
Expand Down
20 changes: 11 additions & 9 deletions .vscode/cspell.dictionaries/acronyms+names.wordlist.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# * abbreviations / acronyms
aarch
AIX
ASLR # address space layout randomization
AST # abstract syntax tree
Expand All @@ -10,34 +9,35 @@ DevOps
Ext3
FIFO
FIFOs
flac
FQDN # fully qualified domain name
GID # group ID
GIDs
GNU
GNUEABI
GNUEABIhf
impls
JFS
loongarch
lzma
MSRV # minimum supported rust version
MSVC
NixOS
POSIX
POSIXLY
ReiserFS
RISC
RISCV
RNG # random number generator
RNGs
ReiserFS
Solaris
UID # user ID
UIDs
UUID # universally unique identifier
WASI
WASM
XFS
aarch
flac
impls
lzma
loongarch

# * names
BusyBox
Expand All @@ -48,23 +48,25 @@ Deno
EditorConfig
EPEL
FreeBSD
genric
Gmail
GNU
Illumos
Irix
libfuzzer
MS-DOS
MSDOS
MacOS
MinGW
Minix
MS-DOS
MSDOS
NetBSD
Novell
Nushell
OpenBSD
POSIX
PowerPC
SELinux
SkyPack
Solaris
SysV
Xenix
Yargs
Expand Down
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/uu/id/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ id-error-cannot-find-user-name = cannot find name for user ID { $uid }
id-error-audit-retrieve = couldn't retrieve information

# Help text for command-line arguments
id-help-ignore = ignore, for compatibility with other versions
id-help-audit = Display the process audit user ID and other process audit properties,
which requires privilege (not available on Linux).
id-help-user = Display only the effective user ID as a number.
Expand Down
1 change: 0 additions & 1 deletion src/uu/id/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ id-error-cannot-find-user-name = impossible de trouver le nom pour l'ID utilisat
id-error-audit-retrieve = impossible de récupérer les informations

# Texte d'aide pour les arguments de ligne de commande
id-help-ignore = ignore, pour compatibilité avec d'autres versions
id-help-audit = Affiche l'ID utilisateur d'audit du processus et autres propriétés d'audit,
ce qui nécessite des privilèges (non disponible sous Linux).
id-help-user = Affiche uniquement l'ID utilisateur effectif sous forme de nombre.
Expand Down
8 changes: 0 additions & 8 deletions src/uu/id/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ fn get_context_help_text() -> String {
}

mod options {
pub const OPT_IGNORE: &str = "ignore";
pub const OPT_AUDIT: &str = "audit"; // GNU's id does not have this
pub const OPT_CONTEXT: &str = "context";
pub const OPT_EFFECTIVE_USER: &str = "user";
Expand Down Expand Up @@ -354,13 +353,6 @@ pub fn uu_app() -> Command {
.infer_long_args(true)
.args_override_self(true)
.after_help(translate!("id-after-help"))
.arg(
Arg::new(options::OPT_IGNORE)
.short('a')
.long(options::OPT_IGNORE)
.help(translate!("id-help-ignore"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::OPT_AUDIT)
.short('A')
Expand Down
110 changes: 69 additions & 41 deletions src/uu/ls/src/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

// spell-checker:ignore (ToDO) somegroup nlink tabsize dired subdired dtype colorterm stringly nohash strtime

use std::borrow::Cow;
#[cfg(unix)]
use std::collections::HashMap;
#[cfg(unix)]
Expand Down Expand Up @@ -2173,10 +2174,8 @@
// https://github.com/rust-lang/glob/issues/23
// https://github.com/rust-lang/glob/issues/78
// https://github.com/BurntSushi/ripgrep/issues/1250
let file_name = match file_name.to_str() {
Some(s) => s.to_string(),
None => file_name.to_string_lossy().into_owned(),
};
let file_name = file_name.to_string_lossy();

!config
.ignore_patterns
.iter()
Expand Down Expand Up @@ -2320,10 +2319,42 @@
}
SizeOrDeviceId::Size(size) => (size.len(), 0usize, 0usize),
};

let long_format = &config.long;
let numeric_uid_gid;

#[cfg(unix)]
{
numeric_uid_gid = long_format.numeric_uid_gid;
}

#[cfg(not(unix))]
{
numeric_uid_gid = false;
}

let display_symlink_count = if numeric_uid_gid {
display_symlink_count(md).len()
} else {
0
};

let display_uname = if long_format.owner {
display_uname(md, config, state).len()
} else {
0
};

let display_group = if long_format.group {
display_group(md, config, state).len()
} else {
0
};

(
display_symlink_count(md).len(),
display_uname(md, config, state).len(),
display_group(md, config, state).len(),
display_symlink_count,
display_uname,
display_group,
size_len,
major_len,
minor_len,
Expand Down Expand Up @@ -2358,7 +2389,7 @@

// TODO: Consider converting callers to use ExtendPad instead, as it avoids
// additional copies.
fn pad_left(string: &str, count: usize) -> String {
fn pad_left<T: std::fmt::Display>(string: &T, count: usize) -> String {
format!("{string:>count$}")
}

Expand Down Expand Up @@ -2395,19 +2426,20 @@
{
if config.inode {
let i = if let Some(md) = item.get_metadata(out) {
get_inode(md)
&display_inode(md)
} else {
"?".to_owned()
"?"
};

write!(result, "{} ", pad_left(&i, padding.inode)).unwrap();
}
}

if config.alloc_size {
let s = if let Some(md) = item.get_metadata(out) {
display_size(get_block_size(md, config), config)
&display_size(get_block_size(md, config), config)
} else {
"?".to_owned()
"?"
};
// extra space is insert to align the sizes, as needed for all formats, except for the comma format.
if config.format == Format::Commas {
Expand Down Expand Up @@ -2629,10 +2661,7 @@
};

// FIXME: the Grid crate only supports &str, so can't display raw bytes
let names: Vec<_> = names
.into_iter()
.map(|s| s.to_string_lossy().into_owned())
.collect();
let names: Vec<Cow<str>> = names.iter().map(|s| s.to_string_lossy()).collect();

// Since tab_size=0 means no \t, use Spaces separator for optimization.
let filling = match tab_size {
Expand Down Expand Up @@ -3017,26 +3046,26 @@
return md.mode() & ((S_IXUSR | S_IXGRP | S_IXOTH) as u32) != 0;
}

fn classify_file(path: &PathData, out: &mut BufWriter<Stdout>) -> Option<char> {
fn classify_file<'a>(path: &'a PathData, out: &mut BufWriter<Stdout>) -> Option<&'a str> {
let file_type = path.file_type(out)?;

if file_type.is_dir() {
Some('/')
Some("/")
} else if file_type.is_symlink() {
Some('@')
Some("@")
} else {
#[cfg(unix)]
{
if file_type.is_socket() {
Some('=')
Some("=")
} else if file_type.is_fifo() {
Some('|')
Some("|")
} else if file_type.is_file()
// Safe unwrapping if the file was removed between listing and display
// See https://github.com/uutils/coreutils/issues/5371
&& path.get_metadata(out).is_some_and(file_is_executable)
{
Some('*')
Some("*")
} else {
None
}
Expand Down Expand Up @@ -3100,27 +3129,27 @@
if config.indicator_style != IndicatorStyle::None {
let sym = classify_file(path, &mut state.out);

let char_opt = match config.indicator_style {
let char_opt: Option<&str> = match config.indicator_style {
IndicatorStyle::Classify => sym,
IndicatorStyle::FileType => {
// Don't append an asterisk.
match sym {
Some('*') => None,
Some("*") => None,
_ => sym,
}
}
IndicatorStyle::Slash => {
// Append only a slash.
match sym {
Some('/') => Some('/'),
Some("/") => Some("/"),
_ => None,
}
}
IndicatorStyle::None => None,
};

if let Some(c) = char_opt {
name.push(OsStr::new(&c.to_string()));
name.push(c);
}
}

Expand Down Expand Up @@ -3190,13 +3219,12 @@
if config.context {
if let Some(pad_count) = prefix_context {
let security_context = if matches!(config.format, Format::Commas) {
path.security_context.clone()
&path.security_context
} else {
pad_left(&path.security_context, pad_count)
&pad_left(&path.security_context, pad_count)
};
let old_name = name;
name = format!("{security_context} ").into();
name.push(old_name);
let old_name = name.to_string_lossy();
name = format!("{security_context} {old_name}").into();
}
}

Expand All @@ -3216,16 +3244,16 @@
let unencoded_chars = "_-.:~/\\";

// percentage encoding of path
let absolute_path: String = absolute_path
.chars()
.map(|c| {
if c.is_alphanumeric() || unencoded_chars.contains(c) {
c.to_string()
} else {
format!("%{:02x}", c as u8)
}
})
.collect();
let absolute_path: String = absolute_path.chars().fold(String::new(), |mut acc, c| {
if c.is_alphanumeric() || unencoded_chars.contains(c) {
acc.push(c);
} else {
let x = format!("%{:02x}", c as u8);
acc.push_str(&x);
};

Check failure on line 3253 in src/uu/ls/src/ls.rs

View workflow job for this annotation

GitHub Actions / Style and Lint (ubuntu-24.04, unix)

ERROR: `cargo clippy`: unnecessary semicolon (file:'src/uu/ls/src/ls.rs', line:3253)

acc
});

// \x1b = ESC, \x07 = BEL
let mut ret: OsString = format!("\x1b]8;;file://{hostname}{absolute_path}\x07").into();
Expand Down
9 changes: 0 additions & 9 deletions src/uu/numfmt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ uucore = { workspace = true, features = ["parser", "ranges"] }
thiserror = { workspace = true }
fluent = { workspace = true }

[dev-dependencies]
divan = { workspace = true }
tempfile = { workspace = true }
uucore = { workspace = true, features = ["benchmark"] }

[[bin]]
name = "numfmt"
path = "src/main.rs"

[[bench]]
name = "numfmt_bench"
harness = false
Loading
Loading