-
Type: Bug
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 4.2.0
-
Fix Version/s: 4.4.5
-
Component/s: Direct Transfer
Error
Sentry Issue: NUXEO-DRIVE-3YD
PermissionError: [Errno 13] Permission denied: '/usr/sbin/authserver' File "nxdrive/gui/application.py", line 1445, in _handle_connection self._handle_nxdrive_url(url) File "nxdrive/gui/application.py", line 1387, in _handle_nxdrive_url func(path) File "nxdrive/gui/application.py", line 1552, in ctx_direct_transfer self.show_server_folders(engine, path) File "nxdrive/gui/application.py", line 781, in show_server_folders self.filters_dlg = FoldersDialog(self, engine, path) File "nxdrive/gui/folders_dialog.py", line 233, in __init__ self._process_additionnal_local_paths([str(path)] if path else []) File "nxdrive/gui/folders_dialog.py", line 384, in _process_additionnal_local_paths for file_path, size in get_tree_list(path): File "nxdrive/utils.py", line 354, in get_tree_list yield from get_tree_list(Path(entry.path)) File "nxdrive/utils.py", line 354, in get_tree_list yield from get_tree_list(Path(entry.path)) File "nxdrive/utils.py", line 354, in get_tree_list yield from get_tree_list(Path(entry.path)) File "nxdrive/utils.py", line 339, in get_tree_list with os.scandir(path) as it:
Analysis
The fix provided in NXDRIVE-1970 is not enough as one can check if a path is a folder and not having enough rights to browse it.
Fix
That patch should do the trick:
diff --git a/nxdrive/utils.py b/nxdrive/utils.py index 0a48eb4b..9c2ef15c 100644 --- a/nxdrive/utils.py +++ b/nxdrive/utils.py @@ -320,9 +320,9 @@ def get_tree_list(path: Path) -> Generator[Tuple[Path, int], None, None]: Note: this function cannot be decorated with lru_cache(). """ try: - path.is_dir() + it = os.scandir(path) except OSError: - log.warning(f"Error calling is_dir() on {path!r}", exc_info=True) + log.warning(f"Cannot browse {path!r}", exc_info=True) return # Check that the path can be processed @@ -336,7 +336,7 @@ def get_tree_list(path: Path) -> Generator[Tuple[Path, int], None, None]: yield path, 0 # Then, yield its children - with os.scandir(path) as it: + with it: for entry in it: # Check the path can be processed if entry.name.startswith(Options.ignored_prefixes) or entry.name.endswith(
Tests will be needed.
- Is referenced in