Skip to content

python3.0 interpreter on Cygwin ignores all arguments #47876

Closed

Description

@yselkowitz
BPO 3626
Nosy @loewis, @amauryfa, @pitrou, @tiran
Files
  • cygwin-mbstowcs.patch
  • cygwin_badprintf.patch
  • cygwin_badprintf-2.patch
  • 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:

    assignee = None
    closed_at = <Date 2008-10-30.23:03:58.824>
    created_at = <Date 2008-08-21.04:36:00.252>
    labels = ['interpreter-core', 'type-bug', 'release-blocker']
    title = 'python3.0 interpreter on Cygwin ignores all arguments'
    updated_at = <Date 2008-10-30.23:03:58.729>
    user = 'https://bugs.python.org/yselkowitz'

    bugs.python.org fields:

    activity = <Date 2008-10-30.23:03:58.729>
    actor = 'amaury.forgeotdarc'
    assignee = 'none'
    closed = True
    closed_date = <Date 2008-10-30.23:03:58.824>
    closer = 'amaury.forgeotdarc'
    components = ['Interpreter Core']
    creation = <Date 2008-08-21.04:36:00.252>
    creator = 'yselkowitz'
    dependencies = []
    files = ['11186', '11534', '11823']
    hgrepos = []
    issue_num = 3626
    keywords = ['patch']
    message_count = 22.0
    messages = ['71606', '71617', '71690', '72020', '72029', '72042', '72044', '72413', '72415', '73474', '73475', '73479', '73519', '73520', '73522', '74905', '74937', '74942', '74960', '74993', '75280', '75398']
    nosy_count = 5.0
    nosy_names = ['loewis', 'amaury.forgeotdarc', 'pitrou', 'christian.heimes', 'yselkowitz']
    pr_nums = []
    priority = 'release blocker'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue3626'
    versions = ['Python 3.0']

    Activity

    1. yselkowitz commented on Aug 21, 2008

      yselkowitzmannequin
      MannequinAuthor

      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:

      $ /usr/bin/python --version
      Python 2.5.2
      
      $ /usr/bin/python -c 'print "Hello, World!"'
      Hello, World!

      $ ./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.

    2. added
      interpreter-core(Objects, Python, Grammar, and Parser dirs)
      type-bugAn unexpected behavior, bug, or error
      on Aug 21, 2008
    3. amauryfa commented on Aug 21, 2008

      @amauryfa
      Contributor

      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.

    4. yselkowitz commented on Aug 21, 2008

      yselkowitzmannequin
      MannequinAuthor

      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 1
    5. amauryfa commented on Aug 27, 2008

      @amauryfa
      Contributor

      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)

    6. amauryfa commented on Aug 27, 2008

      @amauryfa
      Contributor

      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.

    7. yselkowitz commented on Aug 27, 2008

      yselkowitzmannequin
      MannequinAuthor

      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.

    8. yselkowitz commented on Aug 27, 2008

      yselkowitzmannequin
      MannequinAuthor

      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.

    9. pitrou commented on Sep 3, 2008

      @pitrou
      Member

      The mbstowcs problem should be fixed in r66187. What is the state of the
      other problems? Is this issue still a release blocker?

    10. yselkowitz commented on Sep 3, 2008

      yselkowitzmannequin
      MannequinAuthor

      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

    11. 5 remaining items

    12. yselkowitz commented on Sep 21, 2008

      yselkowitzmannequin
      MannequinAuthor

      The IDLE problem is already corrected: see bpo-3628.

      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.

    13. amauryfa commented on Sep 21, 2008

      @amauryfa
      Contributor

      I think this can be closed

      Well, after the proposed patch "cygwin_badprintf.patch" is reviewed and
      applied...

    14. loewis commented on Oct 17, 2008

      loewismannequin
      Mannequin

      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)

    15. amauryfa commented on Oct 17, 2008

      @amauryfa
      Contributor

      Updated patch, which checks the return value of wcstombs.

    16. loewis commented on Oct 17, 2008

      loewismannequin
      Mannequin

      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).

    17. pitrou commented on Oct 18, 2008

      @pitrou
      Member

      The patch looks sound to me. Someone should probably test it under
      Cygwin.

    18. yselkowitz commented on Oct 20, 2008

      yselkowitzmannequin
      MannequinAuthor

      3.0rc1 builds and installs fine with the latest patch. Thanks!

    19. tiran commented on Oct 28, 2008

      @tiran
      Member

      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.

    20. amauryfa commented on Oct 30, 2008

      @amauryfa
      Contributor

      Committed the "%ls" fix with r67064.

    21. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      interpreter-core(Objects, Python, Grammar, and Parser dirs)release-blockertype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions