View Issue Details

IDProjectCategoryView StatusLast Update
0001412bareos-coreGeneralpublic2022-11-09 14:03
Reportertuxmaster Assigned Toarogge  
PrioritynormalSeverityblockReproducibilityalways
Status closedResolutionfixed 
Platformx86_64OSFedoraOS Version35
Product Version21.0.0 
Summary0001412: Unable to build it, because of the default compiler flags on Fedora and unclean code
DescriptionFedora will set this flags by default:
-Werror=maybe-uninitialized
-Werror=format-truncation
But then it fails at:
/builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob_job.c: In function 'jndex_tattle':
/builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob_job.c:436:5: error: 'i' may be used uninitialized [-Werror=maybe-uninitialized]
  436 | ndmjob_log(3, "ji me[%d] %s", i, buf);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
gmake[2]: *** [core/src/ndmp/CMakeFiles/ndmjob.dir/build.make:107: core/src/ndmp/CMakeFiles/ndmjob.dir/ndmjob_job.c.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
/builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob_simulator.c: In function 'robot_state_init':
/builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob_simulator.c:933:49: error: '__snprintf_chk' output truncated before the last format character [-Werror=format-truncation=]
  933 | "PTAG%02XXX ", i);
      | ^
In file included from /usr/include/stdio.h:888,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmos_linux.h:57,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmos.h:174,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmlib.h:41,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmagents.h:100,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob.h:38,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob_simulator.c:41:
/usr/include/bits/stdio2.h:71:10: note: '__snprintf_chk' output 33 bytes into a destination of size 32
   71 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   72 | __glibc_objsize (__s), __fmt,
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 | __va_arg_pack ());
      | ~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob_simulator.c:935:49: error: '__snprintf_chk' output truncated before the last format character [-Werror=format-truncation=]
  935 | "ATAG%02XXX ", i);
      | ^
In file included from /usr/include/stdio.h:888,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmos_linux.h:57,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmos.h:174,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmlib.h:41,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmagents.h:100,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob.h:38,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob_simulator.c:41:
/usr/include/bits/stdio2.h:71:10: note: '__snprintf_chk' output 33 bytes into a destination of size 32
   71 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   72 | __glibc_objsize (__s), __fmt,
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 | __va_arg_pack ());
      | ~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob_simulator.c: In function 'execute_cdb_move_medium':
/builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob_simulator.c:1075:33: error: '.pos' directive output may be truncated writing 4 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
 1075 | snprintf(pos, sizeof(pos), "%s.pos", src_filename);
      | ^~~~
In file included from /usr/include/stdio.h:888,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmos_linux.h:57,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmos.h:174,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmlib.h:41,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmagents.h:100,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob.h:38,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob_simulator.c:41:
/usr/include/bits/stdio2.h:71:10: note: '__snprintf_chk' output between 5 and 1028 bytes into a destination of size 1024
   71 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   72 | __glibc_objsize (__s), __fmt,
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 | __va_arg_pack ());
      | ~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob_simulator.c:1077:33: error: '.pos' directive output may be truncated writing 4 bytes into a region of size between 1 and 1024 [-Werror=format-truncation=]
 1077 | snprintf(pos, sizeof(pos), "%s.pos", dest_filename);
      | ^~~~
In file included from /usr/include/stdio.h:888,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmos_linux.h:57,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmos.h:174,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmlib.h:41,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmagents.h:100,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob.h:38,
                 from /builddir/build/BUILD/bareos-Release-21.0.0/core/src/ndmp/ndmjob_simulator.c:41:
/usr/include/bits/stdio2.h:71:10: note: '__snprintf_chk' output between 5 and 1028 bytes into a destination of size 1024
   71 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   72 | __glibc_objsize (__s), __fmt,
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 | __va_arg_pack ());
      | ~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
gmake[2]: Leaving directory '/builddir/build/BUILD/bareos-Release-21.0.0/redhat-linux-build'


The default flags on Fedora 35 are:
+ CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
+ export CFLAGS
+ CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
+ export CXXFLAGS
+ FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules'
+ export FFLAGS
+ FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules'
+ export FCFLAGS
+ LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 '
+ export LDFLAGS
Steps To ReproduceSee the complete build log
Additional InformationSee the complete build log
TagsNo tags attached.

Activities

tuxmaster

tuxmaster

2021-12-23 09:57

reporter  

build.log (486,949 bytes)
tuxmaster

tuxmaster

2021-12-23 22:25

reporter   ~0004411

The same will happens using the Fedora 34 compiler default settings,
tuxmaster

tuxmaster

2021-12-23 23:21

reporter   ~0004412

Also for build on RHEL-8 and RHEL-7(using Red Hat Developer Toolset 11.0 , because the default compiler don't support cx17).
arogge

arogge

2022-02-23 20:20

manager   ~0004524

Yeah, but just if you build the ndmpjob binary, which we usually don't.
Nevertheless, I fixed it, but the PR ist not yet merged.
arogge

arogge

2022-02-23 20:24

manager   ~0004525

btw... the fix is going onto master only. If you need to build the ndmpjob binary (and I really doubt that you do), you can add the patch during packaging - should be straightforward.

Issue History

Date Modified Username Field Change
2021-12-23 09:57 tuxmaster New Issue
2021-12-23 09:57 tuxmaster File Added: build.log
2021-12-23 22:25 tuxmaster Note Added: 0004411
2021-12-23 23:21 tuxmaster Note Added: 0004412
2022-02-23 20:20 arogge Note Added: 0004524
2022-02-23 20:23 arogge Assigned To => arogge
2022-02-23 20:23 arogge Status new => assigned
2022-02-23 20:24 arogge Note Added: 0004525
2022-11-09 14:03 arogge Status assigned => resolved
2022-11-09 14:03 arogge Resolution open => fixed
2022-11-09 14:03 arogge Status resolved => closed