RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1402516 - boost spirit lexer is broken on ppc64
Summary: boost spirit lexer is broken on ppc64
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: boost
Version: 7.4
Hardware: ppc64
OS: Unspecified
high
unspecified
Target Milestone: rc
: ---
Assignee: Jonathan Wakely
QA Contact: Arjun Shankar
Vladimír Slávik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-07 17:35 UTC by Jaroslav Škarvada
Modified: 2017-08-01 16:47 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 16:47:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:1973 0 normal SHIPPED_LIVE boost bug fix update 2017-08-01 17:57:35 UTC

Description Jaroslav Škarvada 2016-12-07 17:35:40 UTC
Description of problem:
The char type on ppc64 is unsigned thus the signed magic the boost implementation do doesn't work on ppc64 which results in the lexer not working or the application crashing (with e.g. the spirit debug mode enabled).

Version-Release number of selected component (if applicable):
boost-1.53.0-26.el7.ppc64

How reproducible:
Always

Steps to Reproduce:
1. E.g. try to compile uhd-3.10.1.0
2. Run make test

Actual results:
'make test' fails

Expected results:
'make test' pass

Additional info:
I think the boost lexer is quite unusable at the moment on ppc64 and maybe on other platforms as well.

Upstream ticket including the patch that worked for me:
https://svn.boost.org/trac/boost/ticket/8291

It's possible to come up with stripped down reproducer, but I haven't time to prepare it :)

Comment 2 Jaroslav Škarvada 2016-12-08 15:54:01 UTC
TLDR: the fix consists in replacing the following non portable code:

  CharT curr_char_ = sizeof (CharT) == 1 ? -128 : 0; 

by the portable code:

  CharT curr_char_ = (std::numeric_limits<CharT>::min)();

Comment 3 Jonathan Wakely 2016-12-14 14:57:11 UTC
That change apparently causes other problems when wchar_t is signed, see

https://github.com/boostorg/spirit/commit/c480d6c7fcadf3cb5fbaad756ac370275a75e601

That commit only fixes one of the places that the fix for ticket 8291 changed. It would be nice to know what on earth that code is actually trying to do. Surely fixing it properly and portably can't be difficult.

Comment 4 Jonathan Wakely 2016-12-14 15:00:34 UTC
The original change was https://github.com/boostorg/spirit/commit/2b4c331e70f1f8eaae33537df12c5744dd8e8b09

Comment 5 Frank Zdarsky 2016-12-15 16:47:07 UTC
That code fills a lookup table mapping characters to discrete finite automaton states for the lexer. Depending on the token_._negated flag, it either maps all characters in the token's charset or all possible characters _except_ for those in the charset.

So iterating curr_char_ from std::numeric_limits<CharT>::min)() would actually be correct.

A proper upstream fix would then either cast the index into the lookup table (ptr_[static_cast<typename Traits::index_type>(curr_char_)]) to unsigned or shift it by -std::numeric_limits<CharT>::min)()... consistently everywhere the
the lookup table is used. A bit more involved.

The kludge from https://github.com/boostorg/spirit/commit/c480d6c7fcadf3cb5fbaad756ac370275a75e601
starts with curr_char_=0, which works correctly on platforms on which wchar_t is unsigned int. On platforms where it's signed, it should work, too, as long as we're processing only characters >=0... which on >=32 bit platforms should encompass all relevant ones.

Comment 6 Jonathan Wakely 2016-12-15 16:50:43 UTC
Thanks! Now that bug 1404781 is fixed I'll have another try at applying those two patches and building a new package.

Comment 7 Jonathan Wakely 2016-12-20 10:53:34 UTC
Scratch build with those two patches:
https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=12254351

Comment 8 Frank Zdarsky 2017-02-10 20:23:40 UTC
Any movement on this? In particular, is there a chance to get this async into 7.3 as work with one of our partners depends on this?

Comment 9 Jonathan Wakely 2017-02-10 22:25:19 UTC
I have the patch ready to go, but making a change for rhel7 needs to be acked.

Did anyone test the scratch build I did?

Comment 10 Frank Zdarsky 2017-02-13 11:28:11 UTC
I'm afraid I didn't get to test before the scratch build expired. I'm sorry, would you mind kicking off a build again?

Can test only on x86_64, not ppc64, though.

Comment 11 Jaroslav Škarvada 2017-02-13 12:05:04 UTC
(In reply to Jonathan Wakely from comment #9)
> I have the patch ready to go, but making a change for rhel7 needs to be
> acked.
> 
> Did anyone test the scratch build I did?

Sorry I was on PTO, so I missed it and now the scratch build is gone. Could you rebuild it? I am going to test it with UHD.

Comment 12 Jonathan Wakely 2017-02-13 13:59:48 UTC
Hi, thanks for offering to test. Any testing is useful, even if not on ppc64. There's a new scratch build at https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=12533685

x86_64 RPMs are at:
https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=12533691

and ppc64 at:
https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=12533697

Thanks for checking them!

Comment 13 Jaroslav Škarvada 2017-02-13 18:41:58 UTC
(In reply to Jonathan Wakely from comment #12)
> Hi, thanks for offering to test. Any testing is useful, even if not on
> ppc64. There's a new scratch build at
> https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=12533685
> 
> x86_64 RPMs are at:
> https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=12533691
> 
> and ppc64 at:
> https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=12533697
> 
> Thanks for checking them!

The scratch build works for me, the problem seems fixed, thanks.

Comment 25 errata-xmlrpc 2017-08-01 16:47:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1973


Note You need to log in before you can comment on or make changes to this bug.