Bug 239644 - shells/ksh93: fix build with GCC-based architectures
Summary: shells/ksh93: fix build with GCC-based architectures
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: Cy Schubert
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-04 15:11 UTC by Piotr Kubaj
Modified: 2019-08-12 07:17 UTC (History)
1 user (show)

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


Attachments
patch (125.04 KB, patch)
2019-08-04 15:11 UTC, Piotr Kubaj
pkubaj: maintainer-approval? (cy)
Details | Diff
Upd (128.11 KB, patch)
2019-08-04 16:57 UTC, Cy Schubert
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer 2019-08-04 15:11:06 UTC
Created attachment 206277 [details]
patch

Merge https://github.com/att/ast/commit/dd0570ce4aa087de133f18237efa262151c5154f.patch to fix build with GCC.

Since the files changed before this commit, we can't apply it via PATCHFILES.
Comment 1 Cy Schubert freebsd_committer 2019-08-04 16:35:42 UTC
That is actually this patch:

commit 63e9edcb6084d4b164439065e2d71f3e900ec3c7
Author: Kurtis Rader <krader@skepticism.us>
Date:   Wed May 22 19:30:12 2019 -0700

    Stop dynamically generating conftab.c and conftab.h
    
    GCC 9.1 changes the output of `gcc -E` which breaks the conf.sh script.
    We want to eliminate the `getconf` builtin and the `astconf()` function.
    No unit tests depend on either of those. And it is highly unlikely any
    real world scripts do so. So as the first step in removing those APIs and
    to make building this possible with gcc 9.1 just use a static version of
    conftab.c and conftab.h.
    
    Fixes #1315
    Related #1118
Comment 2 Cy Schubert freebsd_committer 2019-08-04 16:57:26 UTC
Created attachment 206281 [details]
Upd
Comment 3 Cy Schubert freebsd_committer 2019-08-04 16:59:02 UTC
The upstream patch doesn't apply, even with -p1. So, can you please try the updated patch?

For patches such as this you need to apply them first then do make makepatch.
Comment 4 commit-hook freebsd_committer 2019-08-04 17:43:29 UTC
A commit references this bug:

Author: cy
Date: Sun Aug  4 17:42:40 UTC 2019
New revision: 508117
URL: https://svnweb.freebsd.org/changeset/ports/508117

Log:
  Fix build with GCC-based architectures.

  PR:		239644
  Submitted by:	pkubaj@
  MFH:		2019Q3

Changes:
  head/shells/ksh93/Makefile
  head/shells/ksh93/files/patch-scripts__libast____prereq.sh
  head/shells/ksh93/files/patch-scripts__sort____symbols.py
  head/shells/ksh93/files/patch-src__lib__libast__comp__conf.sh
  head/shells/ksh93/files/patch-src__lib__libast__comp__conf.tab
  head/shells/ksh93/files/patch-src__lib__libast__comp__conftab.c
  head/shells/ksh93/files/patch-src__lib__libast__comp__conftab.c.in
  head/shells/ksh93/files/patch-src__lib__libast__comp__conftab.h.in
  head/shells/ksh93/files/patch-src__lib__libast__include__conftab.h
  head/shells/ksh93/files/patch-src__lib__libast__meson.build
Comment 5 Cy Schubert freebsd_committer 2019-08-04 17:49:17 UTC
Committed. Thanks for the pre-work massaging the patch. As you said, the raw github patch, regardless of the hash used, didn't patch.

It is greatly appreciated that you allow me the opportunity to review the patch first as a jumbo patch would have been inappropriate in this case.
Comment 6 commit-hook freebsd_committer 2019-08-05 13:28:59 UTC
A commit references this bug:

Author: cy
Date: Mon Aug  5 13:28:05 UTC 2019
New revision: 508167
URL: https://svnweb.freebsd.org/changeset/ports/508167

Log:
  MFH: r508117

  Fix build with GCC-based architectures.

  PR:		239644
  Submitted by:	pkubaj@
  Approved by:	portmgr (joneum@)

