-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
-perm doesn't accept some valid symbolic modes #26
Comments
Thanks for the bug. I don't suppose you have ready access to a description
of how those operate? GNU find's documentation is rather lacking in this
area :-( the best I can find is chmod's description of symbolic modes, not
all of which are relevant to find...
I'm assuming +rwx is the equivalent of ugo+rwx and u=g means "where user
permissions = group permissions"?
…On Wed, Jun 14, 2017 at 11:26 PM, Tavian Barnes ***@***.***> wrote:
$ ./target/debug/find -perm +rwx
Error: invalid mode '+rwx'
$ ./target/debug/find -perm u+rwX
Error: invalid mode 'u+rwX'
$ ./target/debug/find -perm u=g
Error: invalid mode 'u=g'
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#26>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALbIF0C4Ett_PXtaVJsAL0l4JW4BFi7jks5sEF4JgaJpZM4N6hEW>
.
|
Luckily in this case we have the POSIX documentation:
In other words, the syntax is exactly the same as chmod. Since chmod symbolic modes actually specify a change to some existing permissions, you should interpret them as starting from 0000. The linked chmod docs go on to describe the exact grammar.
Yes,
Not exactly, |
Just a hint, while you can't just look at the GNU sources (without risking having to change the license), you could probably look at bsd find for help? On a similar note, I saw that the maintainer of GNU coreutils mentioned on a reddit[r] discussion of a similar project in go[g] (no find port, though) - that the GNU coreutils have an extensive test suite. The same seems to hold true for Gnu findutils as well: A set of tests written with Dejagnu[d]. While there's probably no license problems running this project through GNU tests (but care would have to be taken re-distributing Gnu tests) -- I see that the FreeBSD project has a test suite[w] using kyua[k] and ATF[a] - apparently inspired by the NetBSD test-suite. But FreeBSD doesn't have any tests for find (that I can see), but there are a handful for NetBSD (but not for symbolic permissions): https://github.com/IIJ-NetBSD/netbsd-src/blob/master/tests/usr.bin/find/t_find.sh NetBSD find handling of permissions: All in all, I'd say there'd be a use for a project dedicated to making a POSIX test-suite as a form of executable specification/documentation for this stuff - but that's at least a separate issue, probably a separate project. The Open Group apparently has such a test suite available, and as far as I can tell it's free for open source projects - but presumably not Free/redistributable (every developer/contributor would need to acquire a personal license?): http://www.opengroup.org/testing/testsuites/vscpcts2016.htm Apologies if this "drive-by essay" is a bit out of scope, but it appeared that at least looking at Net/FreeBSD might be of some help on some of these thornier syntax/behaviors. It would probably also be great to reach some consensus on test suites - both for BSD in particular and Free nix-likes in general. From a cursory look, I'd probably start with the NetBSD/FreeBSD tests - the GNU tests are quite extensive, but would appear to benefit from some modernization. [a] https://github.com/jmmv/atf/ |
@e12e thanks for all those links! I've also written what I believe is a correct implementation as part of a I also have a test suite for it that you can run against other tools with |
Thanks all. That's really helpful.
Now all I need is enough time to actually work on the project :-)
…On Wed, Jul 19, 2017 at 1:04 AM, Tavian Barnes ***@***.***> wrote:
@e12e <https://github.com/e12e> thanks for all those links!
I've also written what I believe is a correct implementation as part of a
find-compatible tool: https://github.com/tavianator/bfs/blob/
0fc17759476ca38f55b479a12d88f8a7614b7a3b/parse.c#L1382
I also have a test suite for it that you can run against other tools with ./tests.sh
--bfs=/path/to/find (pass --gnu or just --posix to run only those parts
of the test suite). In fact that's how I found most of the bugs I've
reported :) https://github.com/tavianator/bfs/blob/
0fc17759476ca38f55b479a12d88f8a7614b7a3b/tests.sh
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#26 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALbIFxfeUyGcJAvsFaG22PEZp8058Ybhks5sPUgXgaJpZM4N6hEW>
.
|
Also uutils/coreutils has an implementation: https://github.com/uutils/coreutils/blob/99af79a7fab9f43a5ab393637c96de513daab5e3/src/chmod/chmod.rs#L222 |
The text was updated successfully, but these errors were encountered: