Right, there were such warnings with no consequences for the build.
Makes sense to drop the flag.  Buffer size is actually known at all call
sites of strcpy(), so strlcpy() could be utilized as well, but fatal
warnings by default might not be a great idea anyway.

On Mon, Aug 05, 2024 at 06:40:57PM +0200, Theo Buehler wrote:
> A recent change in ld.lld made the linker error with -Wl,--fatal-warnings
> if a gnu.warnings segment is present. This breaks the build of
> sysutils/efivar. Diff below fixes this.
> 
> cc -O2 -pipe -std=gnu11 -funsigned-char -fvisibility=hidden   -std=gnu11 
> -funsigned-char -fvisibility=hidden   -L.   -Wl,--build-id 
> -Wl,--no-undefined-version -Wl,-z,now -Wl,-z,muldefs -Wl,-z,relro 
> -Wl,--fatal-warnings     -DLIBEFIVAR_VERSION=38 -D_GNU_SOURCE 
> -I/tmp/pobj/efivar-38/efivar-bsd-v1/src/include/ -o efivar efivar.o guid.o 
> util.o -lefivar
> ld: error: efivar.c(efivar.o:(parse_name)): warning: strcpy() is almost 
> always misused, please use strlcpy()
> 
> Index: patches/patch-src_include_defaults_mk
> ===================================================================
> RCS file: /cvs/ports/sysutils/efivar/patches/patch-src_include_defaults_mk,v
> diff -u -p -r1.1.1.1 patch-src_include_defaults_mk
> --- patches/patch-src_include_defaults_mk     5 Jul 2023 14:17:47 -0000       
> 1.1.1.1
> +++ patches/patch-src_include_defaults_mk     5 Aug 2024 16:35:41 -0000
> @@ -3,7 +3,15 @@ Fix .so versioning.
>  Index: src/include/defaults.mk
>  --- src/include/defaults.mk.orig
>  +++ src/include/defaults.mk
> -@@ -65,7 +65,7 @@ SOFLAGS_CLANG =
> +@@ -56,7 +56,6 @@ override LDFLAGS = $(CFLAGS) -L. $(_LDFLAGS) $(_CCLDFL
> +                -Wl,-z,now \
> +                -Wl,-z,muldefs \
> +                -Wl,-z,relro \
> +-               -Wl,--fatal-warnings \
> +                $(call family,LDFLAGS) $(call family,CCLDFLAGS) \
> +                $(call pkg-config-ccldflags)
> + override CCLDFLAGS = $(LDFLAGS)
> +@@ -65,7 +64,7 @@ SOFLAGS_CLANG =
>   SOFLAGS ?=
>   override _SOFLAGS := $(SOFLAGS)
>   override SOFLAGS = $(_SOFLAGS) \

Reply via email to