ZOPE / ZEOセットアップのバックアップルーチンをセットアップしているときに、blobパーミッションで同じ問題が発生しました。
ミッコが書いたモンキーパッチを適用しようとした後(それほど簡単ではありません)、問題を解決するための「本物の」パッチを思いつきました。
Martijnによって提案されたパッチは完全ではありませんが、それでもblobファイルに適切なモードを設定しません。
だからここに私の解決策があります:
1.)以下を含むパッチを作成します。
Index: ZODB/blob.py
===================================================================
--- ZODB/blob.py (Revision 121959)
+++ ZODB/blob.py (Arbeitskopie)
@@ -337,11 +337,11 @@
def create(self):
if not os.path.exists(self.base_dir):
- os.makedirs(self.base_dir, 0700)
+ os.makedirs(self.base_dir, 0750)
log("Blob directory '%s' does not exist. "
"Created new directory." % self.base_dir)
if not os.path.exists(self.temp_dir):
- os.makedirs(self.temp_dir, 0700)
+ os.makedirs(self.temp_dir, 0750)
log("Blob temporary directory '%s' does not exist. "
"Created new directory." % self.temp_dir)
@@ -359,8 +359,8 @@
(self.layout_name, self.base_dir, layout))
def isSecure(self, path):
- """Ensure that (POSIX) path mode bits are 0700."""
- return (os.stat(path).st_mode & 077) == 0
+ """Ensure that (POSIX) path mode bits are 0750."""
+ return (os.stat(path).st_mode & 027) == 0
def checkSecure(self):
if not self.isSecure(self.base_dir):
@@ -385,7 +385,7 @@
if create and not os.path.exists(path):
try:
- os.makedirs(path, 0700)
+ os.makedirs(path, 0750)
except OSError:
# We might have lost a race. If so, the directory
# must exist now
@@ -891,7 +891,7 @@
file2.close()
remove_committed(f1)
if chmod:
- os.chmod(f2, stat.S_IREAD)
+ os.chmod(f2, stat.S_IRUSR | stat.S_IRGRP)
if sys.platform == 'win32':
# On Windows, you can't remove read-only files, so make the
こちらからパッチをご覧になることもできます-> http://pastebin.com/wNLYyXvw
2.)ビルドアウトルートディレクトリに「blob.patch」という名前でパッチを保存します
3.)ビルドアウト構成を拡張します。
parts +=
patchblob
postinstall
[patchblob]
recipe = collective.recipe.patch
egg = ZODB3
patches = blob.patch
[postinstall]
recipe = plone.recipe.command
command =
chmod -R g+r ${buildout:directory}/var
find ${buildout:directory}/var -type d | xargs chmod g+x
update-command = ${:command}
インストール後のセクションでは、既存のBLOBに必要なグループ読み取り権限を設定します。また、実行権限はblobフォルダーに付与する必要があり、そのグループはディレクトリに入ることができます。
このパッチをZODB3.10.2および3.10.3でテストしました。
Martijnが提案したように、これは構成可能であり、ZODBの一部である必要があります。