make[2]: Entering directory '/home/asheplyakov/work/bootstrap/RPM/BUILD/procps-3.3.17-alt7.g37f1060' gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -Wno-unused-result -DLOCALEDIR=\"/usr/share/locale\" -Iproc -pipe -frecord-gcc-switches -Wall -g -O2 -Werror -c -o top/top.o top/top.c top/top.c: In function 'keys_window': top/top.c:4471:55: error: '%s' directive output may be truncated writing up to 127 bytes into a region of size 4 [-Werror=format-truncation=] 4471 | snprintf(q->rc.winname, sizeof(q->rc.winname), "%s", name); | ^~ ...... 5631 | if (tmp[0] && tmp[0] != kbd_ESC) win_names(w, tmp); | ~~~ In function 'win_names', inlined from 'keys_window' at top/top.c:5631:46: top/top.c:4471:7: note: 'snprintf' output between 1 and 128 bytes into a destination of size 4 4471 | snprintf(q->rc.winname, sizeof(q->rc.winname), "%s", name); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ top/top.c: In function 'keys_window': top/top.c:4472:49: error: '%s' directive output may be truncated writing up to 127 bytes into a region of size between 0 and 4 [-Werror=format-truncation=] 4472 | snprintf(q->grpname, sizeof(q->grpname), "%d:%s", q->winnum, name); | ^~ ...... 5631 | if (tmp[0] && tmp[0] != kbd_ESC) win_names(w, tmp); | ~~~ In function 'win_names', inlined from 'keys_window' at top/top.c:5631:46: top/top.c:4472:4: note: 'snprintf' output between 3 and 140 bytes into a destination of size 6 4472 | snprintf(q->grpname, sizeof(q->grpname), "%d:%s", q->winnum, name); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[2]: *** [Makefile:1572: top/top.o] Error 1 make[2]: Leaving directory '/home/asheplyakov/work/bootstrap/RPM/BUILD/procps-3.3.17-alt7.g37f1060' make[1]: *** [Makefile:1908: all-recursive] Error 1 make: *** [Makefile:1077: all] Error 2 error: Bad exit status from /home/asheplyakov/work/bootstrap/tmp/rpm-tmp.86525 (%build)
Возможно связано с https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95755 (но это не точно)
5628 if (ALTCHKw) { 5629 char tmp[SMLBUFSIZ]; 5630 STRLCPY(tmp, ioline(fmtmk(N_fmt(NAME_windows_fmt), w->rc.winname))); 5631 if (tmp[0] && tmp[0] != kbd_ESC) win_names(w, tmp); 5632 } 5633 break; $ grep -r -n -E 'define\s+SMLBUFSIZ\b' top/top.h:139:#define SMLBUFSIZ 128 4467 static void win_names (WIN_t *q, const char *name) { 4468 /* note: sprintf/snprintf results are "undefined" when src==dst, 4469 according to C99 & POSIX.1-2001 (thanks adc) */ 4470 if (q->rc.winname != name) 4471 snprintf(q->rc.winname, sizeof(q->rc.winname), "%s", name); 4472 snprintf(q->grpname, sizeof(q->grpname), "%d:%s", q->winnum, name); 4473 } // end: win_names $ grep -e 'winname' 'top/top.h' #define WINNAMSIZ 4 /* size of RCW_t winname buf (incl '\0') */ char winname [WINNAMSIZ], // name for the window, user changeable На первый взгляд это действительно попытка напечатать до 128 байт в буфер размером 4 байта
Created attachment 12996 [details] патч
Created attachment 13009 [details] disable_trunc_error.patch (In reply to Alexey Sheplyakov from comment #2) > На первый взгляд это действительно попытка напечатать до 128 байт в буфер > размером 4 байта Да, похоже апстрим считает, что truncation здесь - это нормально. Думаю, можно просто выключить -Werror в этом месте. Проверьте, пожалуйста, работает ди такой вариант.
Я не вижу такой ошибки с gcc13. Может проблема возникает только на конкретной архитектуре?