-
Notifications
You must be signed in to change notification settings - Fork 628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
walk
and walkSync
skip over symlinks when followSymlinks: false
#1359
Comments
Forget the deleted comment, my mistake. The "if not follow symlink then continue (skip)" logic actually dates back to the initial Would someone who knows the background explain the decision behind this? It seems like an easy fix (just remove the |
Here is some more context from the duplicate issue I posed: This is really 2 issues:
Steps to Reproduce // walkTest.ts
import * as fs from "https://deno.land/std@0.142.0/fs/mod.ts";
fs.emptyDirSync("dir");
fs.ensureFileSync("dir/files/a.txt");
Deno.writeTextFileSync("dir/files/a.txt", "A");
// FIXME: See https://github.com/denoland/deno_std/issues/2312
// fs.ensureSymlinkSync("../files/a.txt", "dir/links/a.txt");
fs.ensureDirSync("dir/links");
await Deno.run({
cmd: ["ln", "-s", "../files/a.txt", "dir/links/a.txt"],
}).status();
/*
dir
├── files
│ └── a.txt
└── links
└── a.txt -> ../files/a.txt
*/
console.log(">>> followSymlinks: false >>>>");
for (const f of fs.walkSync("dir", { followSymlinks: false })) {
console.log(f); // dir/links/a.txt is not returned
}
console.log(">>> followSymlinks: true >>>>");
for (const f of fs.walkSync("dir", { followSymlinks: true })) {
console.log(f);
// returns:
// {
// path: "/home/joe/tmp/walkTest/dir/files/a.txt", <-- this is the path to the destination, not the link file.
// name: "a.txt",
// isFile: false,
// isDirectory: false,
// isSymlink: true <-- "path" is a file, not a symlink
// }
} Expected behavior
{
path: "dir/links/a.txt",
name: "a.txt",
isFile: true,
isDirectory: false,
isSymlink: true
}
{
path: "/home/joe/tmp/walkTest/dir/files/a.txt",
name: "a.txt",
isFile: true,
isDirectory: false,
isSymlink: false
} |
Symbolic links were not returned. This means that `walk()` is not listing all the contents of a directory. Some use cases for this is are: - Copying a directory recursively. - Finding invalid symbolic links. - Modify link targets without resolving them. Other changes: - walk_test.ts: Rename `walkArray()` to `collectPaths()` because it is more descriptive. - walk_test.ts: Add `collectEntries()`
Symbolic links were not returned. This means that `walk()` is not listing all the contents of a directory. Some use cases for this is are: - Copying a directory recursively. - Finding invalid symbolic links. - Modify link targets without resolving them. Other changes: - walk_test.ts: Rename `walkArray()` to `collectPaths()` because it is more descriptive. - walk_test.ts: Add `collectEntries()`
Symbolic links were not returned. This means that `walk()` is not listing all the contents of a directory. Some use cases for this is are: - Copying a directory recursively. - Finding invalid symbolic links. - Modify link targets without resolving them. Other changes: - walk_test.ts: Rename `walkArray()` to `collectPaths()` because it is more descriptive. - walk_test.ts: Add `collectEntries()`
Symbolic links were not returned. This means that `walk()` is not listing all the contents of a directory. Some use cases for this is are: - Copying a directory recursively. - Finding invalid symbolic links. - Modify link targets without resolving them. Other changes: - walk_test.ts: Rename `walkArray()` to `collectPaths()` because it is more descriptive. - walk_test.ts: Add `collectEntries()`
fixed in #3464 Now |
Instead I would expect symlinks to be yielded just like files: if
includeSymlinks
is set & the symlink matches theexts
,match
, andskip
options.The text was updated successfully, but these errors were encountered: