Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Add chmod builtin



On 16 Mar 2019, at 22:08, Matthew Martin <phy1729@xxxxxxxxx> wrote:
>Previously in #zsh "so sad that there is no zf_chmod". So here we are.

ty

One issue i mentioned when testing this is that it always follows symlinks
found in the tree when working recursively, which isn't how any real-world
chmod(1) works. The existing chown/chgrp built-ins have the same issue,
though, so it doesn't seem necessarily like a blocking thing.

>+if zmodload -e zsh/files && [[ $words[1] != */* ]]; then

I don't think this is reliable. It will detect any chmod as the built-in even
if only zf_chown is loaded (with -F). And `zmodload -e` always returns 1 for
modules loaded through selective auto-loading (-Fa), so it will *never*
detect the built-in in that case. (Not sure if that -e behaviour is intended?)

I know the $OSTYPE-$variant thing is dumb (should have passed $OSTYPE directly
to _pick_variant), but otherwise i think the method i used for distinguishing
the built-ins in _stat is fairly robust.

PS: Your patch seems to have corrupt white space

dana



Messages sorted by: Reverse Date, Date, Thread, Author