public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* [PATCH v1 2/2] utf8.c: Enable workaround for iconv under macOS 14/15
@ 2026-01-08 17:23 tboegi
  0 siblings, 0 replies; 3+ messages in thread
From: tboegi @ 2026-01-08 17:23 UTC (permalink / raw)
  To: tboegi, git, l.s.r; +Cc: Torsten Bögershausen

From: Torsten Bögershausen <torsten.bogershausen@esss•se>

The previous commit introduced a workaround in utf8.c to deal
with broken iconv implementations.

It is enabled when
  A MacOS version is used that has a buggy iconv library and
  there is no external library provided (and linked against)
  from neither MacPorts nor Homebrew.

Signed-off-by: Torsten Bögershausen <tboegi@web•de>
---
 Makefile         | 7 +++++++
 config.mak.uname | 1 +
 2 files changed, 8 insertions(+)

diff --git a/Makefile b/Makefile
index b7eba509c6..5a3823bb67 100644
--- a/Makefile
+++ b/Makefile
@@ -1692,6 +1692,7 @@ ifeq ($(uname_S),Darwin)
                 ifeq ($(shell test -d /opt/local/lib && echo y),y)
 			BASIC_CFLAGS += -I/opt/local/include
 			BASIC_LDFLAGS += -L/opt/local/lib
+			HAS_GOOD_LIBICONV = Yes
                 endif
         endif
         ifndef NO_APPLE_COMMON_CRYPTO
@@ -1714,6 +1715,7 @@ endif
 ifdef USE_HOMEBREW_LIBICONV
 ifeq ($(shell test -d $(HOMEBREW_PREFIX)/opt/libiconv && echo y),y)
 	ICONVDIR ?= $(HOMEBREW_PREFIX)/opt/libiconv
+	HAS_GOOD_LIBICONV = Yes
 endif
 endif
 endif
@@ -1859,6 +1861,11 @@ ifndef NO_ICONV
                 endif
 		EXTLIBS += $(ICONV_LINK) -liconv
         endif
+        ifdef NEEDS_GOOD_LIBICONV
+        ifndef HAS_GOOD_LIBICONV
+                BASIC_CFLAGS += -DICONV_RESTART_RESET
+        endif
+        endif
 endif
 ifdef ICONV_OMITS_BOM
 	BASIC_CFLAGS += -DICONV_OMITS_BOM
diff --git a/config.mak.uname b/config.mak.uname
index 38b35af366..3c35ae33a3 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -157,6 +157,7 @@ ifeq ($(uname_S),Darwin)
         endif
         ifeq ($(shell test "$(DARWIN_MAJOR_VERSION)" -ge 24 && echo 1),1)
 		USE_HOMEBREW_LIBICONV = UnfortunatelyYes
+		NEEDS_GOOD_LIBICONV = UnfortunatelyYes
         endif
 
 	# The builtin FSMonitor on MacOS builds upon Simple-IPC.  Both require
-- 
2.50.0.rc0.46.g7014b55638.dirty


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

* [PATCH v1 2/2] utf8.c: Enable workaround for iconv under macOS 14/15
@ 2026-01-08 17:40 tboegi
  2026-01-09 18:01 ` René Scharfe
  0 siblings, 1 reply; 3+ messages in thread
From: tboegi @ 2026-01-08 17:40 UTC (permalink / raw)
  To: tboegi, git, l.s.r

From: Torsten Bögershausen <tboegi@web•de>

The previous commit introduced a workaround in utf8.c to deal
with broken iconv implementations.

It is enabled when
  A MacOS version is used that has a buggy iconv library and
  there is no external library provided (and linked against)
  from neither MacPorts nor Homebrew.

Signed-off-by: Torsten Bögershausen <tboegi@web•de>
---
 Makefile         | 7 +++++++
 config.mak.uname | 1 +
 2 files changed, 8 insertions(+)

diff --git a/Makefile b/Makefile
index b7eba509c6..5a3823bb67 100644
--- a/Makefile
+++ b/Makefile
@@ -1692,6 +1692,7 @@ ifeq ($(uname_S),Darwin)
                 ifeq ($(shell test -d /opt/local/lib && echo y),y)
 			BASIC_CFLAGS += -I/opt/local/include
 			BASIC_LDFLAGS += -L/opt/local/lib
+			HAS_GOOD_LIBICONV = Yes
                 endif
         endif
         ifndef NO_APPLE_COMMON_CRYPTO
@@ -1714,6 +1715,7 @@ endif
 ifdef USE_HOMEBREW_LIBICONV
 ifeq ($(shell test -d $(HOMEBREW_PREFIX)/opt/libiconv && echo y),y)
 	ICONVDIR ?= $(HOMEBREW_PREFIX)/opt/libiconv
+	HAS_GOOD_LIBICONV = Yes
 endif
 endif
 endif
@@ -1859,6 +1861,11 @@ ifndef NO_ICONV
                 endif
 		EXTLIBS += $(ICONV_LINK) -liconv
         endif
+        ifdef NEEDS_GOOD_LIBICONV
+        ifndef HAS_GOOD_LIBICONV
+                BASIC_CFLAGS += -DICONV_RESTART_RESET
+        endif
+        endif
 endif
 ifdef ICONV_OMITS_BOM
 	BASIC_CFLAGS += -DICONV_OMITS_BOM
diff --git a/config.mak.uname b/config.mak.uname
index 38b35af366..3c35ae33a3 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -157,6 +157,7 @@ ifeq ($(uname_S),Darwin)
         endif
         ifeq ($(shell test "$(DARWIN_MAJOR_VERSION)" -ge 24 && echo 1),1)
 		USE_HOMEBREW_LIBICONV = UnfortunatelyYes
+		NEEDS_GOOD_LIBICONV = UnfortunatelyYes
         endif
 
 	# The builtin FSMonitor on MacOS builds upon Simple-IPC.  Both require
-- 
2.50.0.rc0.46.g7014b55638.dirty


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

* Re: [PATCH v1 2/2] utf8.c: Enable workaround for iconv under macOS 14/15
  2026-01-08 17:40 [PATCH v1 2/2] utf8.c: Enable workaround for iconv under macOS 14/15 tboegi
@ 2026-01-09 18:01 ` René Scharfe
  0 siblings, 0 replies; 3+ messages in thread
