ltfs_ordered_copy: copying several files into a directory fails with 'Is a directory' since v2.4.9.0
Maintainer thường phản hồi trong vòng 6 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
Bắt đầu từ script ltfs_ordered_copy trong src/utils, tại CopyItem.run() và hàm trợ giúp _run_copy() mà nó gọi, hàm này mở đích bằng open(self.dst, 'wb'). Tái hiện lỗi bằng các lệnh mkdir và ltfs_ordered_copy trong issue, dùng hai tệp thông thường và một thư mục đã tồn tại làm đích. Hoàn thành khi cả hai tệp được sao chép vào thư mục với đúng tên của chúng, trường hợp --keep-tree và trường hợp chỉ có một nguồn vẫn hoạt động như trước, và đường xử lý một nguồn không thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Since v2.4.9.0, ltfs_ordered_copy fails every file when several files (or a -t list from stdin) are copied into a destination directory. This is the second and fourth example in the man page:
$ ltfs_ordered_copy /foo/aaa /foo/bbb /bar
$ find /foo/ddd -type f | ltfs_ordered_copy -t /bar
Output:
Failed to copy "src/a.txt" to "dst": [Errno 21] Is a directory: 'dst'
Failed to copy "src/b.txt" to "dst": [Errno 21] Is a directory: 'dst'
Copied 0 files, Failed 2 files.
To Reproduce
mkdir src dst && echo aaa > src/a.txt && echo bbb > src/b.txt
ltfs_ordered_copy src/a.txt src/b.txt dst
The same command with src/utils/ltfs_ordered_copy taken from earlier commits:
| Commit | Result |
|---|---|
| efc9e3a (Release/v2.4.9.0, #649) | Copied 0 files, Failed 2 files |
| efc9e3a~1 (2026-07-29) | Copied 2 files |
| fd41c66 (2023-11-27) | Copied 2 files |
| 303ca43 (2020-12-09) | Copied 2 files |
Cause
#649 replaced shutil.copy2() / shutil.copy() in CopyItem.run() with _run_copy(), which does open(self.dst, 'wb') so it can drive the progress bar. shutil.copy accepted a directory as the destination and appended the source file name. open() does not, so any plain-file source whose destination is a directory fails. With --keep-tree the destination is a full file path, so that case still works. The single-source case is handled separately with shutil.copy, so it is also unaffected.
Expected behavior
Files are copied into the directory under their own names, as before v2.4.9.0.
Environment
Python 3, current main (efc9e3a). Reproduced off-tape with a stub xattr module, so the non-LTFS destination path is exercised. The failure is in the copy step itself, which LTFS and non-LTFS destinations share.
- Ngôn ngữ chính
- C
- Star
- 358
- Fork
- 111
- Merge trung bình
- 5 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của LinearTapeFileSystem/ltfs
-
2.4.9.1 mkltfs failedCó thể đã có người làm @madjesc đã nhận 2 ngày trước. Đang mởInvestigating
LinearTapeFileSystem/ltfs#656 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
LinearTapeFileSystem/ltfs#650 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
LinearTapeFileSystem/ltfs#647 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
LinearTapeFileSystem/ltfs#643 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Format fails on HP LTO-6 6250 with Adaptec HBACó thể làm lại được @madjesc đã nhận 46 ngày trước và không có pull request nào đang mở. Đang mởH/W issue HBA Report Investigating
LinearTapeFileSystem/ltfs#640 · 8 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 6 ngày
Tất cả issue của LinearTapeFileSystem/ltfs
Issue tương tự
-
backlog bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
EchoTools/nevr-runtime#653 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
InfiniTimeOrg/InfiniTime#2492 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày
-
system: coco
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
FujiNetWIFI/fujinet-config#274 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
base-files: 82_config_generate: regenerate /etc/board.json if 0-bytes / truncated after power cutĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
openwrt/openwrt#25940 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày