fix(cli): preserve stdin directory probe traces
The directory-source migration initially skipped its C probe for stdin because stdin can never be a directory from the CLI's normal marker path. The original C source-open callback nevertheless called `UTIL_isDirectory` for every source, including the stdin marker, and file-stat trace tests rely on those calls being observable. Always invoke the private C directory probe before source opening and keep the same positive-result rejection. This preserves the trace side effect for stdin while retaining Rust ownership of the rejection decision and the old source open ordering. Test Plan: - `ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings` -- passed - `ulimit -v 41943040; cargo +nightly fmt --manifest-path rust/Cargo.toml --all -- --check` -- passed - `git diff --cached --check` -- passed - The capped upstream run exposed two stdin file-stat trace mismatches; the suite will be rerun after this compatibility fix.
This commit is contained in:
@@ -3080,13 +3080,11 @@ pub unsafe extern "C" fn FIO_rust_decompressFilename(
|
||||
assert!(!projection.dst_file_name.is_null());
|
||||
assert!(!projection.src_file_name.is_null());
|
||||
|
||||
if projection.source_is_stdin == 0 {
|
||||
let source_is_directory = projection
|
||||
.source_is_directory
|
||||
.expect("source directory callback is required for named files");
|
||||
if unsafe { source_is_directory(projection.opaque, projection.src_file_name) } != 0 {
|
||||
return 1;
|
||||
}
|
||||
let source_is_directory = projection
|
||||
.source_is_directory
|
||||
.expect("source directory callback is required");
|
||||
if unsafe { source_is_directory(projection.opaque, projection.src_file_name) } != 0 {
|
||||
return 1;
|
||||
}
|
||||
|
||||
let open_source = projection
|
||||
@@ -6067,6 +6065,16 @@ mod tests {
|
||||
assert!(state.events.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn decompress_file_policy_probes_stdin_marker_before_opening_source() {
|
||||
let mut state = DecompressPolicyState::default();
|
||||
let projection = decompress_policy_projection(&mut state, 0, 0, 1, 0, 0);
|
||||
|
||||
assert_eq!(unsafe { FIO_rust_decompressFilename(&projection) }, 0);
|
||||
assert_eq!(state.source_directory_checks, 1);
|
||||
assert_eq!(state.events[0], DECOMPRESS_POLICY_OPEN_SOURCE);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn decompress_file_policy_orders_cleanup_and_successful_source_removal() {
|
||||
let mut state = DecompressPolicyState {
|
||||
|
||||
Reference in New Issue
Block a user