From f4171dfd70dd4d8dd7740edd87ac1c44d022f378 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Mon, 27 Sep 2021 23:53:13 -0300 Subject: [PATCH] Fix wrong limits.h include (should be linux/limits.h) ARG_MAX and PATH_MAX are defined on POSIX.1-2017's limits.h(0p)[1], on linux/limits.h and on musl's limits.h, but not on glibc's limits.h (nor on any of its includes): $ grep -F -e ' ARG_MAX' -e ' PATH_MAX' /usr/include/limits.h \ /usr/include/linux/limits.h /usr/lib/musl/include/limits.h /usr/include/linux/limits.h:#define ARG_MAX 131072 /* # bytes of args + environ for exec() */ /usr/include/linux/limits.h:#define PATH_MAX 4096 /* # chars in a path name including nul */ /usr/lib/musl/include/limits.h:#define PATH_MAX 4096 /usr/lib/musl/include/limits.h:#define ARG_MAX 131072 Environment: $ grep '^NAME' /etc/os-release NAME="Artix Linux" $ pacman -Qo /usr/include/limits.h /usr/include/linux/limits.h \ /usr/lib/musl/include/limits.h /usr/include/limits.h is owned by glibc 2.33-5 /usr/include/linux/limits.h is owned by linux-api-headers 5.12.3-1 /usr/lib/musl/include/limits.h is owned by musl 1.2.2-1 Files that use the macros: $ git grep -Fl -e ARG_MAX -e PATH_MAX -- src src/firejail/cmdline.c src/firejail/firejail.h src/libtrace/libtrace.c src/libtracelog/libtracelog.c Note: No other macro from linux/limits.h appears to be used. Note2: The build works even without including any limits.h on the files that this commit changes, so there is probably another include on them that ends up defining ARG_MAX/PATH_MAX. Relates to #4578. [1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html --- src/libtrace/libtrace.c | 2 +- src/libtracelog/libtracelog.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libtrace/libtrace.c b/src/libtrace/libtrace.c index d88512b0a86..ae560c6d163 100644 --- a/src/libtrace/libtrace.c +++ b/src/libtrace/libtrace.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/libtracelog/libtracelog.c b/src/libtracelog/libtracelog.c index b946cc88983..734b2e8703c 100644 --- a/src/libtracelog/libtracelog.c +++ b/src/libtracelog/libtracelog.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include "../include/rundefs.h" //#define DEBUG