`WriteEntry(TarEntry, bool)` writes the entry without bytes if the file is used by another process
还没有人认领这个 Issue。
评估
调研方向
从 src/ICSharpCode.SharpZipLib/Tar/TarArchive.cs 中 WriteEntry(TarEntry, bool) 附近的链接行开始,重点查看添加条目的位置以及文件读取引发 IOException 的位置。跟踪读取失败如何到达归档释放流程,并检查现有的 Tar 相关测试。当被锁定的文件能够产生清晰的上下文错误,且不会留下导致后续 TarException 的悬空条目时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
This issue makes it inconvenient to use SharpZipLib, because disposing the tar archive will throw a TarException that hides the underlying issue. When a file is used by another process, WriteEntry(TarEntry, bool) writes the entry, but obviously not the bytes (which is fine). Due to the dangling tar entry, disposing (leaving the using block) the tar archive throws:
Entry closed at '0' before the 'x' bytes specified in the header were written.
It is not clear which file is responsible for the error. Following line throws an IOException:
if a file is used by another process, but a few lines before, the entry is already added:
Reproduction Code
No response
Steps to reproduce
-
Expected behavior
WriteEntry(TarEntry, bool) fails with a clear error message that considers the context.
Operating System
Windows, macOS, Linux
Framework Version
.NET 7, .NET 6
Tags
Tar
Additional context
As workaround I check in advance if the process can read the file.
- 主要语言
- C#
- 星标
- 3.9k
- 派生
- 1k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
icsharpcode/SharpZipLib 的其他 Issue
-
*no response* bug
难度 1/5 1 小时以内 新手友好度 78/100
icsharpcode/SharpZipLib#905 · 1 条评论 ·
-
bug bzip2
难度 4/5 3-5 天 新手友好度 45/100
icsharpcode/SharpZipLib#904 ·
-
enhancement zip
难度 2/5 1-2 天 新手友好度 55/100
icsharpcode/SharpZipLib#903 ·
-
*no response* bug
难度 4/5 3-5 天 新手友好度 32/100
icsharpcode/SharpZipLib#901 · 1 条评论 ·
-
*no response* bug
难度 4/5 3-5 天 新手友好度 35/100
icsharpcode/SharpZipLib#894 · 1 条评论 ·
查看 icsharpcode/SharpZipLib 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
fluentassertions/fluentassertions#3353 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 半天 新手友好度 78/100
unoplatform/uno#24769 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
AvaloniaUI/Avalonia#22323 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
microsoft/onnxruntime-genai#2633 ·
维护者通常 1 天内回复