Mail archive
alpine-devel

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

From: Lasse Collin <lasse.collin_at_tukaani.org>
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
>
> http://pubs.opengroup.org/onlinepubs/009695399/utilities/diff.html
>
> 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)

    http://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html

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 -
    1c1
    < foo
    ---
> bar
    sh$ echo $?
    1

Switching to BusyBox diff:

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

Or:

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

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

-- 
Lasse Collin  |  IRC: Larhzu _at_ IRCnet & Freenode
---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Sat Jul 04 2015 - 12:21:54 GMT