##// END OF EJS Templates
Make a few portability improvements to path auditing code.
Bryan O'Sullivan -
r5159:d84329a1 default
parent child Browse files
Show More
@@ -698,7 +698,8 b' class path_auditor(object):'
698 def __call__(self, path):
698 def __call__(self, path):
699 if path in self.audited:
699 if path in self.audited:
700 return
700 return
701 parts = os.path.normcase(path).split(os.sep)
701 normpath = os.path.normcase(path)
702 parts = normpath.split(os.sep)
702 if (os.path.splitdrive(path)[0] or parts[0] in ('.hg', '')
703 if (os.path.splitdrive(path)[0] or parts[0] in ('.hg', '')
703 or os.pardir in parts):
704 or os.pardir in parts):
704 raise Abort(_("path contains illegal component: %s") % path)
705 raise Abort(_("path contains illegal component: %s") % path)
@@ -713,12 +714,13 b' class path_auditor(object):'
713 if stat.S_ISLNK(st.st_mode):
714 if stat.S_ISLNK(st.st_mode):
714 raise Abort(_('path %r traverses symbolic link %r') %
715 raise Abort(_('path %r traverses symbolic link %r') %
715 (path, prefix))
716 (path, prefix))
716 if os.path.exists(os.path.join(curpath, '.hg')):
717 elif (stat.S_ISDIR(st.st_mode) and
718 os.path.isdir(os.path.join(curpath, '.hg'))):
717 raise Abort(_('path %r is inside repo %r') %
719 raise Abort(_('path %r is inside repo %r') %
718 (path, prefix))
720 (path, prefix))
719 self.audited[prefix] = True
721 self.audited[prefix] = True
720 for c in strutil.rfindall(path, os.sep):
722 for c in strutil.rfindall(normpath, os.sep):
721 check(path[:c])
723 check(normpath[:c])
722 self.audited[path] = True
724 self.audited[path] = True
723
725
724 def _makelock_file(info, pathname):
726 def _makelock_file(info, pathname):
General Comments 0
You need to be logged in to leave comments. Login now