Title: [192583] trunk/Source
Revision
192583
Author
dba...@webkit.org
Date
2015-11-18 11:47:08 -0800 (Wed, 18 Nov 2015)

Log Message

[iOS] ASSERTION FAILED: temporaryFilePath.last() == '/' in WebCore::openTemporaryFile()
https://bugs.webkit.org/show_bug.cgi?id=151392
<rdar://problem/23595341>

Reviewed by Alexey Proskuryakov.

Workaround <rdar://problem/23579077> where confstr(_CS_DARWIN_USER_TEMP_DIR, ..., ...) retrieves
the path to the user temporary directory without a trailing slash in the iOS simulator.

Source/WebCore:

* platform/mac/FileSystemMac.mm:
(WebCore::openTemporaryFile): Add a path separator (/) between the directory path and filename.

Source/WebKit2:

* Shared/mac/SandboxExtensionMac.mm:
(WebKit::SandboxExtension::createHandleForTemporaryFile): Add a path separator (/) between the directory path and filename.

Source/WTF:

* wtf/DataLog.cpp:
(WTF::initializeLogFileOnce):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (192582 => 192583)


--- trunk/Source/WTF/ChangeLog	2015-11-18 19:07:54 UTC (rev 192582)
+++ trunk/Source/WTF/ChangeLog	2015-11-18 19:47:08 UTC (rev 192583)
@@ -1,3 +1,17 @@
+2015-11-18  Daniel Bates  <daba...@apple.com>
+
+        [iOS] ASSERTION FAILED: temporaryFilePath.last() == '/' in WebCore::openTemporaryFile()
+        https://bugs.webkit.org/show_bug.cgi?id=151392
+        <rdar://problem/23595341>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Workaround <rdar://problem/23579077> where confstr(_CS_DARWIN_USER_TEMP_DIR, ..., ...) retrieves
+        the path to the user temporary directory without a trailing slash in the iOS simulator.
+
+        * wtf/DataLog.cpp:
+        (WTF::initializeLogFileOnce):
+
 2015-11-17  Filip Pizlo  <fpi...@apple.com>
 
         CheckAdd/Mul should have commutativity optimizations in B3->Air lowering

Modified: trunk/Source/WTF/wtf/DataLog.cpp (192582 => 192583)


--- trunk/Source/WTF/wtf/DataLog.cpp	2015-11-18 19:07:54 UTC (rev 192582)
+++ trunk/Source/WTF/wtf/DataLog.cpp	2015-11-18 19:47:08 UTC (rev 192583)
@@ -81,13 +81,21 @@
     const char* logBasename = "WTFLog";
 #endif
 
-    const char* filename = 0;
+    const char* filename = nullptr;
 
