threads / patch / 23293

patchMakefile: update defaults for modern Cygwin

Subject: [PATCH] Makefile: update defaults for modern Cygwin

## tl;dr

11 messages between Apr 1, 2010 and Apr 5, 2010. Diffs are folded; open one to read it.

replies: 10people: 4as markdown or json

Eric Blake· Apr 1, 2010, 22:43 UTC · lore

Now that Cygwin 1.7.x has enabled lots of new features, and Cygwin 1.5 is no longer actively supported by the Cygwin mailing lists, we might as well update the defaults to cater to those new features.

NO_TRUSTABLE_FILEMODE is only necessary on FAT drives; the Cygwin community recommends NTFS drives, but there is still too much use for FAT to switch the default. Likewise, UNRELIABLE_FSTAT is probably file-system specific, but worth keeping unchanged.

This commit does not change the default for NO_MMAP, although definitive proof of whether this option is necessary is lacking.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 Makefile |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)
Show changes to Makefile +12 −10
diff --git a/Makefile b/Makefile
index 3e816e1..442ce0b 100644
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@ all::
 # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
 #
 # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
-# d_type in struct dirent (latest Cygwin -- will be fixed soonish).
+# d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
 #
 # Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
 # do not support the 'size specifiers' introduced by C99, namely ll, hh,
@@ -109,7 +109,7 @@ all::
 # Define NO_PTHREADS if you do not have or do not want to use Pthreads.
 #
 # Define NO_PREAD if you have a problem with pread() system call (e.g.
-# cygwin.dll before v1.5.22).
+# cygwin1.dll before v1.5.22).
 #
 # Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
 # generally faster on your platform than accessing the working directory.
@@ -831,22 +831,24 @@ ifeq ($(uname_S),SunOS)
 	BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
 endif
 ifeq ($(uname_O),Cygwin)
-	NO_D_TYPE_IN_DIRENT = YesPlease
-	NO_D_INO_IN_DIRENT = YesPlease
-	NO_STRCASESTR = YesPlease
-	NO_MEMMEM = YesPlease
-	NO_MKSTEMPS = YesPlease
-	NO_SYMLINK_HEAD = YesPlease
+	ifneq ($(wordlist 1, 2, $(subst ., ,$(uname_R))),1 7)
+		NO_D_TYPE_IN_DIRENT = YesPlease
+		NO_D_INO_IN_DIRENT = YesPlease
+		NO_STRCASESTR = YesPlease
+		NO_MEMMEM = YesPlease
+		NO_MKSTEMPS = YesPlease
+		NO_SYMLINK_HEAD = YesPlease
+		NO_IPV6 = YesPlease
+		OLD_ICONV = UnfortunatelyYes
+	endif
 	NEEDS_LIBICONV = YesPlease
 	NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
 	NO_TRUSTABLE_FILEMODE = UnfortunatelyYes
-	OLD_ICONV = UnfortunatelyYes
 	NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
 	# There are conflicting reports about this.
 	# On some boxes NO_MMAP is needed, and not so elsewhere.
 	# Try commenting this out if you suspect MMAP is more efficient
 	NO_MMAP = YesPlease
-	NO_IPV6 = YesPlease
 	X = .exe
 	COMPAT_OBJS += compat/cygwin.o
 	UNRELIABLE_FSTAT = UnfortunatelyYes
-- 
1.6.6.1
Junio C Hamano· Apr 2, 2010, 06:47 UTC · re: Eric Blake · lore

Re: [PATCH] Makefile: update defaults for modern Cygwin

Eric Blake <eblake@redhat.com> writes:
Show 13 quoted lines
> Now that Cygwin 1.7.x has enabled lots of new features, and Cygwin 1.5
> is no longer actively supported by the Cygwin mailing lists, we might
> as well update the defaults to cater to those new features.
>
> NO_TRUSTABLE_FILEMODE is only necessary on FAT drives; the Cygwin
> community recommends NTFS drives, but there is still too much use
> for FAT to switch the default.  Likewise, UNRELIABLE_FSTAT is probably
> file-system specific, but worth keeping unchanged.
>
> This commit does not change the default for NO_MMAP, although definitive
> proof of whether this option is necessary is lacking.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>

Thanks; as I lack Cygwin environment to test this myself, I'll apply this directly on 'master' and see if anybody screams ;-)

> +	ifneq ($(wordlist 1, 2, $(subst ., ,$(uname_R))),1 7)

Do we need to update this part when Cygwin 1.8 is released? Replacing this with "ifeq(... ,1 5)" may not be an improvement either, unless we are sure that nobody is using 1.4 or older, but I wonder if somebody else have better ideas?

Eric Blake· Apr 2, 2010, 14:03 UTC · re: Junio C Hamano · lore

Re: [PATCH] Makefile: update defaults for modern Cygwin

On 04/02/2010 12:47 AM, Junio C Hamano wrote:
> Thanks; as I lack Cygwin environment to test this myself, I'll apply this
> directly on 'master' and see if anybody screams ;-)
Thanks.
> 
>> +	ifneq ($(wordlist 1, 2, $(subst ., ,$(uname_R))),1 7)
> 
> Do we need to update this part when Cygwin 1.8 is released?

