Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 723476 - dev-python/cffi: wrongly strips away #lines containing // (was: dev-python/zstandard-0.13.0 fails to build: temp/tmpXXXXXX.h:1:5: invalid #line directive)
Summary: dev-python/cffi: wrongly strips away #lines containing // (was: dev-python/zs...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
: 723754 (view as bug list)
Depends on:
Blocks: 721414
  Show dependency tree
 
Reported: 2020-05-17 09:58 UTC by Sergei Trofimovich (RETIRED)
Modified: 2020-05-30 16:14 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
dev-python:zstandard-0.13.0:20200517-094255.log (dev-python:zstandard-0.13.0:20200517-094255.log,3.86 KB, text/plain)
2020-05-17 09:58 UTC, Sergei Trofimovich (RETIRED)
Details
emerge --info (emerge--info,19.58 KB, text/plain)
2020-05-17 09:58 UTC, Sergei Trofimovich (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-17 09:58:10 UTC
* python2_7: running distutils-r1_run_phase python_compile
python2.7 setup.py build
Traceback (most recent call last):
  File "setup.py", line 74, in <module>
    import make_cffi
  File "/tmp/portage-tmpdir/portage/dev-python/zstandard-0.13.0/work/zstandard-0.13.0/make_cffi.py", line 225, in <module>
    ffi.cdef(b"\n".join(cdeflines).decode("latin1"))
  File "/usr/lib64/python2.7/site-packages/cffi/api.py", line 112, in cdef
    self._cdef(csource, override=override, packed=packed, pack=pack)
  File "/usr/lib64/python2.7/site-packages/cffi/api.py", line 126, in _cdef
    self._parser.parse(csource, override=override, **options)
  File "/usr/lib64/python2.7/site-packages/cffi/cparser.py", line 358, in parse
    self._internal_parse(csource)
  File "/usr/lib64/python2.7/site-packages/cffi/cparser.py", line 363, in _internal_parse
    ast, macros, csource = self._parse(csource)
  File "/usr/lib64/python2.7/site-packages/cffi/cparser.py", line 307, in _parse
    self.convert_pycparser_error(e, csource)
  File "/usr/lib64/python2.7/site-packages/cffi/cparser.py", line 336, in convert_pycparser_error
    raise CDefError(msg)
cffi.CDefError: parse error
/tmp/portage-tmpdir/portage/dev-python/zstandard-0.13.0/temp/tmpsO8mAd.h:1:5: invalid #line directive
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-17 09:58:31 UTC
Created attachment 639794 [details]
dev-python:zstandard-0.13.0:20200517-094255.log
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-17 09:58:50 UTC
Created attachment 639796 [details]
emerge --info
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-05-17 10:11:38 UTC
Would be helpful if you included that .h file.
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-17 11:08:37 UTC
Package cleans it up and does not make it easy to see how that file comes into existence.

$ cat: /tmp/portage-tmpdir/portage/dev-python/zstandard-0.13.0/temp/tmpsO8mAd.h: No such file or directory

You might want to add a few debugging statements to the package to make it debuggable.
Comment 5 Thomas Deutschmann (RETIRED) gentoo-dev 2020-05-17 21:45:48 UTC
Same problem.
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-18 12:16:15 UTC
Ina  stable chroot this seems to be enough to reproduce:

CFLAGS=-g1 emerge -v1 dev-python/zstandard

-g1 probably injects etra @line directives something doe not understand.
Comment 7 Arfrever Frehtes Taifersar Arahesis 2020-05-18 13:56:25 UTC
*** Bug 723754 has been marked as a duplicate of this bug. ***
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-05-19 10:31:19 UTC
Apparently the problematic line is:

   # 1 "/tmp/tmp1fq2j125.h"
-> # 1 "/tmp/python-zstandard 
   # 1 "<built-in>"

The question is: why does cffi get the path without leading '//"', compared to output of gcc.
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-05-19 10:31:28 UTC
s/leading/trailing
Comment 10 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-05-19 10:39:10 UTC
If you don't know what to blame, blame regexps.
Comment 11 Larry the Git Cow gentoo-dev 2020-05-28 08:20:44 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4146461e033a5b02c0ff97b2238701f7731a92e8

commit 4146461e033a5b02c0ff97b2238701f7731a92e8
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2020-05-28 08:06:04 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2020-05-28 08:06:04 +0000

    dev-python/cffi: Fix handling #line created by 'cpp -g'
    
    Closes: https://bugs.gentoo.org/723476
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 .../{cffi-1.14.0.ebuild => cffi-1.14.0-r1.ebuild}  |   4 +
 dev-python/cffi/files/cffi-0.14.0-g-line.patch     | 144 +++++++++++++++++++++
 2 files changed, 148 insertions(+)
Comment 12 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-05-28 16:44:19 UTC
My mistake.  Upstream has addressed '#line ...' but not '# <num> ...'
Comment 13 Larry the Git Cow gentoo-dev 2020-05-29 08:46:17 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c847df4320352b36b0e164efcf67d0ef7b37b93b

commit c847df4320352b36b0e164efcf67d0ef7b37b93b
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2020-05-29 08:45:57 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2020-05-29 08:45:57 +0000

    dev-python/cffi: Backport proper -g fix
    
    Closes: https://bugs.gentoo.org/723476
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 ...cffi-1.14.0-r1.ebuild => cffi-1.14.0-r2.ebuild} |   0
 dev-python/cffi/files/cffi-0.14.0-g-line.patch     | 106 +++++++++++++++++++++
 2 files changed, 106 insertions(+)
