You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
python3.0 interpreter on Cygwin ignores all arguments #47876
Attempting to build 3.0b3, the sharedmods make target results only in a
python command prompt. In fact, it seems that the interpreter doesn't
accept any arguments:
$ ./python.exe --version
Python 3.0b3 (r30b3:65927, Aug 20 2008, 22:34:44)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>
$ ./python.exe -c 'print "Hello, World!"'
Python 3.0b3 (r30b3:65927, Aug 20 2008, 22:34:44)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>
The same happened with 3.0b2 when I tried to determine if this was a
recent regression. I have successfully built 2.5 on a number of occasions.
Thank you, that fixes that issue. But further along the build fails:
Traceback (most recent call last):
File
"/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/setup.py",
line 1569, in <module>
classPyBuildInstallLib(install_lib):
File
"/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/setup.py",
line 1575, in PyBuildInstallLib
so_ext = sysconfig.get_config_var("SO")
File
"/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/distutils/sysconfig.py",
line 552, in get_config_var
return get_config_vars().get(name)
File
"/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/distutils/sysconfig.py",
line 491, in get_config_vars
func()
File
"/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/distutils/sysconfig.py",
line 360, in _init_posix
parse_makefile(filename, g)
File
"/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/distutils/sysconfig.py",
line 272, in parse_makefile
line = fp.readline()
File
"/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/distutils/text_file.py",
line 173, in readline
line =self.file.readline()
File
"/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/io.py",
line 1751, in readline
decoder =self._decoder orself._get_decoder()
File
"/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/io.py",
line 1501, in _get_decoder
make_decoder = codecs.getincrementaldecoder(self._encoding)
File
"/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/codecs.py",
line 960, in getincrementaldecoder
decoder = lookup(encoding).incrementaldecoder
LookupError: unknown encoding: Umake: *** [sharedmods] Error 1
Yaakov, you should remove the _locale.dll from your build directory: for
the compilation phase, better have no locale at all than a broken "U" as
default encoding ("U" is the initial of UTF8)
cygwin has also a nasty bug:
printf("%ls", wide_string)
fails for strings of length 1. %S has the same problem.
$ ./python.exe ab
./python: can't open file 'ab': [Errno 2] No such file or directory$ ./python.exe a./python
The output stops at "./python", probably because stderr has an error
flag set.
Since %ls is only used in Modules/main.c, the best is probably to
replace it with something else. And since cygwin has no function of the
family of wprintf or fputws, PyUnicode is probably the way to go.
Corinna got _wcsrtombs_r fixed in newlib, so I imagine the next Cygwin
1.7 preview will have the fix. Unfortunately that won't help the
still-stable Cygwin 1.5. I'm not sure what you mean by PyUnicode being
a workaround; if you could propose a patch, I'll be happy to try it.
yselkowitz commented on Aug 27, 2008
yselkowitzmannequin
MannequinAuthor
More actions
Another thing: _bsddb does not compile with db4.7:
Modules/_bsddb.c: In function DBSequence_get_cachesize': [Modules/_bsddb.c:5022](https://github.com/python/cpython/blob/main/Modules/_bsddb.c#L5022): warning: passing arg 2 of pointer to function from incompatible pointer type [Modules/_bsddb.c](https://github.com/python/cpython/blob/main/Modules/_bsddb.c): In function DBEnv_db_home_get': Modules/_bsddb.c:5331: error: structure has no member named db_home' [Modules/_bsddb.c:5334](https://github.com/python/cpython/blob/main/Modules/_bsddb.c#L5334): error: structure has no member named db_home' Modules/_bsddb.c: In function PyInit__bsddb': [Modules/_bsddb.c:5948](https://github.com/python/cpython/blob/main/Modules/_bsddb.c#L5948): error: DB_LOG_AUTOREMOVE' undeclared (first use
in this function) Modules/_bsddb.c:5948: error: (Each undeclared identifier is reported
only once Modules/_bsddb.c:5948: error: for each function it appears in.) Modules/_bsddb.c:5949: error: DB_DIRECT_LOG' undeclared (first use in this function) [Modules/_bsddb.c:5957](https://github.com/python/cpython/blob/main/Modules/_bsddb.c#L5957): error: DB_LOG_INMEMORY' undeclared (first use in
this function)
4.5 and 4.6 both give the first warning, but no errors.
I think cygwin_badprintf.patch needs to consider the case r==PATH_MAX;
this happens when the conversion would need more than PATH_MAX bytes for
the target buffer. In that case, I think it would be good enough to
write "<file name too long>" into cfilename (using cfilename as is will
crash because it's not null-terminated; forcefully null-terminating it
might break the shift state)
Updated patch, which checks the return value of wcstombs.
loewis commented on Oct 17, 2008
loewismannequin
Mannequin
More actions
IIUC, another error return value (besides -1) is PATH_MAX, meaning that
the buffer would overrun; correct me if I'm wrong. If I'm not, I propose
that they get handles similarly.
In addition, it might be safer to compare to (size_t)-1 (I keep
forgetting whether this is the default when comparing signed and
unsigned - some compilers warn about comparisong with mixed signs).
Activity
yselkowitz commentedon Aug 21, 2008
Attempting to build 3.0b3, the sharedmods make target results only in a
python command prompt. In fact, it seems that the interpreter doesn't
accept any arguments:
$ ./python.exe --version
Python 3.0b3 (r30b3:65927, Aug 20 2008, 22:34:44)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
$ ./python.exe -c 'print "Hello, World!"'
Python 3.0b3 (r30b3:65927, Aug 20 2008, 22:34:44)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
The same happened with 3.0b2 when I tried to determine if this was a
recent regression. I have successfully built 2.5 on a number of occasions.
amauryfa commentedon Aug 21, 2008
Cygwin seems to have a broken implementation of mbstowcs.
See http://www.google.com/codesearch?q=cygwin+mbstowcs\\(NULL
The attached patch corrects the problem.
yselkowitz commentedon Aug 21, 2008
Thank you, that fixes that issue. But further along the build fails:
Traceback (most recent call last): File "/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/setup.py", line 1569, in <module> class PyBuildInstallLib(install_lib): File "/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/setup.py", line 1575, in PyBuildInstallLib so_ext = sysconfig.get_config_var("SO") File "/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/distutils/sysconfig.py", line 552, in get_config_var return get_config_vars().get(name) File "/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/distutils/sysconfig.py", line 491, in get_config_vars func() File "/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/distutils/sysconfig.py", line 360, in _init_posix parse_makefile(filename, g) File "/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/distutils/sysconfig.py", line 272, in parse_makefile line = fp.readline() File "/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/distutils/text_file.py", line 173, in readline line = self.file.readline() File "/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/io.py", line 1751, in readline decoder = self._decoder or self._get_decoder() File "/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/io.py", line 1501, in _get_decoder make_decoder = codecs.getincrementaldecoder(self._encoding) File "/usr/src/ports/python/python3.0/python3.0-3.0b3-1/src/Python-3.0b3/Lib/codecs.py", line 960, in getincrementaldecoder decoder = lookup(encoding).incrementaldecoder LookupError: unknown encoding: U make: *** [sharedmods] Error 1amauryfa commentedon Aug 27, 2008
See also bpo-3696, and the patch provided there.
Yaakov, you should remove the _locale.dll from your build directory: for
the compilation phase, better have no locale at all than a broken "U" as
default encoding ("U" is the initial of UTF8)
amauryfa commentedon Aug 27, 2008
cygwin has also a nasty bug:
printf("%ls", wide_string)
fails for strings of length 1. %S has the same problem.
The output stops at "./python", probably because stderr has an error
flag set.
Since %ls is only used in Modules/main.c, the best is probably to
replace it with something else. And since cygwin has no function of the
family of wprintf or fputws, PyUnicode is probably the way to go.
yselkowitz commentedon Aug 27, 2008
Thanks for your persistence with this.
Corinna got _wcsrtombs_r fixed in newlib, so I imagine the next Cygwin
1.7 preview will have the fix. Unfortunately that won't help the
still-stable Cygwin 1.5. I'm not sure what you mean by PyUnicode being
a workaround; if you could propose a patch, I'll be happy to try it.
yselkowitz commentedon Aug 27, 2008
Another thing: _bsddb does not compile with db4.7:
Modules/_bsddb.c: In function
DBSequence_get_cachesize': [Modules/_bsddb.c:5022](https://github.com/python/cpython/blob/main/Modules/_bsddb.c#L5022): warning: passing arg 2 of pointer to function from incompatible pointer type [Modules/_bsddb.c](https://github.com/python/cpython/blob/main/Modules/_bsddb.c): In functionDBEnv_db_home_get':Modules/_bsddb.c:5331: error: structure has no member named
db_home' [Modules/_bsddb.c:5334](https://github.com/python/cpython/blob/main/Modules/_bsddb.c#L5334): error: structure has no member nameddb_home'Modules/_bsddb.c: In function
PyInit__bsddb': [Modules/_bsddb.c:5948](https://github.com/python/cpython/blob/main/Modules/_bsddb.c#L5948): error:DB_LOG_AUTOREMOVE' undeclared (first usein this function)
Modules/_bsddb.c:5948: error: (Each undeclared identifier is reported
only once
Modules/_bsddb.c:5948: error: for each function it appears in.)
Modules/_bsddb.c:5949: error:
DB_DIRECT_LOG' undeclared (first use in this function) [Modules/_bsddb.c:5957](https://github.com/python/cpython/blob/main/Modules/_bsddb.c#L5957): error:DB_LOG_INMEMORY' undeclared (first use inthis function)
4.5 and 4.6 both give the first warning, but no errors.
pitrou commentedon Sep 3, 2008
The mbstowcs problem should be fixed in r66187. What is the state of the
other problems? Is this issue still a release blocker?
yselkowitz commentedon Sep 3, 2008
Thank you for the patch; that allows the build to finish. The remaining
issues are now:
msg72029: printf("%ls",...) bug
msg72044: does not build with db4.7
Finally proceeding to the install, now I get another error:
mkdir ./Lib/plat-cygwin
cp ./Lib/plat-generic/regen ./Lib/plat-cygwin/regen
export PATH; PATH="
pwd:$PATH";export PYTHONPATH; PYTHONPATH="
pwd/Lib";export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="
pwd";export EXE; EXE=".exe";
cd ./Lib/plat-cygwin; ./regen
python$EXE ../../Tools/scripts/h2py.py -i '(u_long)'
/usr/include/netinet/in.h
Could not find platform independent libraries
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to [:<exec_prefix>]
Fatal Python error: Py_Initialize: can't initialize sys standard streams
ImportError: No module named encodings.utf_8
./regen: line 3: 4164 Segmentation fault (core dumped) python$EXE
../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
make: *** [Lib/plat-cygwin] Error 139
5 remaining items
yselkowitz commentedon Sep 21, 2008
In that case, then I think this can be closed; if I encounter any
further issues after rc2, I'll open a new bug.
Thank you for all your help.
amauryfa commentedon Sep 21, 2008
Well, after the proposed patch "cygwin_badprintf.patch" is reviewed and
applied...
loewis commentedon Oct 17, 2008
I think cygwin_badprintf.patch needs to consider the case r==PATH_MAX;
this happens when the conversion would need more than PATH_MAX bytes for
the target buffer. In that case, I think it would be good enough to
write "<file name too long>" into cfilename (using cfilename as is will
crash because it's not null-terminated; forcefully null-terminating it
might break the shift state)
amauryfa commentedon Oct 17, 2008
Updated patch, which checks the return value of wcstombs.
loewis commentedon Oct 17, 2008
IIUC, another error return value (besides -1) is PATH_MAX, meaning that
the buffer would overrun; correct me if I'm wrong. If I'm not, I propose
that they get handles similarly.
In addition, it might be safer to compare to (size_t)-1 (I keep
forgetting whether this is the default when comparing signed and
unsigned - some compilers warn about comparisong with mixed signs).
pitrou commentedon Oct 18, 2008
The patch looks sound to me. Someone should probably test it under
Cygwin.
yselkowitz commentedon Oct 20, 2008
3.0rc1 builds and installs fine with the latest patch. Thanks!
tiran commentedon Oct 28, 2008
I can't reproduce the problem with my installation of Cygwin on Windows
XP. However the patch doesn't cause problems so you might apply it.
amauryfa commentedon Oct 30, 2008
Committed the "%ls" fix with r67064.