Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

ltfs_ordered_copy: copying several files into a directory fails with 'Is a directory' since v2.4.9.0

未关闭 适合新手
#661 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 6 天内回复

@MitchelTighe 已经在做这个了。

开始于 2026年10月16日。

  • #662 来自 @MitchelTighe —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
cli

调研方向

从 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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

LinearTapeFileSystem/ltfs 的其他 Issue

查看 LinearTapeFileSystem/ltfs 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。