crypto101/book

`find -E` is not avaliable in GNU find

bennyyip opened this issue · 8 comments

https://github.com/crypto101/book/blob/master/org2tex#L6
find -E is used here, but it is not part of GNU find.
See http://manpages.ubuntu.com/manpages/zesty/en/man1/find.1.html

It's not a big deal, just FYI.

lvh commented

I wonder how to make that consistent. I think the answer is "just use BREs", because GNU and BSD find both know about -regex.

dato commented

The following works on Linux:

".*org(-plus-contrib)?-[0-9]*")" → '.*org\(-plus-contrib\)?-[0-9]*')"

(i.e., just escaping the grouping brackets).

Could somebody check if it works in macOS, without -E?

On other news, BSD man pages say ? is a regular character in BRE and should be quoted for {0,1}. I don’t have access to check, but if ? gives trouble, a pragmatic suggestion would be to use * instead. 🙈

lvh commented

Wait, don't BREs consistently support {0,1} too? I mean, it'd have to be escaped to \{0,1\} I assume but...

Also, if you give up on making it work on random environments and only support docker builds I guess you can also ignore this problem because you only have to care about GNU find? (I'm usually on the compatibility bandwagon but I'm even more on the "Crypto101 needs a build script" bandwagon.)

dato commented

Wait, don't BREs consistently support {0,1} too? I mean, it'd have to be escaped to {0,1} I assume but...

It didn’t work for me for GNU find without -regextype posix-extended :-(

lvh commented

I don't have a Mac with emacs on it but I'm fixing that right now.

lvh commented

I can confirm macOS find, without -E, does not support ?. * works. I'm OK with either fix (breaking non-GNU find, or * instead of ?).

dato commented

I think probably enough users use macOS that it’d be nice not to break it. I can send a PR switching to BRE + '*' if you’d like, with a brief rationale in the commit message.

lvh commented

I look forward to merging it :)