sync seems to ignore --exclude-dir-regex

Đang mở
#1,041 0 bình luận 2 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

The traceback ends in _walk_relative_paths in b2sdk's scan/folder.py (around lines 239-258), which calls pathlib iterdir on a subdirectory that the --exclude-dir-regex should have skipped. Read that walk and check whether the exclude-dir check runs before the recursion descends. Reproduce with a tree that contains an unreadable directory matching the regex. Done when the excluded directory is skipped without being opened, and the sync command finishes without a PermissionError.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Greetings,

While using the sync command on b2-windows version 4.1.0 on Windows 11 (x86_64), the program gives an error message when it hits a directory it cannot access, even when that directory is in --exclude-dir-regex.

Command-line (run in terminal as an administrator):

b2-windows.exe sync --skip-newer --threads 1 --destination-server-side-encryption=SSE-C --no-progress --exclude-all-symlinks --exclude-dir-regex=".*\\Users\\Temp|.*\\Default User|.*\\Users\\Default" --keep-days 60 "C:\Users" b2:bucketname/syncs/lap-24/C/Users

I receive this error

Traceback (most recent call last):
  File "b2\_internal\b2v4\__main__.py", line 13, in <module>
  File "b2\_internal\console_tool.py", line 5529, in main
  File "b2\_internal\console_tool.py", line 5402, in run_command
  File "b2\_internal\console_tool.py", line 1070, in run
  File "b2\_internal\console_tool.py", line 3165, in _run
  File "b2sdk\_internal\sync\sync.py", line 214, in sync_folders
  File "b2sdk\_internal\sync\sync.py", line 263, in _make_folder_sync_actions
  File "b2sdk\_internal\scan\scan.py", line 48, in zip_folders
  File "b2sdk\_internal\scan\folder.py", line 152, in all_files
  File "b2sdk\_internal\scan\folder.py", line 258, in _walk_relative_paths
  File "b2sdk\_internal\scan\folder.py", line 258, in _walk_relative_paths
  File "b2sdk\_internal\scan\folder.py", line 258, in _walk_relative_paths
  [Previous line repeated 1 more time]
  File "b2sdk\_internal\scan\folder.py", line 239, in _walk_relative_paths
  File "pathlib.py", line 1056, in iterdir
PermissionError: [WinError 5] Access is denied: '\\\\?\\C:\\Users\\Default\\AppData\\Local\\Application Data'
[6520] Failed to execute script '__main__' due to unhandled exception!

When testing the regex in a web-tester, it appears to be correct
image

The program shouldn't be attempting to access a subdirectory of an excluded directory. According to the command-line tool documentation:

When a directory is excluded by using --exclude-dir-regex, all of the files within it are excluded, even if they match an --include-regex pattern. This means that there is no need to look inside excluded directories, and you can exclude directories containing files for which you don’t have read permission and avoid getting errors.

Thanks 👍

Ngôn ngữ chính
Python
Star
638
Fork
138
Merge trung bình
8 giờ 27 phút
Pull request đã merge (30 ngày)
8

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Backblaze/B2_Command_Line_Tool

Tất cả issue của Backblaze/B2_Command_Line_Tool

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.