Uploaded image for project: 'FishEye'
  1. FishEye
  2. FE-3686

Cloning fails with ANSI characters in paths (Windows only)

    XMLWordPrintable

Details

    Description

      GitServlet has issues with ProcessUtils special treatment of processes on Windows platforms, so we've disabled it for the moment. The "special" treatment worked around some code page issues on Windows, but was failing for us.

      The javadoc on ExternalProcessImpl#createWinProcess goes into more detail:

      /*
            * This method provides a workaround for a JVM bug on windows (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4947220). The bug
            * is that the Sun/Oracle JVM uses the (8 bit) OEM codepage for encoding commandline arguments that are passed to an external process.  Any
            * characters in a command line argument that can't be represented in the OEM codepage will be replaced by the '?' character, which will probably
            * cause the command that's being called to fail.
            *
            * A bit of background information is helpful to understand what's going on. Windows uses 2 code pages: the OEM code page and the ANSI code page
            * (or 'Windows code page'). The OEM code page is always limited to 8 bit character encodings, whereas some windows code pages are 8 bit and some
            * are larger. The OEM code page is typically used for console applications, whereas the windows code pages are used for native non-Unicode application
            * using a GUI on Windows systems.  The system-wide settings can be found in the windows registry:
            *
            *
            * More info about the history of OEM vs ANSI code pages: http://blogs.msdn.com/b/michkap/archive/2005/02/08/369197.aspx
            *
            * The workaround is to store the command-line arguments in environment variables and refer to the environment vars on the command line. Windows
            * cmd will expand the command line arguments without using to the OEM code page, which usually has more correlation with the locale of the
            * producer of the hardware (it's derived from the BIOS code page) than with the regional settings configured in Windows. The ANSI code page is derived from
            * the regional settings.
            *
            * When cmd expands the %JENV_XXX% vars on the command line it uses the ANSI code page instead of the OEM code page (or that is what testing
            * seems to indicate, can't find any definitive answer in the cmd docos). While this still isn't a true fix to the problem, for most situations this will be sufficient
            * as the user typically won't use characters that aren't defined for his locale. But then again, they might..
           */
          private Process createWinProcess(String[] cmdArray, String[] environment, File workingDir) throws IOException
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            tim@atlassian.com TimP
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: