-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
xattr support missing in os module under cygwin #90026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
With the latest Python 3.8.10 under cygwin the following fails: >>> import os
>>> os.listxattr('.')
Traceback (most recent call last):
File "<stdin>", line 1, in < module>
AttributeError: module 'os' has no attribute 'listxattr' /usr/include/attr/xattr.h declares the corresponding library functions, so something must be wrong in the configuration/compilation of python itself. |
This is listed in the docs as a linux-only feature: https://docs.python.org/3/library/os.html#linux-extended-attributes |
Perhaps it could be supported under cygwin though without too much effort? Most likely just a configuration fix? After all, cygwin is a sort of linux ... |
There isn't currently a maintainer for cpython on cygwin. If someone volunteers for this, they can go through the issues listed at the bottom of bpo-45537. |
@iritkatriel Any chance to revisit this? It seems to me as if Cygwin would just provide the Linux xattr syscalls: https://github.com/search?q=org%3Acygwin%20getxattr&type=code If so, wouldn't it be enough to simply have Sure that wouldn't be full maintenance of Cygwin in Python,... but some more would perhaps work? |
If you want to submit a PR, hopefully someone can review it. I'm a Mac user myself, so I can't really help with Cygwin. |
Hey there. I played a bit on this with the following results so far: First, right now, cygwin contains only Python up to 3.9.9, where we have: Line 244 in ccb0e6a
Here, the check for gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -DOPENSSL_NO_SSL3=1 -I/usr/include/uuid/ -fdebug-prefix-map=/home/calestyo/u/x/python39-3.9.9-1.x86_64/build=/usr/src/debug/python39-3.9.9-1 -fdebug-prefix-map=/home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9=/usr/src/debug/python39-3.9.9-1 -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -DOPENSSL_NO_SSL3=1 -I/usr/include/uuid/ -fdebug-prefix-map=/home/calestyo/u/x/python39-3.9.9-1.x86_64/build=/usr/src/debug/python39-3.9.9-1 -fdebug-prefix-map=/home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9=/usr/src/debug/python39-3.9.9-1 -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I/home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Include/internal -IObjects -IInclude -IPython -I. -I/home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Include -DPy_BUILD_CORE_BUILTIN -DPy_BUILD_CORE_BUILTIN -I/home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Include/internal -c /home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Modules/posixmodule.c -o Modules/posixmodule.o
sed -e "s,@EXENAME@,/usr/bin/python3.9.exe," < /home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Misc/python-config.in >python-config.py
LC_ALL=C sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' < Misc/python-config.sh >python-config
/home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Modules/posixmodule.c: In function ‘os_getxattr_impl’:
/home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Modules/posixmodule.c:12634:56: error: ‘XATTR_SIZE_MAX’ undeclared (first use in this function); did you mean ‘PY_SIZE_MAX’?
12634 | static const Py_ssize_t buffer_sizes[] = {128, XATTR_SIZE_MAX, 0};
| ^~~~~~~~~~~~~~
| PY_SIZE_MAX
/home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Modules/posixmodule.c:12634:56: note: each undeclared identifier is reported only once for each function it appears in
/home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Modules/posixmodule.c: In function ‘os_listxattr_impl’:
/home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Modules/posixmodule.c:12814:57: error: ‘XATTR_LIST_MAX’ undeclared (first use in this function)
12814 | static const Py_ssize_t buffer_sizes[] = { 256, XATTR_LIST_MAX, 0 };
| ^~~~~~~~~~~~~~
In file included from /home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Include/Python.h:137,
from /home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Modules/posixmodule.c:12:
/home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Modules/posixmodule.c: In function ‘all_ins’:
/home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Modules/posixmodule.c:15113:33: error: ‘XATTR_SIZE_MAX’ undeclared (first use in this function); did you mean ‘PY_SIZE_MAX’?
15113 | if (PyModule_AddIntMacro(m, XATTR_SIZE_MAX)) return -1;
| ^~~~~~~~~~~~~~
/home/calestyo/u/x/python39-3.9.9-1.x86_64/src/Python-3.9.9/Include/modsupport.h:146:67: note: in definition of macro ‘PyModule_AddIntMacro’
146 | #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
| ^
make: *** [Makefile:1967: Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....
*** ERROR: make failed and would further fail with a missing Meanwhile 8be8101 changed the check to: Line 277 in 8be8101
use And if I use e.g.:
it compiles and at least Of course the I'd guess that it's Cygwin’s duty to properly export On the Python side I think we should still add an alternative for I'll also ask at the Cygwin ml, whether it's expected to export that symbol... if so, we can just close this (respectively remove it from the meta-bug) as fixed from the Python side... if not I'll do a PR. |
Just checked again and seems I had some glitch somewhere... Cygwin does not seem to export Also, if I set the missing |
btw: A PR will follow, may just take a while since I'll be on some official trip (with no Windows/Cygwin machine at hand) and on vacation right afterwards. |
@iritkatriel Since I'm working on getting this done, can you please re-open this issue? |
Hey @iritkatriel. Since you're core developer... any chance that you could perhaps review my proposed PR for this? 😇 Thanks, |
Thanks for the fix! For reference: Cygwin is unsupported platform, meaning we don't test it. The feature may break in the future. |
Uh oh!
There was an error while loading. Please reload this page.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: