jb2170 / better-adb-sync

Completely rewritten adbsync with --exclude
Apache License 2.0
344 stars 22 forks source link

ADB line not captured ? #13

Open xandro0777 opened 2 years ago

xandro0777 commented 2 years ago

Getting this error:

debian:~/rlm-rz$ adb-sync --pull /storage/emulated/0 .
ADB line not captured
ls: ./apex: Permission denied
Stack (most recent call last):
  File "/home/rz/bin/adb-sync", line 6, in <module>
    ADBSync.main()
  File "/home/rz/prog/better-adb-sync/src/ADBSync/__init__.py", line 364, in main
    files_tree_source = fs_source.get_files_tree(path_source, follow_links = argargs.copy_links)
  File "/home/rz/prog/better-adb-sync/src/ADBSync/FileSystems/Base.py", line 45, in get_files_tree
    return self._get_files_tree(tree_path, statObject, follow_links = follow_links)
  File "/home/rz/prog/better-adb-sync/src/ADBSync/FileSystems/Base.py", line 33, in _get_files_tree
    tree[filename] = self._get_files_tree(
  File "/home/rz/prog/better-adb-sync/src/ADBSync/FileSystems/Base.py", line 30, in _get_files_tree
    for filename, stat_object_child, in self.lstat_in_dir(tree_path):
  File "/home/rz/prog/better-adb-sync/src/ADBSync/FileSystems/Android.py", line 190, in lstat_in_dir
    yield self.ls_to_stat(line)
  File "/home/rz/prog/better-adb-sync/src/ADBSync/FileSystems/Android.py", line 153, in ls_to_stat
    self.line_not_captured(line)
  File "/home/rz/prog/better-adb-sync/src/ADBSync/FileSystems/Android.py", line 103, in line_not_captured
    logging_fatal(line)

adb shell, adb logcat etc work fine. Previously used original adb-sync which stopped working with a "connection reset by peer" so tried your variant. Don't know when exactly it stopped working but possibly after a supposedly minor Android update.

TIA

jb2170 commented 2 years ago

Ah that's probably a missing regex / unhandled case by adbsync. I left a comment here for myself to possibly handle that

xandro0777 commented 2 years ago

What would be the reason for this permission error, any hint for a workaround? Everything else adb related still seems to work.

StoneLabs commented 1 year ago

Ah that's probably a missing regex / unhandled case by adbsync. I left a comment here for myself to possibly handle that

I'm running into the same error.

[2023-04-13 20:48:19][CRITICAL] ls: /storage/emulated/0/Android/data/org.videolan.vlc/files/medialib: Permission denied (SAOLogging.py:63)
[2023-04-13 20:48:19][DEBUG] Stack Trace (SAOLogging.py:64)
Stack (most recent call last):
  File "C:\Users\Stone\Repos\better-adb-sync\src\adbsync.py", line 6, in <module>
    ADBSync.main()
  File "C:\Users\Stone\Repos\better-adb-sync\src\ADBSync\__init__.py", line 374, in main
    files_tree_source = fs_source.get_files_tree(path_source, follow_links = args.copy_links)
  File "C:\Users\Stone\Repos\better-adb-sync\src\ADBSync\FileSystems\Base.py", line 45, in get_files_tree
    return self._get_files_tree(tree_path, statObject, follow_links = follow_links)
  File "C:\Users\Stone\Repos\better-adb-sync\src\ADBSync\FileSystems\Base.py", line 33, in _get_files_tree
    tree[filename] = self._get_files_tree(
  File "C:\Users\Stone\Repos\better-adb-sync\src\ADBSync\FileSystems\Base.py", line 33, in _get_files_tree
    tree[filename] = self._get_files_tree(
  File "C:\Users\Stone\Repos\better-adb-sync\src\ADBSync\FileSystems\Base.py", line 33, in _get_files_tree
    tree[filename] = self._get_files_tree(
  [Previous line repeated 3 more times]
  File "C:\Users\Stone\Repos\better-adb-sync\src\ADBSync\FileSystems\Base.py", line 30, in _get_files_tree
    for filename, stat_object_child, in self.lstat_in_dir(tree_path):
  File "C:\Users\Stone\Repos\better-adb-sync\src\ADBSync\FileSystems\Android.py", line 197, in lstat_in_dir
    yield self.ls_to_stat(line)
  File "C:\Users\Stone\Repos\better-adb-sync\src\ADBSync\FileSystems\Android.py", line 159, in ls_to_stat
    self.line_not_captured(line)
  File "C:\Users\Stone\Repos\better-adb-sync\src\ADBSync\FileSystems\Android.py", line 105, in line_not_captured
    logging_fatal(line)
  File "C:\Users\Stone\Repos\better-adb-sync\src\ADBSync\SAOLogging.py", line 64, in logging_fatal
    logging.debug("Stack Trace", stack_info = log_stack_info)
[2023-04-13 20:48:19][CRITICAL] Exiting (SAOLogging.py:65)

Adding this here

        elif self.RE_LS_PERMISSION_DENIED.fullmatch(line):
            raise PermissionError

and this here

    RE_LS_PERMISSION_DENIED = re.compile("ls: .*: Permission denied$")

Captured the error successfully. However, i don't know how to handle it properly.

mcclure commented 5 months ago

On Ubuntu 23.10 with Python 3.11.6 installed through apt and adb-sync installed through pipx, I am getting this same error but with a slightly less friendly error presentation

Screenshot from 2024-04-08 23-35-04

I find I get this error when I ask for "too general" a directory, for example, pulling /sdcard/Android/data fails with this error but I can pull sub-directories within /sdcard/Android/data fine