Bug 268334 - security/cracklib: fix build with clang 15
Summary: security/cracklib: fix build with clang 15
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks: 265425
  Show dependency treegraph
 
Reported: 2022-12-12 15:14 UTC by Dimitry Andric
Modified: 2022-12-12 15:32 UTC (History)
0 users

See Also:
cy: maintainer-feedback+


Attachments
security/cracklib: fix build with clang 15 (1.66 KB, patch)
2022-12-12 15:14 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2022-12-12 15:14:17 UTC
During an exp-run for llvm 15 (see bug 265425), it turned out that security/cracklib failed to build with clang 15:

  rules.c:346:50: warning: too few arguments in call to 'Debug'
          Debug(1, "MatchClass: unknown class %c\n", class);
          ~~~~~                                           ^
  rules.c:346:45: error: incompatible integer to pointer conversion passing 'char' to parameter of type 'char *'; take the address with & [-Wint-conversion]
          Debug(1, "MatchClass: unknown class %c\n", class);
                                                     ^~~~~
                                                     &

This is because cracklib is very old K&R source, and the Debug() function is not defined with varargs, but an arbitrary amount of char pointer arguments.

Since the Debug() function does nothing anyway, define it as a varargs macro instead. This also gets rid of most of the other compilation warnings.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2022-12-12 15:14:44 UTC
Created attachment 238731 [details]
security/cracklib: fix build with clang 15
Comment 2 Cy Schubert freebsd_committer freebsd_triage 2022-12-12 15:19:19 UTC
Commit approved.
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-12-12 15:32:39 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5925cd3e9c3cea926aee6c78aaa1f708665dfa8d

commit 5925cd3e9c3cea926aee6c78aaa1f708665dfa8d
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-12-12 15:09:19 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-12-12 15:31:26 +0000

    security/cracklib: fix build with clang 15

    During an exp-run for llvm 15 (see bug 265425), it turned out that
    security/cracklib failed to build with clang 15:

      rules.c:346:50: warning: too few arguments in call to 'Debug'
              Debug(1, "MatchClass: unknown class %c\n", class);
              ~~~~~                                           ^
      rules.c:346:45: error: incompatible integer to pointer conversion passing 'char' to parameter of type 'char *'; take the address with & [-Wint-conversion]
              Debug(1, "MatchClass: unknown class %c\n", class);
                                                         ^~~~~
                                                         &

    This is because cracklib is very old K&R source, and the Debug()
    function is not defined with varargs, but an arbitrary amount of char
    pointer arguments.

    Since the Debug() function does nothing anyway, define it as a varargs
    macro instead. This also gets rid of most of the other compilation
    warnings.

    PR:             268334
    Approved by:    cy (maintainer)
    MFH:            2022Q4

 security/cracklib/files/patch-lib_rules.c (new) | 11 +++++++++++
 1 file changed, 11 insertions(+)