[Home]

Summary:ASTERISK-27156: Asterisk won't compile on Fedora 26 with devmode enabled.
Reporter:Corey Farrell (coreyfarrell)Labels:
Date Opened:2017-07-25 15:49:32Date Closed:2017-08-02 12:09:18
Priority:MinorRegression?
Status:Closed/CompleteComponents:Core/BuildSystem
Versions:13.17.0 14.6.0 GIT Frequency of
Occurrence
Related
Issues:
causesASTERISK-27171 Asterisk 15.0.0-Beta1 does not compile
causesASTERISK-27560 [patch] clang 5 does not know -Wno-format-truncation
causesASTERISK-27576 [patch] res_config_pgsql: Avoid typecasting an int to unsigned char.
causesASTERISK-27577 [patch] chan_ooh323: Avoid typecasting an int to unsigned short.
is duplicated byASTERISK-27181 GCC 7 warning: app_voicemail.c: In function 'imap_delete_old_greeting'
is related toASTERISK-27578 [patch] app_osplookup.c: Avoid a format truncation.
Environment:Attachments:
Description:It looks like gcc 7 includes a {{format-truncation}} warning which becomes an error in devmode.  The error occurs in many files, the following is from main/asterisk.c:

{noformat}
gcc -o /dev/null -c asterisk.i -pthread -I/home/cfarrell/code/asterisk/master/include    -I/usr/include/libxml2  -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations   -g3 -Werror -Wunused -Wdeclaration-after-statement -Wtrampolines -Wundef -Wmissing-format-attribute -Wformat=2  -O0  -march=native -I. -Ieditline -DAST_MODULE=\"core\" -DAST_IN_CORE  -O3
asterisk.c: In function ‘ast_readconfig’:
asterisk.c:3511:65: error: ‘/monitor’ directive output may be truncated writing 8 bytes into a region of size between 1 and 4096 [-Werror=format-truncation=]
 snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir), "%s/monitor", cfg_paths.spool_dir);
                                                                ^~~~~~~~~~~~
asterisk.c:3511:2: note: ‘snprintf’ output between 9 and 4104 bytes into a destination of size 4096
 snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir), "%s/monitor", cfg_paths.spool_dir);
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
asterisk.c:3512:69: error: ‘/recording’ directive output may be truncated writing 10 bytes into a region of size between 1 and 4096 [-Werror=format-truncation=]
 snprintf(cfg_paths.recording_dir, sizeof(cfg_paths.recording_dir), "%s/recording", cfg_paths.spool_dir);
                                                                    ^~~~~~~~~~~~~~
asterisk.c:3512:2: note: ‘snprintf’ output between 11 and 4106 bytes into a destination of size 4096
 snprintf(cfg_paths.recording_dir, sizeof(cfg_paths.recording_dir), "%s/recording", cfg_paths.spool_dir);
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [/home/cfarrell/code/asterisk/master/Makefile.rules:135: asterisk.o] Error 1
make[1]: Leaving directory '/home/cfarrell/code/asterisk/master/main'
make: *** [Makefile:367: main] Error 2
{noformat}

I receive this error with all modes of {{DONT_OPTIMIZE}} and {{DOUBLE_COMPILE}}.
Comments:By: Asterisk Team (asteriskteam) 2017-07-25 15:49:33.348-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].