X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type
	:content-transfer-encoding; q=dns; s=default; b=i/dGBDURxdf7pmce
	nPQkqebIK564iIzwjVlPQDTwjbjHaUjw0tu9lTjqhSO3hRE5txzYV7aOY3tjd4WI
	fiyArLk0Tut3rCflrKEGaPjK5jx1xNFVCCRzeYzttBmK1PbcU6LHU8UkvEW6AZ+Z
	OXcjNxD4h4TNpqXvK2ZC3Lu8adk=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type
	:content-transfer-encoding; s=default; bh=Fg+SZ0+yzRK+XMPhDv1yCB
	HWrMo=; b=imIQ+LXRjrEwyk2bDJyZFhn2dSW9IUpJQlznf+53kP53GrG7GTNP+o
	op+FeNlv3cgVeBZR/nbdz2RgWoxwSK7dEuEDHDo5V2Dy4SJCaJ3avFtOku0eoNTh
	LSOKtqFhiRc+KBGvzj5M7I/KDa1W6BLDyzRH4tQXAC+dEC1j/hVsM=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=H*i:sk:CAPJ9Yc, prefers
X-HELO: mail-yk0-f181.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20130820;        h=x-gm-message-state:mime-version:in-reply-to:references:date         :message-id:subject:from:to:content-type:content-transfer-encoding;        bh=xtLpzOBfqD0Ip784+D8M0MOWfsMq8+/0rvrdaPsnIRo=;        b=Hn8I1TdGayMLEzqBuAdVZfCXmpEhYwHo9D+0/ZP/DoEfc/yQTxB64wNHjat9yXgaDM         zsqXD6bhCTTOGUvTd2V+aPtEN4Wmy2RDkXE2If6tKaWFjNzNCKT8kNBuPET1GQlJSacM         BSaaHVLEKb3ZNuct9VNfxslrlMvzB8BH6rm+LsHbeOUNBSWQFWC3Y8D442/9BGEf/+Ll         cEdYjKajaWPHtQBL4EkmXA+0CbSno8bo0Y/Egy7dkVcfocoKEOdzCbczF+kJYW9VIirN         0TKt0i+AcPxp+lzA4ah9Gq2e0ekmpcJKUtBa+12xglfeTWmF03WvhgGhXwKP356qKPDS         zrBg==
X-Gm-Message-State: ALoCoQmi3NU1HtBo8GXrWW4Nr1E1suEQPeJBMjVzOaDGw4S3dSAHpUX2+PB3SgXVspM9uzihMErK5nBY51fBXzFjYZpDz+5Gug==
MIME-Version: 1.0
X-Received: by 10.13.204.204 with SMTP id o195mr31284754ywd.175.1451326831131; Mon, 28 Dec 2015 10:20:31 -0800 (PST)
In-Reply-To: <CAPJ9Yc9zSpvPLE3kDvFGoS9w9Btuazw2CVOTHZoDDtuoO8UG6w@mail.gmail.com>
References: <CAPJ9Yc9uFnFSFPkYxJj2A87EzZVNrWx2mN5Pq6SxCwpf_78QVQ@mail.gmail.com>	<loom.20151226T134911-504@post.gmane.org>	<CAPJ9Yc9zSpvPLE3kDvFGoS9w9Btuazw2CVOTHZoDDtuoO8UG6w@mail.gmail.com>
Date: Mon, 28 Dec 2015 10:20:31 -0800
Message-ID: <CAOC2fq_mZtrX-EyT6QkzoSfXgqQW8OHsiPmoeBktosfE1cx2xQ@mail.gmail.com>
Subject: Re: cmp (or echo) bug?
From: Michael Enright <mike@kmcardiff.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8
X-IsSubscribed: yes
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id tBSIKjK1024067

On Mon, Dec 28, 2015 at 9:08 AM, David Balažic wrote:
> I tried it in zsh (32 bit cygwin) and there it works correctly:
>
> $  cmp  <(echo echo1)  <(echo echo2)
> /tmp/zshirbIJ1 /tmp/zshDsdZep differ: byte 5, line 1
>
> So it seems the bug is in bash.
>
A different conclusion is also supportable: That the two pipe
mechanisms have different edge-case behavior, resulting in different
outcomes for the command depending on which pipe type is used..

I tried this on 32-bit cygwin, Windows 7/64:
$ cmp <(for i in 1 2 3 4 5; do echo echo$i; done) <(for i in 1 2 3 4
6; do echo echo$i; done)
/dev/fd/63 /dev/fd/62 differ: byte 29, line 5

Your output from zsh shows named pipes are in use. "man zshexpn" says
that zsh can use anonymous pipes, yet it chose not to in your case. In
my case bash chose to use anonymous pipes, even though "man bash" says
it may use named pipes.

The man pages for these shells describe essentially the same syntax
and mechanisms for this process substitution mechanism. What is not
defined:
1) How do commands such as my for loop command or your simple echo
command provide output properly so that EOF isn't detected spuriously
2) How do programs such as cmp or diff read from their input in such a
way that they are not fooled by a file status that might appear to be
EOF but isn't.
3) Crystalline clarity as to when the shell prefers one pipe type to
another, at least not to this reader, and not that it matters.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