Odd numbers are public cygwin releases (1.5, 1.7), even numbers are Red Hat releases (1.6, 1.8), so cygwin 1.8 already does exist for Red Hat licensed customers. It will probably be years before cygwin 1.9/1.10 exists, at which point 1.5/1.6 will be such a distant memory that we could just delete this block altogether at that time.

>  Replacing
> this with "ifeq(... ,1 5)" may not be an improvement either, unless we are
> sure that nobody is using 1.4 or older, but I wonder if somebody else have
> better ideas?

Nothing short of using $(shell) and doing some actual computation on the string in $(uname_R). But that's not too hard, if people think it's worth it; speak up if you want me to rework it along those lines, otherwise I'll assume that things are good enough as-is.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Jonathan Nieder· Apr 3, 2010, 07:47 UTC · re: Eric Blake · lore

Re: [PATCH] Makefile: update defaults for modern Cygwin

Eric Blake wrote:
> On 04/02/2010 12:47 AM, Junio C Hamano wrote:
Show 9 quoted lines
>> Replacing
>> this with "ifeq(... ,1 5)" may not be an improvement either, unless we are
>> sure that nobody is using 1.4 or older, but I wonder if somebody else have
>> better ideas?
>
> Nothing short of using $(shell) and doing some actual computation on the
> string in $(uname_R).  But that's not too hard, if people think it's
> worth it; speak up if you want me to rework it along those lines,
> otherwise I'll assume that things are good enough as-is.

Red Hat internal people might want to be able to use 1.8 when it comes out. Maybe something like this would do the trick? I don’t know whether Cygwin 1.6 has the fixes 1.7 does, so in my ignorance I lumped it with 1.5.

What you sent is probably good enough already; just trying to avoid future work.

-- %< --
Subject: Makefile: future-proof Cygwin version check

Tweak the condition that detects old Cygwin versions to not include versions such as 1.8, 1.11, and 2.1.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Show changes to Makefile +1 −1
diff --git a/Makefile b/Makefile
index 11ec3e2..a712430 100644
--- a/Makefile
+++ b/Makefile
@@ -831,7 +831,7 @@ ifeq ($(uname_S),SunOS)
 	BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
 endif
 ifeq ($(uname_O),Cygwin)
-	ifneq ($(wordlist 1, 2, $(subst ., ,$(uname_R))),1 7)
+	ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
 		NO_D_TYPE_IN_DIRENT = YesPlease
 		NO_D_INO_IN_DIRENT = YesPlease
 		NO_STRCASESTR = YesPlease
Jonathan Nieder· Apr 3, 2010, 19:52 UTC · re: Junio C Hamano · lore

[PATCH] Teach mailinfo %< as an alternative scissors mark

Handle perforations found “in the wild” more robustly by recognizing “%<” as an alternative scissors mark.

This feature is only meant to support old habits. Discourage new use of the percent-based version by only documenting the 8< symbol so new users’ perforations can still be recognized by old versions of Git.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Junio C Hamano wrote:
> Thanks, will queue.  By the way, please spell scissors as 8< or >8 not
> with a per-cent at least for now.
Thanks for pointing it out.  I will from now on.

Searching for “cut here” on groups.google.com revealed several examples like this one:

 ______________________%<__cut here ______________>%_____________
[ed: dashes converted to underscores to avoid confusing am]

So I guess I’m the only one using the small-fingered scissors. Maybe this patch could help support old habits.

 builtin/mailinfo.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Show changes to builtin/mailinfo.c +2 −1
diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c
index ce2ef6b..4a9729b 100644
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
@@ -746,7 +746,8 @@ static int is_scissors_line(const struct strbuf *line)
 			continue;
 		}
 		if (i + 1 < len &&
-		    (!memcmp(buf + i, ">8", 2) || !memcmp(buf + i, "8<", 2))) {
+		    (!memcmp(buf + i, ">8", 2) || !memcmp(buf + i, "8<", 2) ||
+		     !memcmp(buf + i, ">%", 2) || !memcmp(buf + i, "%<", 2))) {
 			in_perforation = 1;
 			perforation += 2;
 			scissors += 2;
-- 
1.7.0.3
Eric Blake· Apr 5, 2010, 13:14 UTC · re: Jonathan Nieder · lore

Re: [PATCH] Makefile: update defaults for modern Cygwin

On 04/03/2010 01:47 AM, Jonathan Nieder wrote:
> Red Hat internal people might want to be able to use 1.8 when it comes
> out.  Maybe something like this would do the trick?  I don’t know whether
> Cygwin 1.6 has the fixes 1.7 does, so in my ignorance I lumped it with
> 1.5.

Cygwin 1.6 is on par with 1.5 feature-wise, so your cutoff of 1.6 as the last old version is correct.

Show 6 quoted lines
> @@ -831,7 +831,7 @@ ifeq ($(uname_S),SunOS)
>  	BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
>  endif
>  ifeq ($(uname_O),Cygwin)
> -	ifneq ($(wordlist 1, 2, $(subst ., ,$(uname_R))),1 7)
> +	ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)

