RESOLVED FIXED 31603
WebSocket server is confused if WebKit tests run from within /tmp on Mac OS X
https://bugs.webkit.org/show_bug.cgi?id=31603
Summary WebSocket server is confused if WebKit tests run from within /tmp on Mac OS X
Mark Rowe (bdash)
Reported 2009-11-17 16:26:39 PST
On Mac OS X /tmp is a symlink to /private/tmp. If the WebSocket server is started from below this directory it gets confused and logs errors rather than serving content: mrowe@angara:/tmp/WebKit$ PYTHONPATH=WebKitTools/pywebsocket /usr/bin/python WebKitTools/pywebsocket/mod_pywebsocket/standalone.py -p 2048 -d $PWD/LayoutTests -s $PWD/LayoutTests/websocket/tests ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 50785) Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 558, in process_request_thread self.finish_request(request, client_address) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "WebKitTools/pywebsocket/mod_pywebsocket/standalone.py", line 170, in __init__ WebSocketRequestHandler.options.scan_dir) File "/private/tmp/WebKit/WebKitTools/pywebsocket/mod_pywebsocket/dispatch.py", line 141, in __init__ 'root_dir:%s.' % (scan_dir, root_dir)) DispatchError: scan_dir:/tmp/WebKit/LayoutTests/websocket/tests must be a directory under root_dir:.. ---------------------------------------- This happens because dispatch.py uses the following code to determine if scan_dir is below root_dir: os.path.abspath(scan_dir).startswith(os.path.abspath(root_dir)) scan_dir is “/tmp/WebKit/LayoutTests/websocket/tests” and so abspath(scan_dir) evalutes to "/tmp/WebKit/LayoutTests/websocket/tests”. root_dir is “.” and so abspath(root_dir) evaluates to “/private/tmp/WebKit/LayoutTests”. I suspect this code wants to be using os.path.realpath rather than os.path.abspath. This returns the canonical version of the path and therefore is not confused by the /tmp symlink.
Attachments
Patch (2.15 KB, patch)
2009-11-17 16:33 PST, Mark Rowe (bdash)
ap: review+
Mark Rowe (bdash)
Comment 1 2009-11-17 16:33:12 PST
Created attachment 43388 [details] Patch I suspect that pywebsocket is from an external source but the README doesn’t include any information about that. This patch appears to address the problem.
Alexey Proskuryakov
Comment 2 2009-11-17 16:55:42 PST
Comment on attachment 43388 [details] Patch r=me
Mark Rowe (bdash)
Comment 3 2009-11-17 17:13:04 PST
Landed in r51099.
Yuzo Fujishima
Comment 4 2009-11-17 17:25:36 PST
Sorry for the bug and thank you for fixing. I'll fix this also upstream. ( http://code.google.com/p/pywebsocket/issues/detail?id=23 ) FYI: os.path.abspath is used also in line 65. Yuzo
Note You need to log in before you can comment on or make changes to this bug.