You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bug when copying a directory containing a symlink onto itself (e.g., if you were making an rsync type utility):
If options.dereference is not set, then resolvedSrc and resolvedDest will always be equal - since they are the value of the symlink.
if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`))
}
this code needs to be changed to
if (options.dereference && stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
Probably a similar change is required here:
if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
The text was updated successfully, but these errors were encountered:
Confirmed bug; but we need something more complicated than your proposed fix. We can't simply ignore these checks when we're not dereferencing; just one example case:
There is a bug when copying a directory containing a symlink onto itself (e.g., if you were making an rsync type utility):
If
options.dereference
is not set, thenresolvedSrc
andresolvedDest
will always be equal - since they are the value of the symlink.this code needs to be changed to
Probably a similar change is required here:
The text was updated successfully, but these errors were encountered: