Skip to content

ZipFile hangs when encountering named pipe #85097

@tmds

Description

@tmds

The following program hangs:

using System.ComponentModel;
using System.IO.Compression;
using System.Runtime.InteropServices;

var dir = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName())).FullName;
int res = MkFifo(Path.Combine(dir, "fifo"), 0x1ff);
if (res != 0)
{
    throw new Win32Exception();
}

ZipFile.CreateFromDirectory(dir, Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()));

[DllImport("libSystem.Native", EntryPoint = "SystemNative_MkFifo", SetLastError = true)]
static extern int MkFifo(string pathName, uint mode);

ZipFile handles the fifo as a regular file. The open call doesn't return (because there is no peer that has it opened for writing, and the fifo isn't opened as non-blocking).

Instead of trying to open the fifo, we should either skip it, or throw an exception for encountering an unsupported file type.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions