]> dgit.raspbian.org Git - git-annex.git/commit
adb: Avoid find failing with "Argument list too long"
authorJoey Hess <joeyh@joeyh.name>
Mon, 31 Jan 2022 17:19:09 +0000 (13:19 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 31 Jan 2022 17:19:09 +0000 (13:19 -0400)
commita32ff6cef03ceb695af7bc6415ae7eaac06d3443
tree3b22e2b937a66217b7ce2ef75e727bcad02b3d46
parent8f3d48c5cf6f0f83096e3d0860a2c4711447bad8
adb: Avoid find failing with "Argument list too long"

The "+" argument only runs the command once, so is not safe to use. Using
";" instead would have been the simplest fix, but also the slowest.

Since my phone has an xargs that supports -0, I piped find to xargs
instead. Unsure how portable this will be, perhaps some android's don't
have xargs -0 or find -printf to send null terminated output.

The business with pipefail is necessary to make a failure of find cause the
import to fail. Probably this works on all androids, but if not, it will
probably just result in a failure of find being ignored. It would be
possible to make ignorefinderror just disable setting pipefail, but then
if some android has a shell that has pipefail enabled by default, ignorefinderror
would not work, so I kept the || true approach for that.

Sponsored-by: Max Thoursie on Patreon
CHANGELOG
Remote/Adb.hs
doc/bugs/special_remote_adb_-_Argument_list_too_long.mdwn
doc/bugs/special_remote_adb_-_Argument_list_too_long/comment_1_34f202f91a16dd4d2bb557aee6fd5a3e._comment [new file with mode: 0644]