Bug#1067651: mapserver fails to build on armhf in Ubuntu due to implicit declaration of strlcpy

2024-05-08 Thread Santiago Vila

severity 1067651 serious
retitle 1067651 mapserver: FTBFS: error: implicit declaration of function 
‘strlcpy’
thanks

El 25/3/24 a las 9:25, Vladimir Petko escribió:

  strlcpy and strlcat were introduced in glibc 2.38[1]. At the moment
Ubuntu noble has 2.39  and Debian unstable  - 2.37.
  The issue will become relevant for Debian once glibc 2.38 is
introduced to unstable.


Indeed. Right now we have 2.38-7 in testing and 2.38-8 in unstable,
so this is now happening in Debian. I'm adjusting the metadata
(now RC, no longer just Ubuntu, and no longer just armhf).

Thanks.



Bug#1067651: mapserver fails to build on armhf in Ubuntu due to implicit declaration of strlcpy

2024-03-25 Thread Sebastiaan Couwenberg

Control: tags -1 pending

On 3/25/24 10:20 AM, Vladimir Petko wrote:

I've made a small change to the patch: used -D_DEFAULT_SOURCE[1] to
avoid the deprecation warning. I have tested noble and sid build with
the attached patch.


Thanks for you patch improvements. I've managed to test my original 
patch and yours with glibc 2.38 from Debian experimental. I'll forward 
it upstream and include it in the next upload.


Kind Regards,

Bas

--
 GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1



Bug#1067651: mapserver fails to build on armhf in Ubuntu due to implicit declaration of strlcpy

2024-03-25 Thread Vladimir Petko
Hi,

Thank you!!!

I've made a small change to the patch: used -D_DEFAULT_SOURCE[1] to
avoid the deprecation warning. I have tested noble and sid build with
the attached patch.

Best Regards,
 Vladimir.
[1] https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html

On Mon, Mar 25, 2024 at 9:57 PM Sebastiaan Couwenberg
 wrote:
