Mail archive

[alpine-devel] Re: xzdiff in xz package is broken on alpine linux

From: Lasse Collin <>
Date: Sat, 4 Jul 2015 12:21:54 +0300

On 2015-07-03 Michael Fox wrote:
> Do you think it's a bug in busybox? I think they follow this opengroup
> standard
> It's hard to tell from the description of diff in that document
> whether and how it should deal with two stdin pipes.

There is just one stdin which often (but not always) is a pipe.

Both POSIX.1-2001 (your link) and the latest version (POSIX.1-2008)

say that diff should work with pipes:

    Many early implementations of diff require seekable files. Since
    the System Interfaces volume of POSIX.1-2008 supports named pipes,
    the standard developers decided that such a restriction was
    unreasonable. Note also that the allowed filename - almost always
    refers to a pipe.

> I was hoping this might work:
> diff <(echo foo) <(echo bar)
> But no. This part of the standard describes a subshell environment but
> scrolling up it gives grammar:

Seems that I confused you with the bash-specific syntax. Sorry about
that. The syntax used with the shell has nothing to do with diff. Here
is a test case using POSIX sh:

    sh$ mkfifo fifo
    sh$ echo foo > fifo &
    sh$ echo bar | diff fifo -
    < foo
> bar
    sh$ echo $?

Switching to BusyBox diff:

    sh$ mkfifo fifo
    sh$ echo foo > fifo &
    sh$ echo bar | busybox diff fifo -
    sh$ echo $?


    sh$ mkfifo fifo fifo2
    sh$ echo foo > fifo &
    sh$ echo bar > fifo2 &
    sh$ busybox diff fifo fifo2
    sh$ echo $?

diff from BusyBox 1.23.2 doesn't work if both arguments are pipes.

Lasse Collin  |  IRC: Larhzu _at_ IRCnet & Freenode
Received on Sat Jul 04 2015 - 12:21:54 UTC