From: Martin Langhoff <[EMAIL PROTECTED]>

GNU xargs can give nasty surprises as it defaults to
running the command anyway. BSD xargs does the sensible
thing, but that's not what we have here.

While the GNU xargs team continues on its world domination plans,
we make sure we don't misfire our setfacl, using -no-run-if-empty.
---
 server/ds-postprocess.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/server/ds-postprocess.py b/server/ds-postprocess.py
index a99b6ab..b55b3e1 100755
--- a/server/ds-postprocess.py
+++ b/server/ds-postprocess.py
@@ -98,21 +98,21 @@ if (exitcode != 0):
 # To say
 #
 # find user[5]/datastore- + datestamp -type f \
-#   | xargs -n100 setfactl -m u:apache:r
+#   | xargs -n100 -no-run-if-empty setfactl -m u:apache:r
 # find user[5]/datastore- + datestamp -type d \
-#   | xargs -n100 setfactl -m u:apache:rx
+#   | xargs -n100 -no-run-if-empty setfactl -m u:apache:rx
 #
 # We say Pythonistically
 #
-psrc  = Popen(['find', user[5]+'/datastore-' + datestamp,
+psrc  = subprocess.Popen(['find', user[5]+'/datastore-' + datestamp,
                '-type', 'f'], stdout=PIPE)
-psink = Popen(['xargs', '-n100', 'setfacl', '-m', 'u:apache:r'],
+psink = subprocess.Popen(['xargs', '-n100', '-no-run-if-empty', 'setfacl', 
'-m', 'u:apache:r'],
               stdin=psrc.stdout,stdout=PIPE)
 psink.communicate()
 
-psrc  = Popen(['find', user[5]+'/datastore-' + datestamp,
+psrc  = subprocess.Popen(['find', user[5]+'/datastore-' + datestamp,
                '-type', 'd'], stdout=PIPE)
-psink = Popen(['xargs', '-n100', 'setfacl', '-m', 'u:apache:rx'],
+psink = subprocess.Popen(['xargs', '-n100', '-no-run-if-empty', 'setfacl', 
'-m', 'u:apache:rx'],
               stdin=psrc.stdout,stdout=PIPE)
 psink.communicate()
 
-- 
1.5.6.dirty

_______________________________________________
Server-devel mailing list
[email protected]
http://lists.laptop.org/listinfo/server-devel

Reply via email to