Merge ~racb/usd-importer:fix-empty-dir-symlink-traversal into usd-importer:master

Proposed by Robie Basak on 2017-06-21
Status: Merged
Merged at revision: b9eea2cb5554daf370cf161e1dfad9c78c78ca85
Proposed branch: ~racb/usd-importer:fix-empty-dir-symlink-traversal
Merge into: usd-importer:master
Diff against target: 23 lines (+4/-1)
1 file modified
gitubuntu/git_repository.py (+4/-1)
Reviewer Review Type Date Requested Status
Nish Aravamudan 2017-06-21 Approve on 2017-06-21
Review via email: mp+326084@code.launchpad.net
To post a comment you must log in.
Nish Aravamudan (nacc) wrote :

Seems reasonable and with this change websockify successfully imports (at least past the point it failed before).

review: Approve
Robie Basak (racb) wrote :

I checked that in the fixed import of websockify 0.5.1+dfsg1-1, there is an entry in include/ of:

040000 tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 web-socket-js-project

so empty directory imports do still appear to be working.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/gitubuntu/git_repository.py b/gitubuntu/git_repository.py
2index 2b91380..89416b5 100644
3--- a/gitubuntu/git_repository.py
4+++ b/gitubuntu/git_repository.py
5@@ -8,6 +8,7 @@ import logging
6 import os
7 import re
8 import shutil
9+import stat
10 from subprocess import CalledProcessError
11 import sys
12 import tempfile
13@@ -988,7 +989,9 @@ class GitUbuntuRepository:
14 tree_builder = None
15 for entry in dir_list:
16 entry_path = os.path.join(full_path, entry)
17- if os.path.isdir(entry_path):
18+ # We cannot use os.path.isdir() here as we don't want to recurse
19+ # down symlinks to directories.
20+ if stat.S_ISDIR(os.lstat(entry_path).st_mode):
21 # this is a directory, so recurse down
22 entry_oid = cls._add_missing_tree_dirs(
23 repo=repo,

Subscribers

People subscribed via source and target branches