Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Unified Diff: client/run_isolated.py

Issue 1871113002: Stop choosing $TMPDIR as a safe place to create hardlinks on OSX. (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/run_isolated.py
diff --git a/client/run_isolated.py b/client/run_isolated.py
index dce643f110afd779391d9143572248a4dad9d60d..f964384181be76754d458645badd1640112d3292 100755
--- a/client/run_isolated.py
+++ b/client/run_isolated.py
@@ -88,11 +88,20 @@ def make_temp_dir(prefix, root_dir=None):
If root_dir is given and /tmp is on same file system as root_dir, uses /tmp.
Otherwise makes a new temp directory under root_dir.
+
+ Except on OSX, because it's dangerous to create hardlinks in $TMPDIR on OSX!
+ /System/Library/LaunchDaemons/com.apple.bsd.dirhelper.plist runs every day at
+ 3:35am and deletes all files older than 3 days in $TMPDIR, but hardlinks do
+ not have the inode modification time updated, so they tend to be old, thus
+ they get deleted.
"""
base_temp_dir = None
- if (root_dir and
- not file_path.is_same_filesystem(
- root_dir, unicode(tempfile.gettempdir()))):
+ real_temp_dir = unicode(tempfile.gettempdir())
+ if sys.platform == 'darwin':
+ # Nope! Nope! Nope!
+ assert root_dir, 'It is unsafe to create hardlinks in $TMPDIR'
+ base_temp_dir = root_dir
+ elif root_dir and not file_path.is_same_filesystem(root_dir, real_temp_dir):
base_temp_dir = root_dir
return unicode(tempfile.mkdtemp(prefix=prefix, dir=base_temp_dir))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698