-    size_t lastComponentLength = strlen(logBasename) + suffixLength;
-    size_t dirnameLength = confstr(_CS_DARWIN_USER_TEMP_DIR, filenameBuffer, 1024);
-    if ((dirnameLength + lastComponentLength + suffixLength) < maxPathLength) {
-        strncat(filenameBuffer, logBasename, maxPathLength - dirnameLength);
-        filename = filenameBuffer;
+    bool success = confstr(_CS_DARWIN_USER_TEMP_DIR, filenameBuffer, sizeof(filenameBuffer));
+    if (success) {
+        // FIXME: Assert that the path ends with a slash instead of adding a slash if it does not exist
+        // once <rdar://problem/23579077> is fixed in all iOS Simulator versions that we use.
+        size_t lastComponentLength = strlen(logBasename) + suffixLength;
+        size_t dirnameLength = strlen(filenameBuffer);
+        bool shouldAddPathSeparator = filenameBuffer[dirnameLength - 1] != '/' && logBasename[0] != '/';
+        if (lastComponentLength + shouldAddPathSeparator <= sizeof(filenameBuffer) - dirnameLength - 1) {
+            if (shouldAddPathSeparator)
+                strncat(filenameBuffer, "/", 1);
+            strncat(filenameBuffer, logBasename, sizeof(filenameBuffer) - strlen(filenameBuffer) - 1);
+            filename = filenameBuffer;
+        }
     }
 #elif defined(DATA_LOG_FILENAME)
     const char* filename = DATA_LOG_FILENAME;

Modified: trunk/Source/WebCore/ChangeLog (192582 => 192583)


--- trunk/Source/WebCore/ChangeLog	2015-11-18 19:07:54 UTC (rev 192582)
+++ trunk/Source/WebCore/ChangeLog	2015-11-18 19:47:08 UTC (rev 192583)
@@ -1,3 +1,17 @@
+2015-11-18  Daniel Bates  <daba...@apple.com>
+
+        [iOS] ASSERTION FAILED: temporaryFilePath.last() == '/' in WebCore::openTemporaryFile()
+        https://bugs.webkit.org/show_bug.cgi?id=151392
+        <rdar://problem/23595341>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Workaround <rdar://problem/23579077> where confstr(_CS_DARWIN_USER_TEMP_DIR, ..., ...) retrieves
+        the path to the user temporary directory without a trailing slash in the iOS simulator.
+
+        * platform/mac/FileSystemMac.mm:
+        (WebCore::openTemporaryFile): Add a path separator (/) between the directory path and filename.
+
 2015-11-18  Chris Dumez  <cdu...@apple.com>
 
         Null dereference in Performance::Performance(WebCore::Frame*)

Modified: trunk/Source/WebCore/platform/mac/FileSystemMac.mm (192582 => 192583)


--- trunk/Source/WebCore/platform/mac/FileSystemMac.mm	2015-11-18 19:07:54 UTC (rev 192582)
+++ trunk/Source/WebCore/platform/mac/FileSystemMac.mm	2015-11-18 19:47:08 UTC (rev 192583)
@@ -69,8 +69,12 @@
 
     // Shrink the vector.   
     temporaryFilePath.shrink(strlen(temporaryFilePath.data()));
-    ASSERT(temporaryFilePath.last() == '/');
 
+    // FIXME: Change to a runtime assertion that the path ends with a slash once <rdar://problem/23579077> is
+    // fixed in all iOS Simulator versions that we use.
+    if (temporaryFilePath.last() != '/')
+        temporaryFilePath.append('/');
+
     // Append the file name.
     CString prefixUtf8 = prefix.utf8();
     temporaryFilePath.append(prefixUtf8.data(), prefixUtf8.length());

Modified: trunk/Source/WebKit2/ChangeLog (192582 => 192583)


--- trunk/Source/WebKit2/ChangeLog	2015-11-18 19:07:54 UTC (rev 192582)
+++ trunk/Source/WebKit2/ChangeLog	2015-11-18 19:47:08 UTC (rev 192583)
@@ -1,3 +1,17 @@
+2015-11-18  Daniel Bates  <daba...@apple.com>
+
+        [iOS] ASSERTION FAILED: temporaryFilePath.last() == '/' in WebCore::openTemporaryFile()
+        https://bugs.webkit.org/show_bug.cgi?id=151392
+        <rdar://problem/23595341>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Workaround <rdar://problem/23579077> where confstr(_CS_DARWIN_USER_TEMP_DIR, ..., ...) retrieves
+        the path to the user temporary directory without a trailing slash in the iOS simulator.
+
+        * Shared/mac/SandboxExtensionMac.mm:
+        (WebKit::SandboxExtension::createHandleForTemporaryFile): Add a path separator (/) between the directory path and filename.
+
 2015-11-17  Geoffrey Garen  <gga...@apple.com>
 
         A window with a hung tab waits 5s before closing

Modified: trunk/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm (192582 => 192583)


--- trunk/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm	2015-11-18 19:07:54 UTC (rev 192582)
+++ trunk/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm	2015-11-18 19:47:08 UTC (rev 192583)
@@ -249,7 +249,11 @@
     
     // Shrink the vector.   
     path.shrink(strlen(path.data()));
-    ASSERT(path.last() == '/');
+
+    // FIXME: Change to a runtime assertion that the path ends with a slash once <rdar://problem/23579077> is
+    // fixed in all iOS Simulator versions that we use.
+    if (path.last() != '/')
+        path.append('/');
     
     // Append the file name.    
     path.append(prefix.utf8().data(), prefix.length());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to