-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Gulp.src() doesn't follow symlinks #1273
Comments
Here is a console example of
Note
— much better, showing the actual file's permissions. So it's pretty clear that some underlying stuff doesn't follow symlinks. |
Use gulp.symlink not gulp.dest |
Eric, I'm not sure I understand you. You are advising to change something in the control script. Well, It's like having different soaps to wash hands at odd and even days of month. Symlinks are there to substitute files, a level of abstraction, you can symlink one file or all files, and the behavior of a system should be the same still. I have a feeling that you didn't read the issue. Closing the issue seems to me premature. |
Okay, I will re-open the issue because I must be misunderstanding you. Can you tell me if using gulp.symlink solves this problem? |
Thank you.
Does it make sense now? That said, I had no chance to test |
@OnkelTem Can you try all of this out on the latest version of gulp (on the 4.0 branch)? You can install it with |
Thanks for the quick reply, that way we will nail it down soon :) Just tried 4.0 branch, first with With
With
— the name is taken from the original file while created a symlink to original file. |
Branch 4.0It seems to me that confusion comes from
--- gulp-copy-symlink-demo/vinyl-fs.orig/lib/src/resolveSymlinks.js
+++ gulp-copy-symlink-demo/vinyl-fs/lib/src/resolveSymlinks.js
@@ -24,11 +24,20 @@
return cb(err);
}
+ // Save for later
+ var _base = globFile.base,
+ _path = globFile.path;
+
globFile.base = path.dirname(filePath);
globFile.path = filePath;
// recurse to get real file stat
resolveFile(globFile, enc, cb);
+
+ // restore
+ globFile.base = _base;
+ globFile.path = _path;
+
});
});
} IMHO this is what link following actually means, how it's implemented right now - is reading links. Branch 3.0In previous versions of function getStats() {
return through2.obj(fetchStats);
}
function fetchStats(file, enc, cb) {
fs.lstat(file.path, function (err, stat) {
if (stat) {
file.stat = stat;
}
cb(err, file);
});
} — i.e. no symlinks processing, stats are read directly from the |
@OnkelTem Nice! Want to send a PR? |
@contra sure, done. I hope this won't break something else. UPDATE. Hehe, and it did. |
I am pretty sure you are looking for the |
This issue has been opened on the vinyl-fs repo. Going to close this one. |
Original issue title: Incorrect permissions while copying symlinked files
If a file being copied by gulp is a symlink then the target gets
777
permissions.I created a repo to demonstrate this behavior: https://github.com/OnkelTem/gulp-copy-symlink-demo
So how to make it to follow symlinks to get correct
stats
?The text was updated successfully, but these errors were encountered: