r180715 - [analyzer] scan-view: don't ever serve absolute paths.
Jordan Rose
jordan_rose at apple.com
Mon Apr 29 10:23:06 PDT 2013
Author: jrose
Date: Mon Apr 29 12:23:06 2013
New Revision: 180715
URL: http://llvm.org/viewvc/llvm-project?rev=180715&view=rev
Log:
[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
Modified:
cfe/trunk/tools/scan-view/ScanView.py
Modified: cfe/trunk/tools/scan-view/ScanView.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-view/ScanView.py?rev=180715&r1=180714&r2=180715&view=diff
==============================================================================
--- cfe/trunk/tools/scan-view/ScanView.py (original)
+++ cfe/trunk/tools/scan-view/ScanView.py Mon Apr 29 12:23:06 2013
@@ -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)
More information about the cfe-commits
mailing list