threads / patch / 34348

patchtest-lib.sh - cygwin does not have usable FIFOs

Subject: [PATCH] test-lib.sh - cygwin does not have usable FIFOs

## tl;dr

7 messages between Jul 4, 2013 and Jul 14, 2013. Diffs are folded; open one to read it.

replies: 6people: 3as markdown or json

Mark Levedahl· Jul 4, 2013, 22:04 UTC · lore

Do not use FIFOs on cygwin, they do not work. Cygwin includes coreutils, so has mkfifo, and that command does something. However, the resultant named pipe is known (on the Cygwin mailing list at least) to not work correctly.

This disables PIPE for Cygwin, allowing t0008.sh to complete (all other tests in that file work correctly).

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
 t/test-lib.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Show changes to t/test-lib.sh +8 −1
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 9753641..2d63307 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -885,7 +885,14 @@ test_i18ngrep () {
 
 test_lazy_prereq PIPE '
 	# test whether the filesystem supports FIFOs
-	rm -f testfifo && mkfifo testfifo
+	case $(uname -s) in
+	CYGWIN*)
+		false
+		;;
+	*)
+		rm -f testfifo && mkfifo testfifo
+		;;
+	esac
 '
 
 test_lazy_prereq SYMLINKS '
-- 
1.8.3.2.0.13
Jonathan Nieder· Jul 7, 2013, 00:55 UTC · re: Mark Levedahl · lore

Re: [PATCH] test-lib.sh - cygwin does not have usable FIFOs

Mark Levedahl wrote:
> Do not use FIFOs on cygwin, they do not work. Cygwin includes
> coreutils, so has mkfifo, and that command does something. However,
> the resultant named pipe is known (on the Cygwin mailing list at
> least) to not work correctly.

Hm. How would you recommend going about writing a script that takes output from a command, transforms it, and then feeds it back into that command's input? Are sockets a more reliable way to do this kind of IPC on Cygwin?

See reinit_git and try_dump from t9010-svn-fe.sh for context.

Thanks, Jonathan

Torsten Bögershausen· Jul 7, 2013, 09:14 UTC · re: Jonathan Nieder · lore

Re: [PATCH] test-lib.sh - cygwin does not have usable FIFOs

On 2013-07-07 02.55, Jonathan Nieder wrote:
Show 16 quoted lines
> Mark Levedahl wrote:
> 
>> Do not use FIFOs on cygwin, they do not work. Cygwin includes
>> coreutils, so has mkfifo, and that command does something. However,
>> the resultant named pipe is known (on the Cygwin mailing list at
>> least) to not work correctly.
> 
> Hm.  How would you recommend going about writing a script that takes
> output from a command, transforms it, and then feeds it back into
> that command's input?  Are sockets a more reliable way to do this kind
> of IPC on Cygwin?
> 
> See reinit_git and try_dump from t9010-svn-fe.sh for context.
> 
> Thanks,
> Jonathan

t9010 needs PIPE in most test cases as a prerequisite. And if PIPE isn't available, the tests can not be run.

Are you suggesting to replace the named pipes with a TCP socket?

Disabling PIPE under cygwin seems to be the right thing to do, or do I miss something ?

/Torsten
Jonathan Nieder· Jul 14, 2013, 00:59 UTC · re: Torsten Bögershausen · lore

Re: [PATCH] test-lib.sh - cygwin does not have usable FIFOs

Torsten Bögershausen wrote:
> Disabling PIPE under cygwin seems to be the right thing to do,
> or do I miss something ?

If fifos don't work on Cygwin, disabling that test prerequisite is defintely the right thing to do. I was taking the opportunity to find out whether and how git could be tweaked to avoid needing fifos when setting pipes up in scripts.

Jonathan
Mark Levedahl· Jul 8, 2013, 22:18 UTC · re: Jonathan Nieder · lore

Re: [PATCH] test-lib.sh - cygwin does not have usable FIFOs

On 07/06/2013 08:55 PM, Jonathan Nieder wrote:
Show 16 quoted lines
> Mark Levedahl wrote:
>
>> Do not use FIFOs on cygwin, they do not work. Cygwin includes
>> coreutils, so has mkfifo, and that command does something. However,
>> the resultant named pipe is known (on the Cygwin mailing list at
>> least) to not work correctly.
> Hm.  How would you recommend going about writing a script that takes
> output from a command, transforms it, and then feeds it back into
> that command's input?  Are sockets a more reliable way to do this kind
> of IPC on Cygwin?
>
> See reinit_git and try_dump from t9010-svn-fe.sh for context.
>
> Thanks,
> Jonathan
>

On the one hand, sockets work fine on cygwin so that path would probably work.

However, I don't understand why git would need to consume its own output 
- If named pipes are really needed to use git-svn because git-svn 
depends upon git feeding the same git process, then that package should 
not be available on cygwin or any other platform that does not support 
fifos. If not, then I don't think the test suite should require fifos or 
any other construct with the same git process feeding itself either, it 
just blurs the line about what is actually being tested.
Mark
Jonathan Nieder· Jul 14, 2013, 00:57 UTC · re: Mark Levedahl · lore

Re: [PATCH] test-lib.sh - cygwin does not have usable FIFOs

Mark Levedahl wrote:
Show 5 quoted lines
> However, I don't understand why git would need to consume its own
> output - If named pipes are really needed to use git-svn because
> git-svn depends upon git feeding the same git process, then that
> package should not be available on cygwin or any other platform that
> does not support fifos.

This isn't about git-svn but about the svn remote helper. The same considerations would apply to any other foreign repository importer that uses "git fast-import --cat-blob-fd". So I would like to make sure it is at least possible to support such a thing in the Cygwin and mingw ports.

>                          If not, then I don't think the test suite
> should require fifos or any other construct with the same git
> process feeding itself either, it just blurs the line about what is
> actually being tested.

I'm not sure I follow. Are you saying Windows users would never want to access Subversion repositories?

Thanks, Jonathan

Mark Levedahl· Jul 14, 2013, 15:38 UTC · re: Jonathan Nieder · lore

Re: [PATCH] test-lib.sh - cygwin does not have usable FIFOs

On 07/13/2013 08:57 PM, Jonathan Nieder wrote:
> I'm not sure I follow. Are you saying Windows users would never want 
> to access Subversion repositories? Thanks, Jonathan 

Quite the contrary. SVN and git both work on Windows without having POSIX FIFOs - Windows does have FIFOS, but the semantics are different than POSIX and this is why Cygwin's do not work as needed. There is no problem having a subprocess with stdin and stdout redirected via anonymous pipes to the parent: this is how git runs sub commands and works fine. I'm just questioning why this same construct cannot be used for the test harness.

Mark

← back to recent threads