[erlang-patches] Support ** for recursion in filelib:wildcard

Daniel Luna daniel@REDACTED
Wed Mar 14 14:34:53 CET 2012


Just a comment, without reading the patch.

I don't know how this is done in bash, but in zsh there is also ***
expansion.  While ** expands to any level of directories, *** will
also include symbolic links in its expansion.  This is of course
"unsafe" in the sense that symlinked directories outside of the tree
you are working on will be included if there are links to the outside.
 It can also quite easily expand to an infinite size if there are
symlinks that point to any of their ancestors.

Not yet a suggestion for adding this feature to the patch, but at this
stage only a comment on the caveat of expanding symbolic links.

/Daniel


2012/3/14 José Valim <jose.valim@REDACTED>:
> Here is an updated patch for ** support in filelib:wildcard().
>
> git fetch git://github.com/josevalim/otp.git fixed_double_star
>
> https://github.com/josevalim/otp/compare/fixed_double_star
> https://github.com/josevalim/otp/compare/fixed_double_star.patch
>
> Quoting from bash documentation:
>
> Two adjacent *'s used as a single pattern will match all files and zero or
> more directories and subdirectories.
>
> I have tested this against Bash 4.2 implementation (previously I was using
> Ruby's implementation as basis). Since I didn't know there was a difference
> between Ruby and Bash, I removed any reference to Ruby in the commit
> message.
>
> I have also kept the current filelib:wildcard() behavior of returning files
> that start with dot ".". Bash by default does not return files starting with
> "." in wildcards.
>
> I have also improved the test coverage, documentation and added some
> examples.
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches
>



More information about the erlang-patches mailing list