From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 588161e9 for ; Wed, 8 Jan 2020 08:34:39 +0000 (UTC) Received: (qmail 21824 invoked by alias); 8 Jan 2020 08:34:31 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45264 Received: (qmail 15928 invoked by uid 1010); 8 Jan 2020 08:34:31 -0000 X-Qmail-Scanner-Diagnostics: from rcpt-expgw.biglobe.ne.jp by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25684. spamassassin: 3.4.2. Clear:RC:0(133.208.98.3):SA:0(-2.6/5.0):. Processed in 7.19457 secs); 08 Jan 2020 08:34:31 -0000 X-Envelope-From: takimoto-j@kba.biglobe.ne.jp X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at spf01.biglobe.ne.jp designates 133.208.98.3 as permitted sender) X-Biglobe-Sender: From: Jun T Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: [PATCH] use /dev/fd on Cygwin for process substitution Message-Id: <8E2BA7B0-333E-47E6-B912-1D1F29FD3860@kba.biglobe.ne.jp> Date: Wed, 8 Jan 2020 17:33:48 +0900 To: zsh-workers@zsh.org X-Mailer: Apple Mail (2.3445.104.11) X-Biglobe-Spnum: 21625 Tests C04 and D03 fail on Cygwin: ./C04funcdef.ztst: @@ -1,2 +1 @@ -process expanded expanded to file Test ./C04funcdef.ztst failed: output differs from expected as shown = above for: () (cat $1 $2) <(print process expanded) =3D(print expanded to file) Was testing: Process substitution with anonymous functions ./D03procsubst.ztst: @@ -1,2 +0,0 @@ -First -Zweite Test ./D03procsubst.ztst failed: output differs from expected as shown = above for: copycat <(print First) <(print Zweite) Was testing: FDs remain open for external commands called from functions As can be seen, both are related with the process substitution. On Cygwin, FIFO (not /dev/fd) is used for the process substitution because PATH_DEV_FD is unset in configure.ac, line 2062: [if test "$host_os" =3D cygwin; then dnl In current (2008/12/01) versions of Cygwin these are present but = don't dnl seem to work smoothly for process substitution; no great surprise dnl since getting processes to work at all on Cygwin is a big challenge. dnl We'll rely on FIFOs, since they do what we need. zsh_cv_sys_path_dev_fd=3Dno If I remove this part (as in the patch below) the two tests succeed. So I *guess* /dev/fd is now working as expected on Cygwin. (maybe there are some race conditions for FIFO) In the patch I also removed the cygwin-specific section for FIFO since on recent Cygwin configure can correctly detect FIFO without it (although FIFO is not used if PATH_DEV_FD is set). diff --git a/configure.ac b/configure.ac index 8fd4d452f..c8885cac5 100644 --- a/configure.ac +++ b/configure.ac @@ -2059,17 +2059,9 @@ dnl be good enough. AH_TEMPLATE([PATH_DEV_FD], [Define to the path of the /dev/fd filesystem.]) AC_CACHE_CHECK(for /dev/fd filesystem, zsh_cv_sys_path_dev_fd, -[if test "$host_os" =3D cygwin; then -dnl In current (2008/12/01) versions of Cygwin these are present but = don't -dnl seem to work smoothly for process substitution; no great surprise -dnl since getting processes to work at all on Cygwin is a big = challenge. -dnl We'll rely on FIFOs, since they do what we need. -zsh_cv_sys_path_dev_fd=3Dno -else [for zsh_cv_sys_path_dev_fd in /proc/self/fd /dev/fd no; do test x`echo ok|(exec 3<&0; cat $zsh_cv_sys_path_dev_fd/3 = 2>/dev/null;)` =3D xok && break - done] -fi]) + done]) if test x$zsh_cv_sys_path_dev_fd !=3D xno; then AC_DEFINE_UNQUOTED(PATH_DEV_FD, "$zsh_cv_sys_path_dev_fd") fi @@ -2260,14 +2252,9 @@ dnl ----------- dnl named FIFOs dnl ----------- dnl -dnl Named FIFOs work well enough on recent versions of Cygwin -dnl to provide what we want. Simply enable them. AC_CACHE_CHECK(if named FIFOs work, zsh_cv_sys_fifo, -[if test "$host_os" =3D cygwin; then -zsh_cv_sys_fifo=3Dyes -else -AC_RUN_IFELSE([AC_LANG_SOURCE([[ +[AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include main() @@ -2295,7 +2282,7 @@ main() exit(ret); } ]])],[zsh_cv_sys_fifo=3Dyes],[zsh_cv_sys_fifo=3Dno],[zsh_cv_sys_fifo=3Dye= s]) -fi]) +]) AH_TEMPLATE([HAVE_FIFOS], [Define to 1 if system has working FIFOs.]) if test x$zsh_cv_sys_fifo =3D xyes; then