Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

`WriteEntry(TarEntry, bool)` writes the entry without bytes if the file is used by another process

Abierto
#819 6 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
csharp
Área
backend

Línea de trabajo

Comienza en src/ICSharpCode.SharpZipLib/Tar/TarArchive.cs en las líneas enlazadas alrededor de WriteEntry(TarEntry, bool), especialmente donde se añade la entrada y donde la lectura del archivo produce una IOException. Sigue cómo una lectura fallida llega a la eliminación del archivo y revisa las pruebas existentes relacionadas con Tar. Se considera terminado cuando un archivo bloqueado produce un error contextual claro sin dejar una entrada huérfana que provoque posteriormente una TarException.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug tar
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:

https://github.com/icsharpcode/SharpZipLib/blob/c51ef18c55988e3251b15f038ced1d9064b6da2f/src/ICSharpCode.SharpZipLib/Tar/TarArchive.cs#L891

if a file is used by another process, but a few lines before, the entry is already added:

https://github.com/icsharpcode/SharpZipLib/blob/c51ef18c55988e3251b15f038ced1d9064b6da2f/src/ICSharpCode.SharpZipLib/Tar/TarArchive.cs#L876

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.

Lenguaje dominante
C#
Estrellas
3.9k
Forks
1k
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de icsharpcode/SharpZipLib

Todos los issues de icsharpcode/SharpZipLib

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.