Skip to content

fix: refuse to cp a trailing '..' and same-path copies#31

Merged
dsherret merged 1 commit into
mainfrom
cp-same-path-guards
Jul 13, 2026
Merged

fix: refuse to cp a trailing '..' and same-path copies#31
dsherret merged 1 commit into
mainfrom
cp-same-path-guards

Conversation

@dsherret

Copy link
Copy Markdown
Owner

Follow-up to #30, mirroring review feedback on denoland/deno_task_shell#185.

  • cp now refuses a source with a trailing .. like the mv guard. Previously cp -r foo/.. dist computed the target as dist/.. (the destination's parent).
  • copying a path onto itself (cp -r public/. public, cp file file) now errors with 'x' and 'y' are the same file instead of relying on fs.cp/fs.copyFile behavior — a same-path copyFile can truncate the source.

@dsherret
dsherret merged commit 7e010b5 into main Jul 13, 2026
4 checks passed
@dsherret
dsherret deleted the cp-same-path-guards branch July 13, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant