facebook / facebook/zstd

cannot write block : Broken pipe, when cutting pipe in windows

未关闭
#4,563 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C
星标
27.9k
派生
2.6k
平均合并
1 天 3 小时
30 天内合并 PR
8

描述

**Describe the bug**
In windows (here: 7, x64) decompressing to stdout and piping it to head or dd ends with an error if they don't consume all input.

**To Reproduce**
Tested on [ep_meps.json.zst](https://parltrack.org/dumps/ep_meps.json.zst) from [parltrack dumps](https://parltrack.org/dumps/ep_meps.json.zst).

```
$ zstd -V
*** Zstandard CLI (64-bit) v1.5.7, by Yann Collet ***

$ zstd -dc ep_meps.json.zst > ep_meps.json

$ zstd -dc ep_meps.json.zst | head -c 1000 > ep_meps.json.1k
zstd: error 70 : Write error : cannot write block : Broken pipe

$ zstd -dc ep_meps.json.zst | head -c 1000000 > ep_meps.json.1M
zstd: error 70 : Write error : cannot write block : Invalid argument

$ zstd -dc ep_meps.json.zst | head -c 10000000 > ep_meps.json.10M
zstd: error 70 : Write error : cannot write block : Broken pipe

$ zstd -dc ep_meps.json.zst | head -c 100000000 > ep_meps.json.100M
zstd: error 70 : Write error : cannot write block : Broken pipe
```

Which in my opinion is not an error.

Others don't do that:

```
$ gzip -dc ep_meps.json.gz | head -c 1000000 > nul

$ bzip2 -dc ep_meps.json.bz2 | head -c 1000000 > nul

$ unzip -p ep_meps.json.zip | head -c 1000000 > nul
```

Although some do:

```
$ pigz -dc ep_meps.json.gz | head -c 1000000 > nul
error on (Invalid argument)

$ 7z x -so ep_meps.json.gz | head -c 1000000 > nul
ERROR: The pipe is being closed.

$ lzip -dc ep_meps.json.lz | head -c 1000000 > nul
lzip: Write error: Broken pipe
```

Which is weird.

I cannot compare it wit \*nix, as I can't jump switch to linux just like that, nor just for that, but I don't remember ever having such issue there.

**Expected behavior**
I don't consider it error. If something than maybe warning, but not an error as it suggests that something wrong happened when it's not the case.

**Desktop (please complete the following information):**
- OS: Windows 7, x64
- Compiler: ? (release downloaded from github or sourceforge)
- Flags: default

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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