Comment 14 Larry the Git Cow gentoo-dev 2020-05-30 06:55:02 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a1162f25e0b212808c9c439c115d3734b0495dfc

commit a1162f25e0b212808c9c439c115d3734b0495dfc
Author:     Robin H. Johnson <robbat2@gentoo.org>
AuthorDate: 2020-05-30 06:53:36 +0000
Commit:     Robin H. Johnson <robbat2@gentoo.org>
CommitDate: 2020-05-30 06:54:44 +0000

    dev-python/zstandard: force new cffi
    
    Ensure cffi is upgraded with bugfix before upgrading zstandard.
    
    Bug: https://bugs.gentoo.org/723476
    Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>

 dev-python/zstandard/zstandard-0.13.0.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 15 Alexey 2020-05-30 16:14:01 UTC
zstandard-0.13.0 still doesn't build with cffi-1.14.0-r2.

 * python3_7: running distutils-r1_run_phase python_compile
python3.7 setup.py build -j 1
Traceback (most recent call last):
  File "setup.py", line 74, in <module>
    import make_cffi
  File "/mnt/portagetmp/portage/dev-python/zstandard-0.13.0/work/zstandard-0.13.0/make_cffi.py", line 225, in <module>
    ffi.cdef(b"\n".join(cdeflines).decode("latin1"))
  File "/usr/lib/python3.7/site-packages/cffi/api.py", line 112, in cdef
    self._cdef(csource, override=override, packed=packed, pack=pack)
  File "/usr/lib/python3.7/site-packages/cffi/api.py", line 126, in _cdef
    self._parser.parse(csource, override=override, **options)
  File "/usr/lib/python3.7/site-packages/cffi/cparser.py", line 389, in parse
    self._internal_parse(csource)
  File "/usr/lib/python3.7/site-packages/cffi/cparser.py", line 396, in _internal_parse
    self._process_macros(macros)
  File "/usr/lib/python3.7/site-packages/cffi/cparser.py", line 485, in _process_macros
    % (key, key, key, value))
cffi.CDefError: only supports one of the following syntax:
  #define __VERSION__ ...     (literally dot-dot-dot)
  #define __VERSION__ NUMBER  (with NUMBER an integer constant, decimal/hex/octal)
got:
  #define __VERSION__ "9.3.0"