git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Makefile: Use libc strlcpy on OSX >= 10.2
@ 2009-01-24 19:01 Benjamin Kramer
  2009-01-24 19:42 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Kramer @ 2009-01-24 19:01 UTC (permalink / raw)
  To: gitster; +Cc: git

OSX supports strlcpy(3) since 10.2 so we don't need
to use our own. This revised also patch checks the darwin
version. 10.0 is darwin v1.3; 10.1 is darwin v1.4.

Signed-off-by: Benjamin Kramer <benny.kra@gmail.com>
---
 Makefile |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index b4d9cb4..7dd5224 100644
--- a/Makefile
+++ b/Makefile
@@ -643,7 +643,9 @@ ifeq ($(uname_S),Darwin)
 	ifneq ($(shell expr "$(uname_R)" : '9\.'),2)
 		OLD_ICONV = UnfortunatelyYes
 	endif
-	NO_STRLCPY = YesPlease
+	ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
+		NO_STRLCPY = YesPlease
+	endif
 	NO_MEMMEM = YesPlease
 	THREADED_DELTA_SEARCH = YesPlease
 endif
-- 
1.6.1.285.g3454

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Makefile: Use libc strlcpy on OSX >= 10.2
  2009-01-24 19:01 [PATCH v2] Makefile: Use libc strlcpy on OSX >= 10.2 Benjamin Kramer
@ 2009-01-24 19:42 ` Junio C Hamano
  2009-01-24 20:23   ` Benjamin Kramer
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2009-01-24 19:42 UTC (permalink / raw)
  To: Benjamin Kramer; +Cc: git

Benjamin Kramer <benny.kra@googlemail.com> writes:

> OSX supports strlcpy(3) since 10.2 so we don't need
> to use our own. This revised also patch checks the darwin
> version. 10.0 is darwin v1.3; 10.1 is darwin v1.4.

What does the output from "uname -r" and "uname -s" look like on your box
(and older OSX boxes)?

> @@ -643,7 +643,9 @@ ifeq ($(uname_S),Darwin)
>  	ifneq ($(shell expr "$(uname_R)" : '9\.'),2)
>  		OLD_ICONV = UnfortunatelyYes
>  	endif

This existing one says "If 'uname -r' output does not begin with two
characters '9.' (nine and dot), then set OLD_ICONV".

> -	NO_STRLCPY = YesPlease
> +	ifeq ($(shell expr "$(uname_R)" : '1\.'),2)

And this new one says "If 'uname -r' output begins with two characters
'1.' (one and dot), then set NO_STRLCPY".

> +		NO_STRLCPY = YesPlease
> +	endif

I am guessing that 'uname -r' says 9.X in "Darwin 9.X" (which is OSX
10.5), and existing conditional says that versions before 9.X needs
OLD_ICONV but later ones do not need it.

Does 1.X stand for OSX 10.2?  A quick googling finds a handful pages that
say that OSX 10.2 = Darwin 6.x and OSX 10.3 = Darwin 7.x, and I am not
sure where you are getting that "begins with one-and-dot" from....

>  	NO_MEMMEM = YesPlease
>  	THREADED_DELTA_SEARCH = YesPlease
>  endif
> -- 
> 1.6.1.285.g3454

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] Makefile: Use libc strlcpy on OSX >= 10.2
  2009-01-24 19:42 ` Junio C Hamano
@ 2009-01-24 20:23   ` Benjamin Kramer
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Kramer @ 2009-01-24 20:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Sat, Jan 24, 2009 at 20:42, Junio C Hamano <gitster@pobox.com> wrote:
>
> This existing one says "If 'uname -r' output does not begin with two
> characters '9.' (nine and dot), then set OLD_ICONV".
>
> I am guessing that 'uname -r' says 9.X in "Darwin 9.X" (which is OSX
> 10.5), and existing conditional says that versions before 9.X needs
> OLD_ICONV but later ones do not need it.

Yeah, that's because versions before 10.5 aka darwin 9 aka "Leopard" have a
broken iconv implementation.

> Does 1.X stand for OSX 10.2?  A quick googling finds a handful pages that
> say that OSX 10.2 = Darwin 6.x and OSX 10.3 = Darwin 7.x, and I am not
> sure where you are getting that "begins with one-and-dot" from....

I've got my information from [1]. It says:

darwin 1.3 => OSX 10.0
darwin 1.4 => OSX 10.1
darwin 6 => OSX 10.2
darwin 7 => OSX 10.3
etc.

I don't know why they chose this weird versioning scheme, but wait, it gets
even crazier

darwin 1.4.1 => OSX 10.1
darwin 5.1 => OSX 10.1.1

So my patch checks only for 10.1 but not for 10.1.1 *sigh*

-     NO_STRLCPY = YesPlease
+     ifeq ($(shell expr "$(uname_R)" : '[015]\.'),2)
+             NO_STRLCPY = YesPlease
+     endif

Should get all darwin versions before 6.0 in which strlcpy(3) was
introduced. Thanks for your patience ;)

---------------
[1] http://www.opensource.apple.com/darwinsource/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-24 20:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-24 19:01 [PATCH v2] Makefile: Use libc strlcpy on OSX >= 10.2 Benjamin Kramer
2009-01-24 19:42 ` Junio C Hamano
2009-01-24 20:23   ` Benjamin Kramer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).