Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

Fix FTBFS with recent GCC 9#5700

Closed
OdyX wants to merge 2 commits into
apple:masterfrom
OdyX:gcc-ftbfs-231-fixes
Closed

Fix FTBFS with recent GCC 9#5700
OdyX wants to merge 2 commits into
apple:masterfrom
OdyX:gcc-ftbfs-231-fixes

Conversation

@OdyX

@OdyX OdyX commented Dec 8, 2019

Copy link
Copy Markdown
Contributor

master currently doesn't build on Debian unstable; see Travis-CI log: https://travis-ci.org/OdyX/cups/jobs/620941340

First "error: variable 'waittime' set but not used [-Werror=unused-but-set-variable]"

Compiling ipp.c...
ipp.c: In function 'main':
ipp.c:236:10: error: variable 'waittime' set but not used [-Werror=unused-but-set-variable]
  236 |   time_t waittime;  /* Wait time for held jobs */
      |          ^~~~~~~~

With this fixed; then "error: '0' flag ignored with precision and '%d' gnu_printf format [-Werror=format=]"

Compiling lpd.c...
lpd.c: In function 'lpd_queue':
lpd.c:1049:27: error: '0' flag ignored with precision and '%d' gnu_printf format [-Werror=format=]
 1049 |       if (lpd_command(fd, "\002%d cfA%03.3d%.15s\n", (int)strlen(control),
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~
lpd.c:1099:27: error: '0' flag ignored with precision and '%d' gnu_printf format [-Werror=format=]
 1099 |       if (lpd_command(fd, "\003" CUPS_LLFMT " dfA%03.3d%.15s\n",
      |                           ^~~~~~
lpd.c:1182:27: error: '0' flag ignored with precision and '%d' gnu_printf format [-Werror=format=]
 1182 |       if (lpd_command(fd, "\002%d cfA%03.3d%.15s\n", (int)strlen(control),
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~

OdyX added 2 commits December 8, 2019 14:08
Fixes build error with GNU C++ compiler '-Werror=unused-but-set-variable' option
Fixes build error with GNU C++ compiler '-Werror=format=' option
@michaelrsweet

Copy link
Copy Markdown
Contributor

The numbers in the LPD commands need to be zero-filled, so we want %03d.

[master dbdf8a2] Fix some new compiler warnings (Issue #5700)

[branch-2.2 e93ab4a] Fix some new compiler warnings (Issue #5700)

@michaelrsweet michaelrsweet self-assigned this Dec 13, 2019
@michaelrsweet michaelrsweet added this to the CUPS 2.2.x Updates milestone Dec 13, 2019
@OdyX OdyX deleted the gcc-ftbfs-231-fixes branch December 13, 2019 15:38
@OdyX

OdyX commented Dec 13, 2019

Copy link
Copy Markdown
Contributor Author

By the way; cups 2.2.13 fails to build with:

Compiling dir.c...
dir.c: In function 'cupsDirRead':
dir.c:383:46: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 0 and 1023 [-Werror=format-truncation=]
  383 |     snprintf(filename, sizeof(filename), "%s/%s", dp->directory, entry->d_name);
      |                                              ^~
dir.c:383:5: note: 'snprintf' output between 2 and 1280 bytes into a destination of size 1024
  383 |     snprintf(filename, sizeof(filename), "%s/%s", dp->directory, entry->d_name);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

See: https://travis-ci.org/OdyX/cups/jobs/624676621

@OdyX OdyX mentioned this pull request Dec 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants