diff options
Diffstat (limited to 'manifest_xml.py')
| -rw-r--r-- | manifest_xml.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index d05f4d0a..cd5954df 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
| @@ -670,6 +670,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 670 | for node in manifest.childNodes: | 670 | for node in manifest.childNodes: |
| 671 | if node.nodeName == 'include': | 671 | if node.nodeName == 'include': |
| 672 | name = self._reqatt(node, 'name') | 672 | name = self._reqatt(node, 'name') |
| 673 | msg = self._CheckLocalPath(name) | ||
| 674 | if msg: | ||
| 675 | raise ManifestInvalidPathError( | ||
| 676 | '<include> invalid "name": %s: %s' % (name, msg)) | ||
| 673 | include_groups = '' | 677 | include_groups = '' |
| 674 | if parent_groups: | 678 | if parent_groups: |
| 675 | include_groups = parent_groups | 679 | include_groups = parent_groups |
| @@ -979,6 +983,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 979 | reads a <project> element from the manifest file | 983 | reads a <project> element from the manifest file |
| 980 | """ | 984 | """ |
| 981 | name = self._reqatt(node, 'name') | 985 | name = self._reqatt(node, 'name') |
| 986 | msg = self._CheckLocalPath(name, dir_ok=True) | ||
| 987 | if msg: | ||
| 988 | raise ManifestInvalidPathError( | ||
| 989 | '<project> invalid "name": %s: %s' % (name, msg)) | ||
| 982 | if parent: | 990 | if parent: |
| 983 | name = self._JoinName(parent.name, name) | 991 | name = self._JoinName(parent.name, name) |
| 984 | 992 | ||
| @@ -999,9 +1007,11 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 999 | path = node.getAttribute('path') | 1007 | path = node.getAttribute('path') |
| 1000 | if not path: | 1008 | if not path: |
| 1001 | path = name | 1009 | path = name |
| 1002 | if path.startswith('/'): | 1010 | else: |
| 1003 | raise ManifestParseError("project %s path cannot be absolute in %s" % | 1011 | msg = self._CheckLocalPath(path, dir_ok=True) |
| 1004 | (name, self.manifestFile)) | 1012 | if msg: |
| 1013 | raise ManifestInvalidPathError( | ||
| 1014 | '<project> invalid "path": %s: %s' % (path, msg)) | ||
| 1005 | 1015 | ||
| 1006 | rebase = XmlBool(node, 'rebase', True) | 1016 | rebase = XmlBool(node, 'rebase', True) |
| 1007 | sync_c = XmlBool(node, 'sync-c', False) | 1017 | sync_c = XmlBool(node, 'sync-c', False) |
| @@ -1124,7 +1134,7 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | |||
| 1124 | def _CheckLocalPath(path, dir_ok=False, cwd_dot_ok=False): | 1134 | def _CheckLocalPath(path, dir_ok=False, cwd_dot_ok=False): |
| 1125 | """Verify |path| is reasonable for use in filesystem paths. | 1135 | """Verify |path| is reasonable for use in filesystem paths. |
| 1126 | 1136 | ||
| 1127 | Used with <copyfile> & <linkfile> elements. | 1137 | Used with <copyfile> & <linkfile> & <project> elements. |
| 1128 | 1138 | ||
| 1129 | This only validates the |path| in isolation: it does not check against the | 1139 | This only validates the |path| in isolation: it does not check against the |
| 1130 | current filesystem state. Thus it is suitable as a first-past in a parser. | 1140 | current filesystem state. Thus it is suitable as a first-past in a parser. |
