diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-04-29 17:23:06 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-04-29 17:23:06 +0000 |
commit | 63524b945356f1d3c5a4fe4b6ba979d9cdc97200 (patch) | |
tree | fca9ec8671e0adb67526cf7e1d6bfd62d0651185 /clang/tools/scan-view/ScanView.py | |
parent | 49f888bbab84f3463940aa5cd251fc6b63c14da1 (diff) | |
download | bcm5719-llvm-63524b945356f1d3c5a4fe4b6ba979d9cdc97200.tar.gz bcm5719-llvm-63524b945356f1d3c5a4fe4b6ba979d9cdc97200.zip |
[analyzer] scan-view: don't ever serve absolute paths.
At one point in time scan-view allowed absolute paths to reference files
within the server root, but this doesn't seem to be used anymore, and
caused problems if a server-root-relative path actually matched an
absolute path to an existing file. This patch just treats paths as
server-root-relative all the time.
PR15843
llvm-svn: 180715
Diffstat (limited to 'clang/tools/scan-view/ScanView.py')
-rw-r--r-- | clang/tools/scan-view/ScanView.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/clang/tools/scan-view/ScanView.py b/clang/tools/scan-view/ScanView.py index 32570b98583..ee08baa8bad 100644 --- a/clang/tools/scan-view/ScanView.py +++ b/clang/tools/scan-view/ScanView.py @@ -686,16 +686,8 @@ File Bug</h3> if components[-1] == '': components[-1] = 'index.html' - suffix = '/'.join(components) - - # The summary may reference source files on disk using rooted - # paths. Make sure these resolve correctly for now. - # FIXME: This isn't a very good idea... we should probably - # mark rooted paths somehow. - if os.path.exists(posixpath.join('/', suffix)): - path = posixpath.join('/', suffix) - else: - path = posixpath.join(self.server.root, suffix) + relpath = '/'.join(components) + path = posixpath.join(self.server.root, relpath) if self.server.options.debug > 1: print >>sys.stderr, '%s: SERVER: sending path "%s"'%(sys.argv[0], @@ -708,8 +700,8 @@ File Bug</h3> def send_path(self, path): # If the requested path is outside the root directory, do not open it - rel = os.path.abspath(os.path.join(self.server.root, path)) - if not rel.startswith(os.path.abspath(self.server.root) ): + rel = os.path.abspath(path) + if not rel.startswith(os.path.abspath(self.server.root)): return self.send_404() ctype = self.guess_type(path) |