Bug 256272 - sysutils/py-scandir: Fails to stage on Python 3.9: error: redefinition of 'PyStructSequence_UnnamedField' with a different type: 'char *' vs 'const char *const' (breaks www/py-graphite-web)
Summary: sysutils/py-scandir: Fails to stage on Python 3.9: error: redefinition of 'Py...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
Depends on:
Reported: 2021-05-30 21:45 UTC by John W. O'Brien
Modified: 2021-06-10 15:28 UTC (History)
3 users (show)

See Also:
koobs: maintainer-feedback+
koobs: merge-quarterly?

www/py-graphite-web: Drop dependency on sysutils/py-scandir (914 bytes, patch)
2021-05-31 15:17 UTC, John W. O'Brien
john: maintainer-approval? (ports-bugs)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John W. O'Brien 2021-05-30 21:45:43 UTC
www/py-graphite-web depends on sysutils/py-scandir. sysutils/py-scandir@py39 fails "stage" with the following error.

_scandir.c:663:7: error: redefinition of 'PyStructSequence_UnnamedField' with a different type: 'char *' vs 'const char *const'
char *PyStructSequence_UnnamedField = "unnamed field";
/usr/local/include/python3.9/structseq.h:22:27: note: previous declaration is here
extern const char * const PyStructSequence_UnnamedField;
1 error generated.

The reason I am filing this bug against www/py-graphite-web instead of sysutils/py-scandir is because the scandir module has been included in the Python standard library since 3.5 [0], so I would hope that the dependency could be dropped. If desired, I will file a bug against sysutils/py-scandir instead.

[0] https://docs.python.org/3.8/whatsnew/3.5.html?highlight=scandir
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-05-31 02:30:11 UTC
@John If the code doesn't import from the standard library, the upstream code will need to be modified, and should be resolved upstream (as a pr/commit).

 Can you detail the situation with respect to this? We can update summary to reflect the root cause/resolution once identified.

Also, is quarterly affected, and any other Python versions?
Comment 2 John W. O'Brien 2021-05-31 15:17:33 UTC
Created attachment 225411 [details]
www/py-graphite-web: Drop dependency on sysutils/py-scandir

Based on static analysis, I conclude that www/py-graphite-web supports scandir from the standard library and will preferentially use it when it is available. Therefore, the port can unconditionally drop the dependency because it is already limited to Python 3.5 and newer. I have reported a bug [0] and proposed a patch [1] upstream.

sysutils/scandir should be limited to python:3.6-3.8

[0] https://github.com/graphite-project/graphite-web/issues/2705
[1] https://github.com/graphite-project/graphite-web/pull/2706
Comment 3 John W. O'Brien 2021-05-31 15:19:12 UTC
It's not clear what I would be indicating by setting the maintainer feedback flag one way or the other, but I believe my intentions are clear, so I will leave it to those who care about such things to handle it however they see fit.
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2021-06-01 02:03:25 UTC
(In reply to John W. O'Brien from comment #2)

Thanks for the clarity John
Comment 5 commit-hook freebsd_committer 2021-06-10 14:50:48 UTC
A commit in branch main references this bug:

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

commit 86439d81a884725cf6a022e518d9d02f94898d3c
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2021-06-10 14:30:17 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2021-06-10 14:46:16 +0000

    sysutils/py-scandir: Fix build with Python 3.9+

    PR:             256272
    Reported by:    John W. O'Brien <john@saltant.com>

 sysutils/py-scandir/files/patch-_scandir.c (new) | 14 ++++++++++++++
 1 file changed, 14 insertions(+)