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-31 05:07 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 2019-08-04 16:57:26 UTC
Created attachment 206281 [details]
Upd
Comment 3 Cy Schubert freebsd_committer freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 2019-08-12 04:37:33 UTC
We will flag as broken when USE_GCC==9 instead.
Comment 10 commit-hook freebsd_committer freebsd_triage 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 freebsd_triage 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
Comment 12 Piotr Kubaj freebsd_committer freebsd_triage 2019-08-25 14:47:11 UTC
Reopening this.

Even though you committed a conditional so that it doesn't build with gcc9, it's after inclusion of bsd.port.pre.mk, which makes it still build.

You could actually try using the patch sent by me, that way the port compiles.

A (hacky) workaround would be also to force using gcc8.
Comment 13 Cy Schubert freebsd_committer freebsd_triage 2019-08-25 15:58:12 UTC
That is a significant patch. Have you test built it on current, stable/12 and stable/11?
Comment 14 Piotr Kubaj freebsd_committer freebsd_triage 2019-08-25 20:58:07 UTC
I tested on 11 and 12. I have no CURRENT installed.
Comment 15 Cy Schubert freebsd_committer freebsd_triage 2019-08-27 19:38:54 UTC
Requested upstream tag 2020.0.0-alpha2 based on 63e9edcb6084d4b164439065e2d71f3e900ec3c7.

Let's avoid too many patches that will require you to upkeep.

Or we can push forward the port to 63e9edcb6084d4b164439065e2d71f3e900ec3c7 instead of the 2020.0.0-alpha1 tag. Let's see what they say and decide whether to push forward or apply your patches.
Comment 16 Cy Schubert freebsd_committer freebsd_triage 2019-08-28 01:25:14 UTC
Our upstream has agreed it's time for a new tag. They will tag 2020.0.0-beta-something. https://github.com/att/ast/issues/1385.
Comment 17 commit-hook freebsd_committer freebsd_triage 2019-08-30 20:06:10 UTC
A commit references this bug:

Author: cy
Date: Fri Aug 30 20:05:28 UTC 2019
New revision: 510287
URL: https://svnweb.freebsd.org/changeset/ports/510287

Log:
  Update 2020.0.0-alpha1 --> 2020.0.0-beta1

  2020.0.0-beta1 resolves gcc9 build issues in PR/239644.

  PR:		239644

Changes:
  head/shells/ksh93/Makefile
  head/shells/ksh93/distinfo
  head/shells/ksh93/files/extra-patch-install-as-ksh93
  head/shells/ksh93/files/patch-scripts__libast____prereq.sh
  head/shells/ksh93/files/patch-scripts__sort____symbols.py
  head/shells/ksh93/files/patch-scripts_builtin_documentation.sh
  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
  head/shells/ksh93/files/patch-src_cmd_ksh93_sh_xec.c