View Issue Details

IDProjectCategoryView StatusLast Update
0000413fileGeneralpublic2022-12-28 17:48
Reportergrobian Assigned Tochristos  
PrioritynormalSeverityblockReproducibilityalways
Status resolvedResolutionfixed 
Platformx86_64OSOpenIndianaOS Version2021.10
Product Version5.44 
Fixed in Version5.45 
Summary0000413: softmagic.c fails to compile due to undefined UINT_MAX
Descriptionlibtool: compile: x86_64-pc-solaris2.11-gcc -DHAVE_CONFIG_H -I. -I/gentoo/prefix64/var/tmp/portage/sys-apps/file-5.44/work/file-5.44/src -I.. -DMAGIC=\"/gentoo/prefix64/usr/share/misc/magic\" -fvisibility=hidden -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wsign-compare -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2 -O2 -pipe -c /gentoo/prefix64/var/tmp/portage/sys-apps/file-5.44/work/file-5.44/src/softmagic.c -fPIC -DPIC -o .libs/softmagic.o
/gentoo/prefix64/var/tmp/portage/sys-apps/file-5.44/work/file-5.44/src/softmagic.c: In function ‘do_ops’:
/gentoo/prefix64/var/tmp/portage/sys-apps/file-5.44/work/file-5.44/src/softmagic.c:1462:20: error: ‘UINT_MAX’ undeclared (first use in this function)
 1462 | if (lhs >= UINT_MAX || lhs <= INT_MIN ||
      | ^~~~~~~~
/gentoo/prefix64/var/tmp/portage/sys-apps/file-5.44/work/file-5.44/src/softmagic.c:46:1: note: ‘UINT_MAX’ is defined in header ‘<limits.h>’; did you forget to ‘#include <limits.h>’?
   45 | #include "der.h"
  +++ |+#include <limits.h>
   46 |

% gcc -dumpversion
12.2.0
% uname -a
SunOS hollandscheleeuw 5.11 illumos-a7aaa5137d i86pc i386 i86pc Solaris

Adding a patch as the compiler suggests makes it compile:

% cat solaris.patch
--- src/softmagic.c.orig 2022-12-27 20:05:39.006034099 +0000
+++ src/softmagic.c 2022-12-27 20:05:46.330774386 +0000
@@ -42,6 +42,7 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <time.h>
+#include <limits.h>
 #include "der.h"
 
 file_private int match(struct magic_set *, struct magic *, file_regex_t **, size_t,

Please see attached patch.
Thanks!
Steps To Reproduceconfigure, make
Tagsbuild

Activities

grobian

2022-12-27 19:24

reporter  

file-5.44-solaris.patch (395 bytes)   
softmagic: include limits.h for UINT_MAX usage

Platforms like Solaris need this to compile.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>

--- a/src/softmagic.c
+++ b/src/softmagic.c
@@ -42,6 +42,7 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <time.h>
+#include <limits.h>
 #include "der.h"
 
 file_private int match(struct magic_set *, struct magic *, file_regex_t **, size_t,

file-5.44-solaris.patch (395 bytes)   

christos

2022-12-28 17:48

manager   ~0003881

Fixed, thanks!

Issue History

Date Modified Username Field Change
2022-12-27 19:24 grobian New Issue
2022-12-27 19:24 grobian Tag Attached: build
2022-12-27 19:24 grobian File Added: file-5.44-solaris.patch
2022-12-28 17:48 christos Assigned To => christos
2022-12-28 17:48 christos Status new => assigned
2022-12-28 17:48 christos Status assigned => resolved
2022-12-28 17:48 christos Resolution open => fixed
2022-12-28 17:48 christos Fixed in Version => 5.45
2022-12-28 17:48 christos Note Added: 0003881