win32lfn support in Kallithea for Windows installations

Issue #258 resolved
Brandon Jones created an issue

With our client installations we have the win32lfn extension installed on all client machines using TortoiseHG in Windows. This allows us to avoid the "long filename" limitation of Windows. It doesn't come up often, but it's there from time to time.

Here is the extension we use: https://bitbucket.org/remleduff/win32lfn

This works fine on our client machines, but the internal version of Mercurial that Kallithea uses does not know about this extension and does not use it.

I forced the internal Mercurial version of Kallithea to use win32lfn but I got errors when I tried to create a repo group. I'm sure given the nature of the extension that this would occur in more than one place. Here is the error I got.

2016-12-06 15:31:57.694 ERROR [kallithea.controllers.api.api] Traceback (most recent call last):
  File "c:\kallithea\env\lib\site-packages\kallithea\controllers\api\api.py", line 2099, in create_repo_group
    copy_permissions=copy_permissions
  File "c:\kallithea\env\lib\site-packages\kallithea\model\repo_group.py", line 189, in create
    self._create_group(new_repo_group.group_name)
  File "c:\kallithea\env\lib\site-packages\kallithea\model\repo_group.py", line 95, in _create_group
    os.makedirs(create_path)
  File "c:\kallithea\env\lib\os.py", line 157, in makedirs
    mkdir(name, mode)
  File "c:\kallithea\env\scripts\win32lfn.py", line 193, in lfnmkdir
    pyerrno = _errmap[error]
KeyError: 5L 

I think it would be quite valuable if Kallithea could make use of this extension to handle support for long file names in Windows.

Comments (5)

  1. Mads Kiilerich

    That extension is for handling long filenames in the working directory on the client side. Why do you need it on the server?

    Also, instead of adding workarounds and "support" for this extension in projects around Mercurial, it would be much better if the extension could be polished and upstreamed. That would be much better use of the resources.

    Anyway: The actual error seems to be a problem inside win32lfn. For some error they have some internal mapping of error codes, and they got an error code they can't handle. The extension is also fragile in the way it crashes in such situations and hides the real problem.

  2. Brandon Jones reporter

    Our Kallithea server installation is on Windows as well, so it still falls victim to the long file names issue. Even though I'm not updating the working directory on the server, the internal .hg folder is containing files that are too long for Windows to play nicely with.

    A user can have the long files on their machine but when they go to push the server throws an error.

  3. Mads Kiilerich

    The Mercurial repo storage format will make sure that .hg store long file names with shorter names (in .hg/store/dh/ ). That seems to contradict your experience. The actual error can perhaps tell.

  4. Brandon Jones reporter

    To be fair, we are in the process of migrating to Kallithea from RhodeCode 1.5.3 right now, which is what originally exhibited the issue.

    We are making this migration soon, and once we do I can try to create a repository with long files within it to try and recreate the error, so that it might be more useful in determining the issue.

  5. Log in to comment