Hello, I found that Cygwin distributes a modified version of gzip that fixes a binary mode issue reproduced with the attached script.
http://mirrors.kernel.org/sourceware/cygwin/release/gzip/ I could not find a version-controlled repository with this patch. The one at Sourceforge does not have it, http://cygwin-ports.svn.sourceforge.net/viewvc/cygwin-ports/ports/branches/cygwin-1.5/archive/gzip/ http://cygwin-ports.svn.sourceforge.net/viewvc/cygwin-ports/ports/trunk/archive/gzip/ Cheers.
diff -ur gzip-1.3.12/tailor.h /usr/src/gzip-1.3.12-2/tailor.h
--- gzip-1.3.12/tailor.h 2009-11-10 19:21:45.942127500 -0500
+++ /usr/src/gzip-1.3.12-2/tailor.h 2007-07-23 17:12:59.001000000 -0400
@@ -256,6 +256,9 @@
# define OS_CODE 0x0a
#endif
+#ifdef __CYGWIN__
+# define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
+#endif
/* Common defaults */
text-mode.sh
Description: Bourne shell script
