TritonDataCenter / node-manta

Node.js SDK for Manta
75 stars 54 forks source link

mfind NotFound errors should not be fatal. #281

Closed bahamat closed 7 years ago

bahamat commented 8 years ago

When doing mfind, if a requested path doesn't exist it errors with NotFound. It's not even helpful enough to say which one was the problem.

In any event, it needs to chill out and return results for any paths that do exist and stop being so uptight about paths that don't.

trentm commented 8 years ago

From related discussion, 'mfind' behaviour could emulate find here:

[09:18:40 trentm@danger0:~/tmp/foo]
$ find a b c
a
a/a.txt
find: b: No such file or directory
c
c/c.txt
[09:18:43 trentm@danger0:~/tmp/foo]
$ echo $?
1
davepacheco commented 8 years ago

See also #224.

bahamat commented 8 years ago

224 is annoying, but it's worse (IMO) that it aborts everything. We often do things like mls ~~/stor/foo-{a,b}/2016/11/{02,03}/{00,01}. Sometimes we're doing it because there are automated processes storing the objects and we need to find which ones made it, so we won't even know which of foo-{a,b}, {02,03}, or {00,01} exist ahead of time. If NotFound is non-fatal then I'll at least see everything else that was found and I can infer what it is that wasn't.

arekinath commented 7 years ago

in https://cr.joyent.us/#/c/1594 I'm proposing that the behaviour will change to this:

$ mfind ~~/stor/foo
/awilson/stor/foo
$ mfind ~~/stor/notfound
mfind: in ~~/stor/notfound: NotFoundError
$ mfind ~~/stor/foo ~~/stor/notfound
/awilson/stor/foo
$ mfind ~~/stor/notfound /poseidon/stor
mfind: in /poseidon/stor: ForbiddenError

i.e. we only return NotFoundError if we didn't successfully find any results at all. And if we got any other error, we print that other error instead.

I'm also labelling errors with the path that caused them (the "in /...: " part)

arekinath commented 7 years ago

Now proposing this instead:

$ ./bin/mfind ~~/stor/notfound; echo $?
mfind: in ~~/stor/notfound: NotFoundError
1
$ ./bin/mfind ~~/stor/foo ~~/stor/notfound; echo $?
/awilson/stor/foo
mfind: in ~~/stor/notfound: NotFoundError
1
$ ./bin/mfind ~~/stor/notfound ~~/stor/foo; echo $?
mfind: in ~~/stor/notfound: NotFoundError
/awilson/stor/foo
1
$ ./bin/mfind ~~/public; echo $?
/user/public/foo
/user/public/mdb_v8_ia32.so
0
$ ./bin/mfind ~~/public /poseidon/stor; echo $?
mfind: in /poseidon/stor: ForbiddenError
1

Note that all mfind: prefixed lines are going to stderr.

trentm commented 7 years ago

+1 to that

arekinath commented 7 years ago

Released in 4.2.0