Bug 132346

Summary: For DARWIN platforms, use system temporary directory for DataLog output
Product: WebKit Reporter: Michael Saboff <msaboff>
Component: JavaScriptCoreAssignee: Michael Saboff <msaboff>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cmarcelo, commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Work in Progress
none
Patch ggaren: review+

Michael Saboff
Reported 2014-04-29 11:22:09 PDT
Provide means to use the system defined temporary directory.
Attachments
Work in Progress (2.83 KB, patch)
2014-04-29 11:23 PDT, Michael Saboff
no flags
Patch (3.56 KB, patch)
2014-04-29 11:54 PDT, Michael Saboff
ggaren: review+
Michael Saboff
Comment 1 2014-04-29 11:23:08 PDT
Created attachment 230393 [details] Work in Progress
Michael Saboff
Comment 2 2014-04-29 11:54:44 PDT
Geoffrey Garen
Comment 3 2014-04-29 12:46:53 PDT
Comment on attachment 230395 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=230395&action=review > Source/WTF/ChangeLog:8 > + Added code to call confstr() to access the process' temporary directory to use that "process's" -- there's only one. > Source/WTF/wtf/DataLog.cpp:84 > + size_t lastComponentLength = strlen(logBasename) + 10; > + size_t dirnameLength = confstr(_CS_DARWIN_USER_TEMP_DIR, filenameBuffer, 1024); > + if ((dirnameLength + lastComponentLength + 10) < maxPathLength) { > + strncat(filenameBuffer, logBasename, maxPathLength - dirnameLength); > + filename = filenameBuffer; > + } Why + 10? > Source/WTF/wtf/DataLog.cpp:106 > if (!file) > - fprintf(stderr, "Warning: Could not open log file %s for writing.\n", actualFilename); > + WTFLogAlways("Warning: Could not open log file %s for writing.\n", actualFilename); > +#if DATA_LOG_TO_DARWIN_TEMP_DIR > + else > + WTFLogAlways("*** Logging to \"%s\" ***\n", actualFilename); > +#endif Better to say "if (file) / else" rather than "if (!file) / else".
Michael Saboff
Comment 4 2014-04-29 12:59:45 PDT
Comment on attachment 230395 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=230395&action=review >> Source/WTF/ChangeLog:8 >> + Added code to call confstr() to access the process' temporary directory to use that > > "process's" -- there's only one. "process'" is a valid possessive form of process. >> Source/WTF/wtf/DataLog.cpp:84 >> + } > > Why + 10? For the .<pid>.txt, with an up to 5 digit pid, added below. I'll recode without the constant. >> Source/WTF/wtf/DataLog.cpp:106 >> +#endif > > Better to say "if (file) / else" rather than "if (!file) / else". I'll make the change.
Michael Saboff
Comment 5 2014-04-29 13:29:18 PDT
Note You need to log in before you can comment on or make changes to this bug.