File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -540,19 +540,10 @@ pub mod utils {
540540 }
541541 }
542542 None => {
543- if base_path. is_dir ( ) {
544- if let Some ( parent) = base_path. parent ( ) {
545- file. strip_prefix ( parent)
546- . unwrap_or ( file)
547- . to_string_lossy ( )
548- . into_owned ( )
549- } else {
550- file. to_string_lossy ( ) . into_owned ( )
551- }
552- } else {
553- // For single files, preserve the full relative path
554- file. to_string_lossy ( ) . into_owned ( )
555- }
543+ // Always preserve the full relative path as specified
544+ // This ensures consistent behavior whether files were specified
545+ // individually or as part of a directory expansion
546+ file. to_string_lossy ( ) . into_owned ( )
556547 }
557548 } ;
558549
Original file line number Diff line number Diff line change 2323
2424# Duplicate paths test
2525./duplicate_paths.sh
26+
27+ # Path consistency test
28+ ./path_consistency.sh
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -xeu -o pipefail
4+
5+ # shellcheck source=tests/common.sh
6+ source " $( dirname " $0 " ) /common.sh"
7+
8+ TEST_DIR=" test_path_consistency"
9+
10+ # Clean up any previous test
11+ rm -rf " $TEST_DIR "
12+ mkdir -p " $TEST_DIR "
13+ cd " $TEST_DIR "
14+
15+ echo " Testing path consistency with wildcard expansion..."
16+
17+ # Create test directory structure like the user's case
18+ mkdir -p patch000/xxx
19+ echo " content1" > patch000/1.txt
20+ echo " content2" > patch000/2.txt
21+ echo " content3" > patch000/xxx/3.txt
22+
23+ # Test the issue: dat3 a patch000.dat patch000/*
24+ echo " Creating archive with patch000/* expansion..."
25+ " $DAT3 " a patch000.dat patch000/* -c9
26+
27+ echo " Listing archive contents..."
28+ " $DAT3 " l patch000.dat
29+
30+ # Check for path consistency - look for paths that don't start with patch000/
31+ echo " Checking path consistency..."
32+ if " $DAT3 " l patch000.dat | awk ' NR>2 {print $4}' | grep -v " ^patch000/" ; then
33+ echo " ERROR: Found paths that don't start with 'patch000/'"
34+ exit 1
35+ fi
36+
37+ # Verify all paths start with patch000/
38+ count=$( " $DAT3 " l patch000.dat | grep -c " patch000/" || true)
39+ if [ " $count " -ne 3 ]; then
40+ echo " ERROR: Expected 3 files with patch000/ prefix, found $count "
41+ " $DAT3 " l patch000.dat
42+ exit 1
43+ fi
44+
45+ echo " Path consistency test passed!"
46+
47+ # Clean up
48+ cd ..
49+ rm -rf " $TEST_DIR "
You can’t perform that action at this time.
0 commit comments