>
> On 3/25/24 9:25 AM, Vladimir Petko wrote:
> >   strlcpy and strlcat were introduced in glibc 2.38[1]. At the moment
> > Ubuntu noble has 2.39  and Debian unstable  - 2.37.
>
> Can you try the attached patch which patches CMakeLists.txt to add the
> definition when strlcat/strlcpy are found on Linux?
>
> Kind Regards,
>
> Bas
>
> --
>   GPG Key ID: 4096R/6750F10AE88D4AF1
> Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1
Description: Add -D_BSD_SOURCE for strlcat/strlcpy privided by glibc >= 2.38.
Author: Bas Couwenberg 
Bug-Debian: https://bugs.debian.org/1067651

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -121,6 +121,10 @@ check_function_exists("strlcpy"  HAVE_ST
 check_function_exists("strlen"  HAVE_STRLEN)
 check_function_exists("strncasecmp"  HAVE_STRNCASECMP)

+IF((HAVE_STRLCAT OR HAVE_STRLCPY) AND CMAKE_SYSTEM_NAME MATCHES "Linux")
+add_definitions(-D_DEFAULT_SOURCE)
+ENDIF()
+
 check_symbol_exists(vsnprintf stdio.h HAVE_VSNPRINTF)
 IF(NOT HAVE_VSNPRINTF)
 check_function_exists("vsnprintf"  HAVE_VSNPRINTF)


Bug#1067651: mapserver fails to build on armhf in Ubuntu due to implicit declaration of strlcpy

2024-03-25 Thread Sebastiaan Couwenberg

On 3/25/24 9:25 AM, Vladimir Petko wrote:

  strlcpy and strlcat were introduced in glibc 2.38[1]. At the moment
Ubuntu noble has 2.39  and Debian unstable  - 2.37.


Can you try the attached patch which patches CMakeLists.txt to add the 
definition when strlcat/strlcpy are found on Linux?


Kind Regards,

Bas

--
 GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1
Description: Add -D_BSD_SOURCE for strlcat/strlcpy privided by glibc >= 2.38.
Author: Bas Couwenberg 
Bug-Debian: https://bugs.debian.org/1067651

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -121,6 +121,10 @@ check_function_exists("strlcpy"  HAVE_ST
 check_function_exists("strlen"  HAVE_STRLEN)
 check_function_exists("strncasecmp"  HAVE_STRNCASECMP)
 
+IF((HAVE_STRLCAT OR HAVE_STRLCPY) AND CMAKE_SYSTEM_NAME MATCHES "Linux")
+add_definition(-D_BSD_SOURCE)
+ENDIF
+
 check_symbol_exists(vsnprintf stdio.h HAVE_VSNPRINTF)
 IF(NOT HAVE_VSNPRINTF)
 check_function_exists("vsnprintf"  HAVE_VSNPRINTF)


Bug#1067651: mapserver fails to build on armhf in Ubuntu due to implicit declaration of strlcpy

2024-03-25 Thread Vladimir Petko
Hi,

 strlcpy and strlcat were introduced in glibc 2.38[1]. At the moment
Ubuntu noble has 2.39  and Debian unstable  - 2.37.
 The issue will become relevant for Debian once glibc 2.38 is
introduced to unstable.

Best Regards,
 Vladimir.

[1] https://sourceware.org/pipermail/libc-alpha/2023-July/150524.html



Bug#1067651: mapserver fails to build on armhf in Ubuntu due to implicit declaration of strlcpy

2024-03-25 Thread Sebastiaan Couwenberg

On 3/25/24 6:31 AM, Vladimir Petko wrote:

The CMake checks if the function is present in the runtime library
(whether strlcpy() compiles), but the declaration in string.h itself
is guarded by __USE_MISC define.
On armhf in Ubuntu toolchain has -Werror=implicit-function-declaration
flag that causes the build failure.
We use -Werror=implicit-function-declaration in Debian unstable too, 
where it doesn't FTBFS because it doesn't find the functions:


 -- Looking for strlcat
 -- Looking for strlcat - not found
 -- Looking for strlcpy
 -- Looking for strlcpy - not found

Kind Regards,

Bas

--
 GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1



Bug#1067651: mapserver fails to build on armhf in Ubuntu due to implicit declaration of strlcpy

2024-03-24 Thread Vladimir Petko
Hi,

The CMake checks if the function is present in the runtime library
(whether strlcpy() compiles), but the declaration in string.h itself
is guarded by __USE_MISC define.
On armhf in Ubuntu toolchain has -Werror=implicit-function-declaration
flag that causes the build failure.

Best Regards,
 Vladimir.

On Mon, 25 Mar 2024 at 18:27, Sebastiaan Couwenberg  wrote:
>
> Control: tags -1 upstream moreinfo
>
> On 3/25/24 3:39 AM, Vladimir Petko wrote:
> > In Ubuntu, the attached patch was applied to achieve the following:
> >* d/rules: define -D_BSD_SOURCE to ensure that strlcpy/strlcat functions
> >  are declared (LP: #2058864).
>
> That seems wrong.
>
> CMakeLists.txt checks for the existence of the function and uses its own
> implementation from mapstring.cpp if not found:
>
>   check_function_exists("strlcat"  HAVE_STRLCAT)
>   check_function_exists("strlcpy"  HAVE_STRLCPY)
>
> The functions are detected as shown in the buildlog:
>
>   -- Looking for strlcat
>   -- Looking for strlcat - found
>   -- Looking for strlcpy
>   -- Looking for strlcpy - found
>
> Why does this only happen on armhf?
>
> Kind Regards,
>
> Bas
>
> --
>   GPG Key ID: 4096R/6750F10AE88D4AF1
> Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1
>



Bug#1067651: mapserver fails to build on armhf in Ubuntu due to implicit declaration of strlcpy

2024-03-24 Thread Sebastiaan Couwenberg

Control: tags -1 upstream moreinfo

On 3/25/24 3:39 AM, Vladimir Petko wrote:

In Ubuntu, the attached patch was applied to achieve the following:
   * d/rules: define -D_BSD_SOURCE to ensure that strlcpy/strlcat functions
 are declared (LP: #2058864).


That seems wrong.

CMakeLists.txt checks for the existence of the function and uses its own 
implementation from mapstring.cpp if not found:


 check_function_exists("strlcat"  HAVE_STRLCAT)
 check_function_exists("strlcpy"  HAVE_STRLCPY)

The functions are detected as shown in the buildlog:

 -- Looking for strlcat
 -- Looking for strlcat - found
 -- Looking for strlcpy
 -- Looking for strlcpy - found

Why does this only happen on armhf?

Kind Regards,

Bas

--
 GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1



Bug#1067651: mapserver fails to build on armhf in Ubuntu due to implicit declaration of strlcpy

2024-03-24 Thread Vladimir Petko
Package: mapserver
Severity: wishlist
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu noble ubuntu-patch

Dear Maintainer,

The package failed to build in Ubuntu noble on armhf:
--
/<>/mapshape.c: In function ‘msShapefileOpenHandle’:
/<>/mapshape.c:1755:3: error: implicit declaration of function
‘strlcpy’; did you mean ‘strncpy’? [-Werror=implicit-function-declaration]
 1755 | strlcpy(shpfile->source, filename, sizeof(shpfile->source));
  | ^~~
  | strncpy
/<>/mapshape.c: In function ‘msShapefileOpen’:
/<>/mapshape.c:1841:3: error: implicit declaration of function
‘strlcat’; did you mean ‘strncat’? [-Werror=implicit-function-declaration]
 1841 | strlcat(dbfFilename, ".dbf", bufferSize);
  | ^~~
  | strncat
--
See the build log[1]

strlcpy/strlcat function prototype is enabled in string.h when __USE_MISC macro
is defined.
strlcpy/strlcat functions belong to a set of functions declared on BSD
systems[2]


In Ubuntu, the attached patch was applied to achieve the following:
  * d/rules: define -D_BSD_SOURCE to ensure that strlcpy/strlcat functions
are declared (LP: #2058864).


Thanks for considering the patch.

[1] https://launchpadlibrarian.net/720858988/buildlog_ubuntu-noble-
armhf.mapserver_8.0.1-4build3_BUILDING.txt.gz
[2] https://linux.die.net/man/3/strlcat


-- System Information:
Debian Release: trixie/sid
  APT prefers mantic-updates
  APT policy: (500, 'mantic-updates'), (500, 'mantic-security'), (500, 
'mantic'), (100, 'mantic-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.5.0-25-generic (SMP w/32 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru mapserver-8.0.1/debian/rules mapserver-8.0.1/debian/rules
--- mapserver-8.0.1/debian/rules2024-03-16 20:08:52.0 +1300
+++ mapserver-8.0.1/debian/rules2024-03-25 15:19:52.0 +1300
@@ -17,7 +17,7 @@
 
 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 
-CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
+CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) -D_BSD_SOURCE
 CFLAGS   := $(shell dpkg-buildflags --get CFLAGS)
 LDFLAGS  := $(shell dpkg-buildflags --get LDFLAGS)