It would be nice to use fewer processes, since forking is so expensive on cygwin:

ifeq ($(shell case '$(uname_R)' in 1.[1-6].*) echo old;; esac),old)

But does that work to have unbalanced ) in a makefile $(shell)? On the other hand, this is already in a chunk guarded by $(uname_S) being cygwin, and we know that cygwin shells understand:

ifeq ($(shell case '$(uname_R)' in (1.[1-6].*) echo old;; esac),old)
even though it is not portable to other shells, like Solaris /bin/sh.
-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Jonathan Nieder· Apr 5, 2010, 14:30 UTC · re: Eric Blake · lore

Re: [PATCH] Makefile: update defaults for modern Cygwin

Eric Blake wrote:
> Cygwin 1.6 is on par with 1.5 feature-wise, so your cutoff of 1.6 as the
> last old version is correct.
Thanks for explaining.
> ifeq ($(shell case '$(uname_R)' in (1.[1-6].*) echo old;; esac),old)
Looks good to me.

While I have your attention, do you know of a simple way to test Cygwin programs under Linux? setup.exe does not work well under wine, so I am asking mostly in the hope that there is a .tar.gz or .zip binary distribution somewhere I could play with.

Thanks, Jonathan

Eric Blake· Apr 5, 2010, 14:44 UTC · re: Jonathan Nieder · lore

Re: [PATCH] Makefile: update defaults for modern Cygwin

On 04/05/2010 08:30 AM, Jonathan Nieder wrote:
Show 10 quoted lines
> Eric Blake wrote:
> 
>> Cygwin 1.6 is on par with 1.5 feature-wise, so your cutoff of 1.6 as the
>> last old version is correct.
> 
> Thanks for explaining.
> 
>> ifeq ($(shell case '$(uname_R)' in (1.[1-6].*) echo old;; esac),old)
> 
> Looks good to me.

Junio mentioned he had already queued your first version of the patch; are you going to re-submit it with this tweak?

Show 5 quoted lines
> 
> While I have your attention, do you know of a simple way to test
> Cygwin programs under Linux?  setup.exe does not work well under wine,
> so I am asking mostly in the hope that there is a .tar.gz or .zip
> binary distribution somewhere I could play with.

Sadly, the fact that wine is not yet able to run setup.exe is evidence that wine is still lacking some emulation abilities, and while I am aware that the situation is trying to be improved, I am not actively participating in that effort. For now, I am only aware of the ability to run cygwin on native windows boxes (including virtual machines). In fact, I'm currently using a 240-day evaluation license of Windows Sever 2008 inside a VM to experiment with cygwin on my Linux box, without having spent any extra money.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Jonathan Nieder· Apr 5, 2010, 15:11 UTC · re: Eric Blake · lore

[PATCH] Makefile: avoid a fork in Cygwin version check

From: Eric Blake <eblake@redhat.com>

It is nice to use fewer processes, since forking is so expensive on cygwin. So use a case statement instead of expr.

But does that work to have unbalanced ) in a makefile $(shell)? On the other hand, this is already in a chunk guarded by $(uname_S) being cygwin, and we know that cygwin shells understand:

	case '$(uname_R)' in (1.[1-6].*) echo old;; esac
even though it is not portable to other shells, like NetBSD ash.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Eric Blake wrote:
>> Eric Blake wrote:
>>> ifeq ($(shell case '$(uname_R)' in (1.[1-6].*) echo old;; esac),old)
[...]
> Junio mentioned he had already queued your first version of the patch;
> are you going to re-submit it with this tweak?

Since the patch to future-proof the version check has already hit master, here’s the change as an independent patch against master.

 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to Makefile +1 −1
diff --git a/Makefile b/Makefile
index e210a42..767fb66 100644
--- a/Makefile
+++ b/Makefile
@@ -831,7 +831,7 @@ ifeq ($(uname_S),SunOS)
 	BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
 endif
 ifeq ($(uname_O),Cygwin)
-	ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
+	ifeq ($(shell case '$(uname_R)' in (1.[1-6].*) echo old;; esac),old)
 		NO_D_TYPE_IN_DIRENT = YesPlease
 		NO_D_INO_IN_DIRENT = YesPlease
 		NO_STRCASESTR = YesPlease
-- 
1.7.0.3
Andreas Schwab· Apr 5, 2010, 15:36 UTC · re: Jonathan Nieder · lore

Re: [PATCH] Makefile: avoid a fork in Cygwin version check

Jonathan Nieder <jrnieder@gmail.com> writes:
Show 10 quoted lines
> diff --git a/Makefile b/Makefile
> index e210a42..767fb66 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -831,7 +831,7 @@ ifeq ($(uname_S),SunOS)
>  	BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
>  endif
>  ifeq ($(uname_O),Cygwin)
> -	ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
> +	ifeq ($(shell case '$(uname_R)' in (1.[1-6].*) echo old;; esac),old)
Even less forks:
        ifneq ($(filter 1.1.% 1.2.% 1.3.% 1.4.% 1.5.% 1.6.%,$(uname_R)),)
Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

← back to recent threads