Bug 53380

Summary: [Qt] WebKit does not build on Mac with WebKit 2
Product: WebKit Reporter: Benjamin Poulain <benjamin>
Component: WebKit2Assignee: Benjamin Poulain <benjamin>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eric, kimmo.t.kinnunen, laszlo.gombos, ossy, sam, s.mathur, webkit-ews, webkit.review.bot
Priority: P3 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Bug Depends on: 53377    
Bug Blocks: 50251    
Attachments:
Description Flags
Patch
none
Fix for Linux distros that don't support mkostemp (only mkstemp)
none
Fix for Linux
none
Patch
none
Patch
none
Patch none

Benjamin Poulain
Reported 2011-01-29 14:04:43 PST
WebKit does not build on Mac if WebKit 2 is enabled.
Attachments
Patch (7.16 KB, patch)
2011-01-29 14:17 PST, Benjamin Poulain
no flags
Fix for Linux distros that don't support mkostemp (only mkstemp) (2.81 KB, patch)
2011-02-04 14:47 PST, Siddharth Mathur
no flags
Fix for Linux (2.81 KB, patch)
2011-02-04 15:21 PST, Siddharth Mathur
no flags
Patch (6.74 KB, patch)
2011-02-05 08:05 PST, Benjamin Poulain
no flags
Patch (9.16 KB, patch)
2011-02-05 11:58 PST, Benjamin Poulain
no flags
Patch (9.16 KB, patch)
2011-02-05 12:46 PST, Benjamin Poulain
no flags
Benjamin Poulain
Comment 1 2011-01-29 14:17:17 PST
Benjamin Poulain
Comment 2 2011-01-29 14:22:46 PST
I basically fixed the build issues one by one until it compiles, link and run :) There is two things I am not sure, maybe Kimmo can tell: -is "mkostemp(tempNameC, O_CREAT | O_CLOEXEC | O_RDWR))" subject to race condition on close-on-exec? Because the fallback use fcntl() after the creation, so there is some time without close-on-exec. -is it ok to pass no flag to recvmsg()? The doc is unclear (it says one or more flags)
Eric Seidel (no email)
Comment 3 2011-01-30 03:44:16 PST
Sam may like to see wk2 changes go by, even though he doesn't work with qt.
Kimmo Kinnunen
Comment 4 2011-01-30 22:27:29 PST
(In reply to comment #2) > I basically fixed the build issues one by one until it compiles, link and run :) Nice! > There is two things I am not sure, maybe Kimmo can tell: > -is "mkostemp(tempNameC, O_CREAT | O_CLOEXEC | O_RDWR))" subject to race condition on close-on-exec? Because the fallback use fcntl() after the creation, so there is some time without close-on-exec. The race is about other thread forking the process after mkostemp but before the fctnl. In this case it is not a problem, and mkstemp + fcntl suffices. If you want to refine the patch, IMHO it could be used as the only codepath in order to reduce the #ifdef'ing. > -is it ok to pass no flag to recvmsg()? The doc is unclear (it says one or more flags) I interpret the man page ambiguous on flag. As far as I tested, passing 0 is good.
Siddharth Mathur
Comment 5 2011-02-03 15:55:40 PST
(In reply to comment #4) > (In reply to comment #2) > > I basically fixed the build issues one by one until it compiles, link and run :) > > Nice! > > > There is two things I am not sure, maybe Kimmo can tell: > > -is "mkostemp(tempNameC, O_CREAT | O_CLOEXEC | O_RDWR))" subject to race condition on close-on-exec? Because the fallback use fcntl() after the creation, so there is some time without close-on-exec. > > The race is about other thread forking the process after mkostemp but before the fctnl. In this case it is not a problem, and mkstemp + fcntl suffices. If you want to refine the patch, IMHO it could be used as the only codepath in order to reduce the #ifdef'ing. > > > -is it ok to pass no flag to recvmsg()? The doc is unclear (it says one or more flags) > > I interpret the man page ambiguous on flag. As far as I tested, passing 0 is good. Since I see that kling has r- the patch, Kimmo, would you be kind enough to upload a patch that fixes this issue for Mac and/or Linux distros that don't support 'mkostemp' and the new flags? ../../../Source/WebKit2/Platform/qt/SharedMemoryQt.cpp: In static member function 'static WTF::PassRefPtr<WebKit::SharedMemory> WebKit::SharedMemory::create(size_t)': ../../../Source/WebKit2/Platform/qt/SharedMemoryQt.cpp:109: error: 'O_CLOEXEC' was not declared in this scope ../../../Source/WebKit2/Platform/qt/SharedMemoryQt.cpp:109: error: 'mkostemp' was not declared in this scope ../../../Source/WebKit2/Platform/qt/SharedMemoryQt.cpp: In member function 'bool WebKit::SharedMemory::createHandle(WebKit::SharedMemory::Handle&, WebKit::SharedMemory::Protection)': ../../../Source/WebKit2/Platform/qt/SharedMemoryQt.cpp:199: error: 'O_CLOEXEC' was not declared in this scope make[1]: *** [obj/release/SharedMemoryQt.o] Error 1 make[1]: *** Waiting for unfinished jobs.... ../../../Source/WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp: In member function 'void CoreIPC::Connection::readyReadHandler()': ../../../Source/WebKit2/Platform/CoreIPC/qt/ConnectionQt.cpp:168: error: 'MSG_CMSG_CLOEXEC' was not declared in this scope make[1]: *** [obj/release/ConnectionQt.o] Error 1
Kimmo Kinnunen
Comment 6 2011-02-04 02:33:26 PST
(In reply to comment #5) > Since I see that kling has r- the patch, Kimmo, would you be kind enough to upload a patch that fixes this issue for Mac and/or Linux distros that don't support 'mkostemp' and the new flags? (12:32:13 PM) kling: kimmok: benjaminp said he wanted to make a new version based on your comments, and told me to r- the old one
Siddharth Mathur
Comment 7 2011-02-04 14:47:07 PST
Created attachment 81289 [details] Fix for Linux distros that don't support mkostemp (only mkstemp)
Siddharth Mathur
Comment 8 2011-02-04 15:21:24 PST
Created attachment 81303 [details] Fix for Linux (It will be good if someone can test this too)
Benjamin Poulain
Comment 9 2011-02-04 16:37:24 PST
Comment on attachment 81303 [details] Fix for Linux And what? If the system is not POSIX.1-2008 you just ignore close on exec? Seem bogus to me. I said I would update for something more generic, not just ignore the stuff I don't like.
Early Warning System Bot
Comment 10 2011-02-04 16:52:47 PST
Kimmo Kinnunen
Comment 11 2011-02-05 00:06:42 PST
(In reply to comment #7) > Created an attachment (id=81289) [details] > Fix for Linux distros that don't support mkostemp (only mkstemp) Siddharth, was there something that didn't work for you in Benjamin's original patch? Benjamin, Andreas: Since this is fairly important, could we get the Benjamin's original patch in to get things compiling again? With cq+ perhaps, so mac compiles wouldn't block? And then decreasing the #ifdef'ing would come as second priority..
Andreas Kling
Comment 12 2011-02-05 07:25:55 PST
Comment on attachment 80572 [details] Patch @Kimmo: Sure, let's land this for now.
Benjamin Poulain
Comment 13 2011-02-05 07:29:09 PST
Comment on attachment 80572 [details] Patch Patch on the way
Benjamin Poulain
Comment 14 2011-02-05 08:05:15 PST
Andreas Kling
Comment 15 2011-02-05 10:13:32 PST
Comment on attachment 81363 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=81363&action=review r=me > Source/WebKit2/Platform/qt/SharedMemoryQt.cpp:206 > + while ((fcntl(duplicatedHandle, F_SETFD, FD_CLOEXEC | accessModeFile(protection)) == -1)) { Extra space before FD_CLOEXEC. > Source/WebKit2/UIProcess/WebPageProxy.cpp:1093 > +#if defined(__APPLE__) && !PLATFORM(QT) This is quite ugly. I wish we'd use something other than __APPLE__ for mac-port-specific stuff.
Benjamin Poulain
Comment 16 2011-02-05 11:58:21 PST
Early Warning System Bot
Comment 17 2011-02-05 12:11:29 PST
Benjamin Poulain
Comment 18 2011-02-05 12:46:15 PST
Created attachment 81371 [details] Patch oops
WebKit Review Bot
Comment 19 2011-02-05 13:03:10 PST
WebKit Commit Bot
Comment 20 2011-02-06 05:24:05 PST
Comment on attachment 81371 [details] Patch Clearing flags on attachment: 81371 Committed r77765: <http://trac.webkit.org/changeset/77765>
WebKit Commit Bot
Comment 21 2011-02-06 05:24:11 PST
All reviewed patches have been landed. Closing bug.
Siddharth Mathur
Comment 22 2011-02-07 06:43:52 PST
Thank you Benjamin and Kling!
Note You need to log in before you can comment on or make changes to this bug.