git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Problem pushing to a Novell share

From
RKRüdiger Kessel <ruediger.kessel@gmail.com>
Date
Feb 2, 2012, 22:54 UTC
Message-ID
<CAJ4nRM0-3GWN=OYOXDdGtktU0mc8mhcoKqbo=U4Jm5AmSbPAyQ@mail.gmail.com>
Hi

a push to an .git-repository on a Novell network-share using msysgit fails with the following error message:

error: unable to create temporary sha1 filename : File exists
The problem has been found in git version 1.7.9

The problem is caused by a non-existing sub-directory in the file path which is not automatically created on Novell shares.

A quick fix is to improve the create_tmpfile() function in sha1_file.c:
static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename)
{
    static struct stat sb;
    int fd, dirlen = directory_size(filename);
    if (dirlen + 20 > bufsiz) {
        errno = ENAMETOOLONG;
        return -1;
    }
    memcpy(buffer, filename, dirlen);
    buffer[dirlen-1] = 0;
    if (stat(buffer, &sb) != 0 && errno == ENOENT) {
        if (mkdir(buffer, 0777) || adjust_shared_perm(buffer))
            return -1;
    }
    memcpy(buffer, filename, dirlen);
    strcpy(buffer + dirlen, "tmp_obj_XXXXXX");
    fd = git_mkstemp_mode(buffer, 0444);
    return fd;
}

The function will create one missing directory level if it does not exist prior to creating the tmp-file.

This method seems to work, but it works only if one directory level is missing which might not be the case in general. A better solution would be to create the whole directory tree if needed.

The best solution would be if MINGW would handle this issue.

I recommend including this patch into GIT since it does no harm on posix systems but it improves compatibility on others.

Rüdiger
Next: Junio C Hamano
Message 1 of 4 in “Problem pushing to a Novell share”
  1. Rüdiger KesselFeb 2, 2012
  2. Junio C HamanoFeb 2, 2012
  3. Junio C HamanoFeb 3, 2012
  4. Junio C HamanoFeb 3, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.