X-Recipient: archive-cygwin AT delorie DOT 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 AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT 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: References: Date: Mon, 28 Dec 2015 10:20:31 -0800 Message-ID: Subject: Re: cmp (or echo) bug? From: Michael Enright To: cygwin AT cygwin DOT 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