File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
src/uucore/src/lib/features Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -696,7 +696,7 @@ pub fn path_ends_with_terminator(path: &Path) -> bool {
696696 path. as_os_str ( )
697697 . as_bytes ( )
698698 . last ( )
699- . is_some_and ( |& byte| byte == b'/' || byte == b'\\' )
699+ . is_some_and ( |& byte| byte == b'/' )
700700}
701701
702702#[ cfg( windows) ]
@@ -1053,6 +1053,7 @@ mod tests {
10531053 assert ! ( path_ends_with_terminator( Path :: new( "/some/path/" ) ) ) ;
10541054
10551055 // Path ends with a backslash
1056+ #[ cfg( windows) ]
10561057 assert ! ( path_ends_with_terminator( Path :: new( "C:\\ some\\ path\\ " ) ) ) ;
10571058
10581059 // Path does not end with a terminator
@@ -1064,6 +1065,7 @@ mod tests {
10641065
10651066 // Root path
10661067 assert ! ( path_ends_with_terminator( Path :: new( "/" ) ) ) ;
1068+ #[ cfg( windows) ]
10671069 assert ! ( path_ends_with_terminator( Path :: new( "C:\\ " ) ) ) ;
10681070 }
10691071
Original file line number Diff line number Diff line change @@ -7079,3 +7079,14 @@ fn test_cp_no_dereference_symlink_with_parents() {
70797079 . succeeds ( ) ;
70807080 assert_eq ! ( at. resolve_link( "x/symlink-to-directory" ) , "directory" ) ;
70817081}
7082+
7083+ #[ test]
7084+ #[ cfg( unix) ]
7085+ fn test_cp_recursive_files_ending_in_backslash ( ) {
7086+ let ts = TestScenario :: new ( util_name ! ( ) ) ;
7087+ let at = & ts. fixtures ;
7088+ at. mkdir ( "a" ) ;
7089+ at. touch ( "a/foo\\ " ) ;
7090+ ts. ucmd ( ) . args ( & [ "-r" , "a" , "b" ] ) . succeeds ( ) ;
7091+ assert ! ( at. file_exists( "b/foo\\ " ) ) ;
7092+ }
You can’t perform that action at this time.
0 commit comments