-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.docsos-linuxLinuxLinuxos-windowsMicrosoft WindowsMicrosoft Windowsstandard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Description
Zig Version
0.12.0-dev.2018+9a56228c2
Steps to Reproduce and Observed Behavior
From a test in #17499 (cc @rootbeer):
test "makepath relative walks" {
if (builtin.os.tag == .wasi) return error.SkipZigTest;
var tmp = tmpDir(.{});
defer tmp.cleanup();
const relPath = try fs.path.join(testing.allocator, &.{
"first", "..", "second", "..", "third", "..", "first", "A", "..", "B", "..", "C",
});
defer testing.allocator.free(relPath);
try tmp.dir.makePath(relPath);
// verify created directories exist:
try expectDir(tmp.dir, "first" ++ fs.path.sep_str ++ "A");
try expectDir(tmp.dir, "first" ++ fs.path.sep_str ++ "B");
try expectDir(tmp.dir, "first" ++ fs.path.sep_str ++ "C");
try expectDir(tmp.dir, "second");
try expectDir(tmp.dir, "third");
}- On Linux, this test passes (it creates the
./first/A,./first/B,./first/C,./second, and./thirddirectories)- This seems to be due to
first/../secondbeing treated as different fromsecond(i.e...are not resolved before passing the path tomkdirat) - Very likely related: symlinks and ".." directories and platforms oh my! #7751 and std.fs.realpath bugs/inconsistencies on Windows #4658
- This seems to be due to
- On Windows, this test fails (it only creates
./first/C)- This is due to
..being collapsed/resolved duringsliceToPrefixedFilePathWbefore being passed toNtCreateFile(related: Relative paths on Windows: when to resolve . and .. ? #4659)
- This is due to
- Other platforms have not been tested
Expected Behavior
All platforms to have similar behavior
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.docsos-linuxLinuxLinuxos-windowsMicrosoft WindowsMicrosoft Windowsstandard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.