Changes:
_U  branches/2019Q3/
  branches/2019Q3/shells/ksh93/Makefile
  branches/2019Q3/shells/ksh93/files/patch-scripts__libast____prereq.sh
  branches/2019Q3/shells/ksh93/files/patch-scripts__sort____symbols.py
  branches/2019Q3/shells/ksh93/files/patch-src__lib__libast__comp__conf.sh
  branches/2019Q3/shells/ksh93/files/patch-src__lib__libast__comp__conf.tab
  branches/2019Q3/shells/ksh93/files/patch-src__lib__libast__comp__conftab.c
  branches/2019Q3/shells/ksh93/files/patch-src__lib__libast__comp__conftab.c.in
  branches/2019Q3/shells/ksh93/files/patch-src__lib__libast__comp__conftab.h.in
  branches/2019Q3/shells/ksh93/files/patch-src__lib__libast__include__conftab.h
  branches/2019Q3/shells/ksh93/files/patch-src__lib__libast__meson.build
Comment 7 Piotr Kubaj freebsd_committer 2019-08-11 09:44:38 UTC
Build still fails with GCC9:
/usr/local/poudriere/ports/default/shells/ksh93/work/ast-2020.0.0-alpha1/build/src/lib/libast/comp/conftab.c:356:74: error: '_PC_XATTR_EXISTS' undeclared here (not in a function)
  356 | { "XATTR_EXISTS", { 0UL, 0 }, { 0UL, 0 }, 0, CONF_SUN, 1, CONF_pathconf, _PC_XATTR_EXISTS },
      |                                                                          ^~~~~~~~~~~~~~~~
Comment 8 Cy Schubert freebsd_committer 2019-08-12 04:29:02 UTC
This was fixed by upstream commit:

commit 63e9edcb6084d4b164439065e2d71f3e900ec3c7
Author: Kurtis Rader <krader@skepticism.us>
Date:   Wed May 22 19:30:12 2019 -0700

    Stop dynamically generating conftab.c and conftab.h
    
    GCC 9.1 changes the output of `gcc -E` which breaks the conf.sh script.
    We want to eliminate the `getconf` builtin and the `astconf()` function.
    No unit tests depend on either of those. And it is highly unlikely any
    real world scripts do so. So as the first step in removing those APIs and
    to make building this possible with gcc 9.1 just use a static version of
    conftab.c and conftab.h.
    
    Fixes #1315
    Related #1118

--

Unfortunately the patch does not apply to the somewhat ancient shells/ksh93. We can flag the port broken on architectures that use GCC 9, recommending people use ksh93-devel.

What architectures would you like flagged broken with a pointer to ksh93-devel?
Comment 9 Cy Schubert freebsd_committer 2019-08-12 04:37:33 UTC
We will flag as broken when USE_GCC==9 instead.
Comment 10 commit-hook freebsd_committer 2019-08-12 04:45:11 UTC
A commit references this bug:

Author: cy
Date: Mon Aug 12 04:44:38 UTC 2019
New revision: 508705
URL: https://svnweb.freebsd.org/changeset/ports/508705

Log:
  Mark broken when USE_GCC=9. Upstream git commit
  63e9edcb6084d4b164439065e2d71f3e900ec3c7 resolves this issue.
  Unfortunately it does not apply, requiring this port to be upated to
  ksh93 well into ksh93-devel. Bringing ksh93 up to the ksh93-devel or
  shy of it would negate the justification for ksh93's existence. It is
  therefore recommended that people use ksh93-devel on architectures that
  use GCC 9 or use GCC 8.

  PR:		239644
  Reported by:	pkubaj@

Changes:
  head/shells/ksh93/Makefile
Comment 11 commit-hook freebsd_committer 2019-08-12 07:17:23 UTC
A commit references this bug:

Author: tobik
Date: Mon Aug 12 07:17:09 UTC 2019
New revision: 508709
URL: https://svnweb.freebsd.org/changeset/ports/508709

Log:
  shells/ksh93: Attempt to fix r508705 and unbreak index

  It fails basic sanity checks:

  make: "/usr/ports/shells/ksh93/Makefile" line 16: Malformed conditional (${USE_GCC} == "9")
  make: Fatal errors encountered -- cannot continue
  make: stopped in /usr/ports/shells/ksh93

  PR:		239644
  Pointy hat:	cy

Changes:
  head/shells/ksh93/Makefile