Bug 268341 - archivers/rpm4: fix build with clang 15
Summary: archivers/rpm4: 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 Only Me
Assignee: Rodrigo Osorio
URL:
Keywords:
Depends on:
Blocks: 265425
  Show dependency treegraph
 
Reported: 2022-12-12 20:35 UTC by Dimitry Andric
Modified: 2022-12-13 16:25 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (rodrigo)


Attachments
archivers/rpm4: fix build with clang 15 (1.87 KB, patch)
2022-12-12 20:35 UTC, Dimitry Andric
rodrigo: maintainer-approval+
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 20:35:04 UTC
During an exp-run for llvm 15 (see bug 265425), it turned out that archivers/rpm4 failed to build with clang 15:

  tools/rpmuncompress.c:101:23: warning: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
              const char *bn = basename(fn);
                               ^
  tools/rpmuncompress.c:101:18: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
              const char *bn = basename(fn);
                          ^    ~~~~~~~~~~~~

This is because basename(3) is defined in <libgen.h>. After this include is added to rpmuncompress.c, link errors still occur:

  ld: error: undefined symbol: WIFEXITED
  >>> referenced by rpmuncompress.c
  >>>               tools/rpmuncompress.o:(main)

  ld: error: undefined symbol: WEXITSTATUS
  >>> referenced by rpmuncompress.c
  >>>               tools/rpmuncompress.o:(main)

This is because WIFEXITED() and WEXITSTATUS() are macros defined in <sys/wait.h>.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2022-12-12 20:35:22 UTC
Created attachment 238740 [details]
archivers/rpm4: fix build with clang 15
Comment 2 Rodrigo Osorio freebsd_committer freebsd_triage 2022-12-12 20:52:17 UTC
Patch looks good to me, you can commit it.
Not sure is a PORTREVISION bump is required
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2022-12-13 16:20:27 UTC
(In reply to Rodrigo Osorio from comment #2)
As far as I have understood, no. (I have assumed that the port builds fine on 14.x, 13.x etc, it's only an 'unbreak' fix for the llvm-15-update branch.)
Comment 4 commit-hook freebsd_committer freebsd_triage 2022-12-13 16:22:21 UTC
A commit in branch main references this bug:

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

commit b06956644e3d514ea746e0663a90df3c082ae2fd
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-12-12 20:30:27 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-12-13 16:20:38 +0000

    archivers/rpm4: fix build with clang 15

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

      tools/rpmuncompress.c:101:23: warning: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                  const char *bn = basename(fn);
                                   ^
      tools/rpmuncompress.c:101:18: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
                  const char *bn = basename(fn);
                              ^    ~~~~~~~~~~~~

    This is because basename(3) is defined in <libgen.h>. After this include
    is added to rpmuncompress.c, link errors still occur:

      ld: error: undefined symbol: WIFEXITED
      >>> referenced by rpmuncompress.c
      >>>               tools/rpmuncompress.o:(main)

      ld: error: undefined symbol: WEXITSTATUS
      >>> referenced by rpmuncompress.c
      >>>               tools/rpmuncompress.o:(main)

    This is because WIFEXITED() and WEXITSTATUS() are macros defined in
    <sys/wait.h>.

    PR:             268341
    Approved by:    rodrigo (maintainer)
    MFH:            2022Q4

 archivers/rpm4/files/patch-tools_rpmuncompress.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)