jarun/bcal

Build error with GCC9: error: '%s' directive argument is null

eclipseo opened this issue · 7 comments

I have a problem building bcal in Fedora Rawhide using GCC 9.0.1

+ /usr/bin/make -O -j6 bcal
cc -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wall -Wextra -Wno-unused-parameter -Werror -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Iinc -o bcal src/bcal.c -lreadline
BUILDSTDERR: In file included from src/bcal.c:29:
BUILDSTDERR: src/bcal.c: In function 'evaluate':
BUILDSTDERR: inc/log.h:32:6: error: '%s' directive argument is null [-Werror=format-overflow=]
BUILDSTDERR:    32 |      debug_log(__func__, level, format, ##__VA_ARGS__)
BUILDSTDERR:       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: src/bcal.c:1926:2: note: in expansion of macro 'log'
BUILDSTDERR:  1926 |  log(DEBUG, "expr: %s\n", expr);
BUILDSTDERR:       |  ^~~
BUILDSTDERR: src/bcal.c:1926:20: note: format string is defined here
BUILDSTDERR:  1926 |  log(DEBUG, "expr: %s\n", expr);
BUILDSTDERR:       |                    ^~
BUILDSTDERR: In file included from src/bcal.c:29:
BUILDSTDERR: inc/log.h:32:6: error: '%s' directive argument is null [-Werror=format-overflow=]
BUILDSTDERR:    32 |      debug_log(__func__, level, format, ##__VA_ARGS__)
BUILDSTDERR:       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: src/bcal.c:1926:2: note: in expansion of macro 'log'
BUILDSTDERR:  1926 |  log(DEBUG, "expr: %s\n", expr);
BUILDSTDERR:       |  ^~~
BUILDSTDERR: src/bcal.c:1926:20: note: format string is defined here
BUILDSTDERR:  1926 |  log(DEBUG, "expr: %s\n", expr);
BUILDSTDERR:       |                    ^~
BUILDSTDERR: In file included from src/bcal.c:29:
BUILDSTDERR: inc/log.h:32:6: error: '%s' directive argument is null [-Werror=format-overflow=]
BUILDSTDERR:    32 |      debug_log(__func__, level, format, ##__VA_ARGS__)
BUILDSTDERR:       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: src/bcal.c:1926:2: note: in expansion of macro 'log'
BUILDSTDERR:  1926 |  log(DEBUG, "expr: %s\n", expr);
BUILDSTDERR:       |  ^~~
BUILDSTDERR: src/bcal.c:1926:20: note: format string is defined here
BUILDSTDERR:  1926 |  log(DEBUG, "expr: %s\n", expr);
BUILDSTDERR:       |                    ^~
BUILDSTDERR: In file included from src/bcal.c:29:
BUILDSTDERR: inc/log.h:32:6: error: '%s' directive argument is null [-Werror=format-overflow=]
BUILDSTDERR:    32 |      debug_log(__func__, level, format, ##__VA_ARGS__)
BUILDSTDERR:       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: src/bcal.c:1926:2: note: in expansion of macro 'log'
BUILDSTDERR:  1926 |  log(DEBUG, "expr: %s\n", expr);
BUILDSTDERR:       |  ^~~
BUILDSTDERR: src/bcal.c:1926:20: note: format string is defined here
BUILDSTDERR:  1926 |  log(DEBUG, "expr: %s\n", expr);
BUILDSTDERR:       |                    ^~
BUILDSTDERR: In file included from src/bcal.c:29:
BUILDSTDERR: inc/log.h:32:6: error: '%s' directive argument is null [-Werror=format-overflow=]
BUILDSTDERR:    32 |      debug_log(__func__, level, format, ##__VA_ARGS__)
BUILDSTDERR:       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: src/bcal.c:1926:2: note: in expansion of macro 'log'
BUILDSTDERR:  1926 |  log(DEBUG, "expr: %s\n", expr);
BUILDSTDERR:       |  ^~~
BUILDSTDERR: src/bcal.c:1926:20: note: format string is defined here
BUILDSTDERR:  1926 |  log(DEBUG, "expr: %s\n", expr);
BUILDSTDERR:       |                    ^~
BUILDSTDERR: In file included from src/bcal.c:29:
BUILDSTDERR: inc/log.h:32:6: error: '%s' directive argument is null [-Werror=format-overflow=]
BUILDSTDERR:    32 |      debug_log(__func__, level, format, ##__VA_ARGS__)
BUILDSTDERR:       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: src/bcal.c:1926:2: note: in expansion of macro 'log'
BUILDSTDERR:  1926 |  log(DEBUG, "expr: %s\n", expr);
BUILDSTDERR:       |  ^~~
BUILDSTDERR: src/bcal.c:1926:20: note: format string is defined here
BUILDSTDERR:  1926 |  log(DEBUG, "expr: %s\n", expr);
BUILDSTDERR:       |                    ^~
BUILDSTDERR: cc1: all warnings being treated as errors
BUILDSTDERR: make: *** [Makefile:14: bcal] Error 1
jarun commented

Would it be possible for you to share a patch? I don't have gcc9 right now.

Share a patch? I don't get what you mean. I don't have a patch.

jarun commented

I meant could you raise a PR that fixes the problem?

Sorry, I'm no C programmer. From what I understand, it's because expr can be NULL in:

1926 | log(DEBUG, "expr: %s\n", expr);

jarun commented

Try master now. I think it would get fixed.

jarun commented

👍 Thanks for confirming!