ltfs_ordered_copy: copying several files into a directory fails with 'Is a directory' since v2.4.9.0
维护者通常 6 天内回复
评估
调研方向
从 src/utils 下的 ltfs_ordered_copy 脚本开始,查看 CopyItem.run() 以及它调用的 _run_copy() 辅助函数,该函数使用 open(self.dst, 'wb') 打开目标。使用 issue 中的 mkdir 和 ltfs_ordered_copy 命令复现问题,以两个普通文件和一个已存在的目录作为目标。完成的标准是:两个文件都以各自的名称复制到该目录中,--keep-tree 情况和单一源情况的行为与之前一致,并且单一源的路径保持不变。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- C
- 星标
- 359
- 派生
- 112
- 平均合并
- 5 天 1 小时
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
LinearTapeFileSystem/ltfs 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 55/100
LinearTapeFileSystem/ltfs#663 ·
维护者通常 6 天内回复
-
2.4.9.1 mkltfs failed可能已有人在做 @madjesc 于 9 天前认领。 未关闭Investigating
LinearTapeFileSystem/ltfs#656 · 3 条评论 · 已指派 1 人 ·
维护者通常 6 天内回复
-
ltfs/mkltfs segfault when the drive INQUIRY vendor id is not IBM/HP/HPE/QUANTUM (NULL deref in _raw_open)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 25/100
LinearTapeFileSystem/ltfs#650 ·
维护者通常 6 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
LinearTapeFileSystem/ltfs#647 · 1 条评论 ·
维护者通常 6 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
LinearTapeFileSystem/ltfs#643 ·
维护者通常 6 天内回复
查看 LinearTapeFileSystem/ltfs 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 1/5 1 小时以内 新手友好度 93/100
webarkit/WebARKitLib#107 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
polhenarejos/pico-fido#302 ·
-
难度 2/5 1-3 小时 新手友好度 67/100
espressif/esp-vision#16 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 74/100
libsdl-org/SDL#16577 ·
维护者通常 1 天内回复