[Server-devel] [PATCH] ds-postproces.py: fix and tighten up setfacl calls
martin.langhoff at gmail.com
martin.langhoff at gmail.com
Tue Jul 22 02:36:12 EDT 2008
From: Martin Langhoff <martin at laptop.org>
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
More information about the Server-devel
mailing list