Changeset 192583 in webkit


Ignore:
Timestamp:
Nov 18, 2015 11:47:08 AM (9 years ago)
Author:
dbates@webkit.org
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):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r192540 r192583  
     12015-11-18  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] ASSERTION FAILED: temporaryFilePath.last() == '/' in WebCore::openTemporaryFile()
     4        https://bugs.webkit.org/show_bug.cgi?id=151392
     5        <rdar://problem/23595341>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Workaround <rdar://problem/23579077> where confstr(_CS_DARWIN_USER_TEMP_DIR, ..., ...) retrieves
     10        the path to the user temporary directory without a trailing slash in the iOS simulator.
     11
     12        * wtf/DataLog.cpp:
     13        (WTF::initializeLogFileOnce):
     14
    1152015-11-17  Filip Pizlo  <fpizlo@apple.com>
    216
  • trunk/Source/WTF/wtf/DataLog.cpp

    r173949 r192583  
    8282#endif
    8383
    84     const char* filename = 0;
     84    const char* filename = nullptr;
    8585
    86     size_t lastComponentLength = strlen(logBasename) + suffixLength;
    87     size_t dirnameLength = confstr(_CS_DARWIN_USER_TEMP_DIR, filenameBuffer, 1024);
    88     if ((dirnameLength + lastComponentLength + suffixLength) < maxPathLength) {
    89         strncat(filenameBuffer, logBasename, maxPathLength - dirnameLength);
    90         filename = filenameBuffer;
     86    bool success = confstr(_CS_DARWIN_USER_TEMP_DIR, filenameBuffer, sizeof(filenameBuffer));
     87    if (success) {
     88        // FIXME: Assert that the path ends with a slash instead of adding a slash if it does not exist
     89        // once <rdar://problem/23579077> is fixed in all iOS Simulator versions that we use.
     90        size_t lastComponentLength = strlen(logBasename) + suffixLength;
     91        size_t dirnameLength = strlen(filenameBuffer);
     92        bool shouldAddPathSeparator = filenameBuffer[dirnameLength - 1] != '/' && logBasename[0] != '/';
     93        if (lastComponentLength + shouldAddPathSeparator <= sizeof(filenameBuffer) - dirnameLength - 1) {
     94            if (shouldAddPathSeparator)
     95                strncat(filenameBuffer, "/", 1);
     96            strncat(filenameBuffer, logBasename, sizeof(filenameBuffer) - strlen(filenameBuffer) - 1);
     97            filename = filenameBuffer;
     98        }
    9199    }
    92100#elif defined(DATA_LOG_FILENAME)
  • trunk/Source/WebCore/ChangeLog

    r192582 r192583  
     12015-11-18  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] ASSERTION FAILED: temporaryFilePath.last() == '/' in WebCore::openTemporaryFile()
     4        https://bugs.webkit.org/show_bug.cgi?id=151392
     5        <rdar://problem/23595341>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Workaround <rdar://problem/23579077> where confstr(_CS_DARWIN_USER_TEMP_DIR, ..., ...) retrieves
     10        the path to the user temporary directory without a trailing slash in the iOS simulator.
     11
     12        * platform/mac/FileSystemMac.mm:
     13        (WebCore::openTemporaryFile): Add a path separator (/) between the directory path and filename.
     14
    1152015-11-18  Chris Dumez  <cdumez@apple.com>
    216
  • trunk/Source/WebCore/platform/mac/FileSystemMac.mm

    r185525 r192583  
    7070    // Shrink the vector.   
    7171    temporaryFilePath.shrink(strlen(temporaryFilePath.data()));
    72     ASSERT(temporaryFilePath.last() == '/');
     72
     73    // FIXME: Change to a runtime assertion that the path ends with a slash once <rdar://problem/23579077> is
     74    // fixed in all iOS Simulator versions that we use.
     75    if (temporaryFilePath.last() != '/')
     76        temporaryFilePath.append('/');
    7377
    7478    // Append the file name.
  • trunk/Source/WebKit2/ChangeLog

    r192528 r192583  
     12015-11-18  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] ASSERTION FAILED: temporaryFilePath.last() == '/' in WebCore::openTemporaryFile()
     4        https://bugs.webkit.org/show_bug.cgi?id=151392
     5        <rdar://problem/23595341>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        Workaround <rdar://problem/23579077> where confstr(_CS_DARWIN_USER_TEMP_DIR, ..., ...) retrieves
     10        the path to the user temporary directory without a trailing slash in the iOS simulator.
     11
     12        * Shared/mac/SandboxExtensionMac.mm:
     13        (WebKit::SandboxExtension::createHandleForTemporaryFile): Add a path separator (/) between the directory path and filename.
     14
    1152015-11-17  Geoffrey Garen  <ggaren@apple.com>
    216
  • trunk/Source/WebKit2/Shared/mac/SandboxExtensionMac.mm

    r186566 r192583  
    250250    // Shrink the vector.   
    251251    path.shrink(strlen(path.data()));
    252     ASSERT(path.last() == '/');
     252
     253    // FIXME: Change to a runtime assertion that the path ends with a slash once <rdar://problem/23579077> is
     254    // fixed in all iOS Simulator versions that we use.
     255    if (path.last() != '/')
     256        path.append('/');
    253257   
    254258    // Append the file name.   
Note: See TracChangeset for help on using the changeset viewer.