realpath() warnings with gcc

Khem Raj raj.khem@gmail.com
Wed Dec 15 20:31:28 GMT 2021


Hi Siddhesh

I am seeing this warning with gcc 11.2 with latest glibc master when 
compiling inotify-tools

This seems to happen after this commit

https://sourceware.org/git/?p=glibc.git;a=commit;h=a643f60c53876be0d57b4b7373770e6cb356fd13

The source line triggering this warning is here

https://github.com/inotify-tools/inotify-tools/blob/master/src/inotifywait.c#L247

error message is below.

make[2]: Entering directory 
'/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/inotify-tools/3.21.9.6-r0/build/src'
x86_64-yoe-linux-gcc  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse 
-fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat 
-Wformat-security -Werror=format-security 
--sysroot=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/inotify-tools/3.21.9.6-r0/recipe-sysroot 
-DHAVE_CONFIG_H -I. -I../../git/src -I.. 
-I../libinotifytools/src/inotifytools  -I../../git/libinotifytools/src 
-Wall -Wextra -Wshadow -Werror -std=c99 -I../libinotifytools/src -O2 
-pipe -g -feliminate-unused-debug-types 
-fmacro-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/inotify-tools/3.21.9.6-r0=/usr/src/debug/inotify-tools/3.21.9.6-r0 
 
-fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/inotify-tools/3.21.9.6-r0=/usr/src/debug/inotify-tools/3.21.9.6-r0 
 
-fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/inotify-tools/3.21.9.6-r0/recipe-sysroot= 
 
-fdebug-prefix-map=/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/inotify-tools/3.21.9.6-r0/recipe-sysroot-native= 
  -c -o inotifywait.o ../../git/src/inotifywait.c
In file included from 
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/inotify-tools/3.21.9.6-r0/recipe-sysroot/usr/include/stdlib.h:1027,
                  from ../../git/src/inotifywait.c:20:
In function 'realpath',
     inlined from 'main' at ../../git/src/inotifywait.c:247:13:
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/inotify-tools/3.21.9.6-r0/recipe-sysroot/usr/include/bits/stdlib.h:46:12: 
error: call to '__realpath_chk_warn' declared with attribute warning: 
second argument of realpath must be either NULL or at least PATH_MAX 
bytes long buffer [-Werror=attribute-warning]
    46 |     return __realpath_chk_warn (__name, __resolved, sz);
       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [Makefile:463: inotifywait.o] Error 1
make[2]: Leaving directory 
'/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/inotify-tools/3.21.9.6-r0/build/src'


Thanks
-Khem



More information about the Libc-alpha mailing list