From: René Scharfe @ 2026-01-09 18:01 UTC (permalink / raw)
  To: tboegi, git

On 1/8/26 6:40 PM, tboegi@web•de wrote:
> From: Torsten Bögershausen <tboegi@web•de>
> 
> The previous commit introduced a workaround in utf8.c to deal
> with broken iconv implementations.
> 
> It is enabled when
>   A MacOS version is used that has a buggy iconv library and
>   there is no external library provided (and linked against)
>   from neither MacPorts nor Homebrew.

Odd style.  Make "A" lowercase, remove the line break after "when" and
unindent?

> Signed-off-by: Torsten Bögershausen <tboegi@web•de>
> ---
>  Makefile         | 7 +++++++
>  config.mak.uname | 1 +
>  2 files changed, 8 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index b7eba509c6..5a3823bb67 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1692,6 +1692,7 @@ ifeq ($(uname_S),Darwin)
>                  ifeq ($(shell test -d /opt/local/lib && echo y),y)
>  			BASIC_CFLAGS += -I/opt/local/include
>  			BASIC_LDFLAGS += -L/opt/local/lib
> +			HAS_GOOD_LIBICONV = Yes

This doesn't check whether libiconv was actually installed via MacPorts,
so technically that's more of a "Maybe?", no?

>                  endif
>          endif
>          ifndef NO_APPLE_COMMON_CRYPTO
> @@ -1714,6 +1715,7 @@ endif
>  ifdef USE_HOMEBREW_LIBICONV
>  ifeq ($(shell test -d $(HOMEBREW_PREFIX)/opt/libiconv && echo y),y)
>  	ICONVDIR ?= $(HOMEBREW_PREFIX)/opt/libiconv
> +	HAS_GOOD_LIBICONV = Yes

Looks good.

>  endif
>  endif
>  endif
> @@ -1859,6 +1861,11 @@ ifndef NO_ICONV
>                  endif
>  		EXTLIBS += $(ICONV_LINK) -liconv
>          endif
> +        ifdef NEEDS_GOOD_LIBICONV
> +        ifndef HAS_GOOD_LIBICONV

"GOOD" is quite vague.  There's already ICONV_OMITS_BOM, and I wouldn't
be surprised if we discover the need for some other workarounds soon.
How about naming the make variables after the C macro to be more clear
and specific?

Can we get away with a single make variable?  Set it in config.mak.uname
on affected systems and set it to empty if we detect that a 3rd party
libiconv is used?

> +                BASIC_CFLAGS += -DICONV_RESTART_RESET
> +        endif
> +        endif
>  endif
>  ifdef ICONV_OMITS_BOM
>  	BASIC_CFLAGS += -DICONV_OMITS_BOM
> diff --git a/config.mak.uname b/config.mak.uname
> index 38b35af366..3c35ae33a3 100644
> --- a/config.mak.uname
> +++ b/config.mak.uname
> @@ -157,6 +157,7 @@ ifeq ($(uname_S),Darwin)
>          endif
>          ifeq ($(shell test "$(DARWIN_MAJOR_VERSION)" -ge 24 && echo 1),1)
>  		USE_HOMEBREW_LIBICONV = UnfortunatelyYes
> +		NEEDS_GOOD_LIBICONV = UnfortunatelyYes
>          endif
>  
>  	# The builtin FSMonitor on MacOS builds upon Simple-IPC.  Both require


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

end of thread, other threads:[~2026-01-09 18:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-08 17:40 [PATCH v1 2/2] utf8.c: Enable workaround for iconv under macOS 14/15 tboegi
2026-01-09 18:01 ` René Scharfe
  -- strict thread matches above, loose matches on Subject: below --
2026-01-08 17:23 tboegi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox