otiai10 / copy

Go copy directory recursively

Home Page:https://pkg.go.dev/github.com/otiai10/copy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

another recursive copy

enthor opened this issue · comments

Copy("test/data.copy", "test/data.copy/alltestdata")

Note: when I found the alltestdata and deleted it, MacOS refused to empty the trash
because "pathname too long". I tried sudo rm etc but "invalid operation". So the
solution if cannot empty trash: drag items out of trash to, say, Downloads and
then just "rm" them.

that's circular reference

Let me clarify your point.
Do you mean we, the package, should detect circular reference on behalf of package users?

ok, i defeated malicious symlinks - as far as I know.

see github.com/enthor/kmdrv0/kopy#testSkipBrokenSymlinks()

and test/data/broken/README.txt

The only "broken" symlinks which may safely be skipped are of the variety:

errors.Is(err, os.ErrNotExist)

Other os.Stat() errors -- when treating the Symlink as just a file -- cannot
be skipped safely because they may be of the variety "too many symlinks".
The process must be halted at that point, but at least the program errors out
and not the OS or a golang function, so the code would appear to be safe
from a hacker installing a malicious symlink.