Non-portable regression caused by 25fee28c/#879011
Reposting from: https://lists.reproducible-builds.org/pipermail/diffoscope/2020-March/002632.html
Folks,
I started using diffoscope on FreeBSD to aid Hervé Boutemy's work for
Maven reproducibility. I have noticed that
25fee28c8b29dbc66cd7bb57a2ab427651050c23 uses a non-portable approach by
utilizing the /dev/stdin symlink. zipinfo exits with 9.
I have described the problem with /dev/stdin in detail [here](https://lists.freebsd.org/pipermail/freebsd-questions/2020-March/288177.html), and about its [non-portability](https://unix.stackexchange.com/a/36404/40618).
The upshot is:
* `/dev/stdin` is not POSIX
* It may not behave the way you expect
* unzip explicitly does not support pipe or character devices:
> Archives read from standard input are not yet supported, except with
> funzip (and then only the first member of the archive can be
> extracted).
* When you read the source code you'll see that `stat(2)` output is not
checked for regular file and it queries the stat struct for st_size is
is 0 for streams like pipes or character devices.
* It maybe some special feature of Linux/glibc to replace the stat
information of `/dev/stdin` of the file read, but that is, imho, highly
questionable.
The attached patch solves the problem for me. I don't want to live with
downstream patch forever. Please consider upstreaming it
[0001-Restore-portability-of-zipinfo-call-caused-by-a-regr.patch](/uploads/33c9c0a3c658ae9099cf0a00c5953b56/0001-Restore-portability-of-zipinfo-call-caused-by-a-regr.patch)
issue