On 6/17/19 12:18 PM, Stefan Reiter wrote:
> I just tested with '-e', it does not return true for a broken symlink.
> It does however return true for directories, which I'm not sure should be
> deleteable via the API? I think '-f' and '-l' are the better solution here.


unlink does nothing on directories, so that's a non issue.
But yes, you're right the symlink is followed in general:

> With the exception of the -l test they all follow symbolic links because they
> use stat() and not lstat() (so dangling symlinks can't be examined and will
> therefore report failure).
-- https://perldoc.perl.org/functions/-X.html

So yes, lets keep your proposed solution, it's fine here.

_______________________________________________
pve-devel mailing list
[email protected]
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to