DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 45BEKOlc2974535
Authentication-Results: delorie.com;
	dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=NU2gVZzM
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6852B385DDD7
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1718115622;
	bh=87/F9P564o820L1PcDOTahgkt132hR6bN5vimR8MsOI=;
	h=To:Subject:Date:References:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=NU2gVZzMb9kSPRmbsaMMl8lUWvIIyvmg1mXRTFT5w8ijxvW5B557DY1r+PE54L0er
	 y20jKA5kBZp5dUwKch0eXHpkDLZWPyVZZMXkATWjVsDRkaGvUAgpcUk1ikWN5F9NsG
	 ZDMHbfa/ec11km5hyo+KNr6g03EnCJTKmY3rAecw=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3ED7B3858C5F
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3ED7B3858C5F
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718115600; cv=none;
 b=xSw0VpYqmf2a4a5YKdN977WQ3mQ9wR/iM3geKMzUiCydAxcjFrFlMauTATocVn3ZCcTMifdBeQA5OdVdaZJpr0rVsGKAw2c7jegOLRRVce25M+2D5ge4pWMhoZ84mS4sjPj9trfGVcl+9oh1ZhQZE9lq8QM8DZO5Ib5a9S9BEhA=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1718115600; c=relaxed/simple;
 bh=JavwksqraCbgfUlpEUD7nEszftXRv/fcmJnNHwJXVfk=;
 h=To:From:Subject:Date:Message-ID:Mime-Version;
 b=jxIb8HPTYLR8UumP4i3G5c+D+RgEGqd4vseRMrz7avXTYHlObKWa+hpNbLAQ5aYZfJLnNTjwTWuVlzbS2LD+XsPycUgYFB2muToIPhPk3rEuVhqhcnG5iFZ2G2kvC6fBJ57bFl3lQgRose64QSm0z4xiq6CGI/Rxc+vk3ZcISbM=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Injected-Via-Gmane: http://gmane.org/
To: cygwin@cygwin.com
Subject: Re: Bug: bash redirect "magic" variable content to input of command
 hangs (upstream of https://github.com/git-for-windows/git/issues/5001)
Date: Tue, 11 Jun 2024 23:19:11 +0900
Message-ID: <v49me6$sju$3@ciao.gmane.io>
References: <git-for-windows/git/issues/5001@github.com>
 <git-for-windows/git/issues/5001/2157897799@github.com>
 <trinity-3cedf922-0401-4736-a503-cfd5bb21f750-1718017964332@3c-app-gmx-bs33>
Mime-Version: 1.0
User-Agent: Thunderbird Daily
Content-Language: en-US
In-Reply-To: <trinity-3cedf922-0401-4736-a503-cfd5bb21f750-1718017964332@3c-app-gmx-bs33>
X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,
 FORGED_GMAIL_RCVD, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,
 HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NML_ADSP_CUSTOM_MED,
 SPF_HELO_NONE, SPF_PASS, TXREP,
 T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: jojelino via Cygwin <cygwin@cygwin.com>
Reply-To: jojelino <jojelino@gmail.com>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

On 6/10/2024 8:12 PM, Holger Klene via Cygwin wrote:
> This is:
> GNU bash, Version 5.2.21(1)-release (x86_64-pc-cygwin)
> 
> Was also reproduced in git-bash 5.2.26(1)-release (also cygwin)
> but not in WSL-bash 5.1.16 (independent of cygwin)
This regression is introduced in bash-5.1, Introduced changes in both 
here-string, here-document in 5.1 caused hangs.

Apart from that, unlike to Linux, Cygwin chunks io of pipe into 64K and 
NtWriteFile writes to a pipe even after the pipe exceeded buffer size 
while reporting STATUS_PENDING, So in Cygwin, divide by 2 of actual 
buffer size is within boundary of pipe buffer as seen below.
$ dd if=/dev/urandom bs=63K status=progress | sleep 3
129024 bytes (129 kB, 126 KiB) copied, 3 s, 42.8 kB/s
$ dd if=/dev/urandom bs=128 status=progress | sleep 3
65664 bytes (66 kB, 64 KiB) copied, 3 s, 21.9 kB/s

And current bash package make wrong estimate of pipe size of host 
environment according to builtins/psize.sh of cygport source package of 
bash.

====
Excerpt from builtins/psize.sh of bash, You can guess what the result 
will be From the above.
./psize.aux 2>"$TMPFILE" | sleep 3



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