# Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory

4 messages from 2010-11-24 to 2010-11-24. Participants: Ilyas --, Nguyen Thai Ngoc Duy, Matthijs Kooijman.
Thread: https://gitlist.dev/t/25830

## Ilyas --, 2010-11-24 08:01

Subject: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
Message-ID: <AANLkTikfg9fLtqC6V3hQkiSZ+RfWqViJsHPxrt6ycoRR@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTikfg9fLtqC6V3hQkiSZ%2BRfWqViJsHPxrt6ycoRR%40mail.gmail.com

```
Hi!

The patch bellow for problem 'Versioning configuration files on a
server: fatal: Unable to create '//etc/.git/index.lock': No such file
or directory' works fine on FreeBSD/Linux.
Please fix this problem in upstream.

Thank you.


diff --git a/dir.c b/dir.c
index d1e5e5e..5408db9 100644
--- a/dir.c
+++ b/dir.c
@@ -943,6 +943,7 @@ int file_exists(const char *f)


 char *get_relative_cwd(char *buffer, int size, const char *dir)

 {
        char *cwd = buffer;
+       size_t len, root_len;

        if (!dir)
                return NULL;
@@ -952,6 +953,15 @@ char *get_relative_cwd(char *buffer, int size,
const char *dir)

        if (!is_absolute_path(dir))


                dir = make_absolute_path(dir);

+       len = strlen(dir);
+       root_len = offset_1st_component(dir);
+
+       if (root_len >= len) {

+           /* dir is the filesystem root, so the cwd is always inside */


+           root_len = offset_1st_component(cwd);
+           return cwd + root_len;
+       }
+
        while (*dir && *dir == *cwd) {

                dir++;
                cwd++;

```

## Nguyen Thai Ngoc Duy, 2010-11-24 08:45

Subject: Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
Message-ID: <AANLkTim_sPyVGK3XWEVseseRzcmNM-YS=aFSWZeBiB7n@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTim_sPyVGK3XWEVseseRzcmNM-YS%3DaFSWZeBiB7n%40mail.gmail.com
In-Reply-To: <AANLkTikfg9fLtqC6V3hQkiSZ+RfWqViJsHPxrt6ycoRR@mail.gmail.com>

```
On Wed, Nov 24, 2010 at 3:01 PM, Ilyas -- <umask00@gmail.com> wrote:
> Hi!
>
> The patch bellow for problem 'Versioning configuration files on a
> server: fatal: Unable to create '//etc/.git/index.lock': No such file
> or directory' works fine on FreeBSD/Linux.
> Please fix this problem in upstream.

I also have another patch to fix this [1]. Hopefully Junio will pick it up soon.

[1] http://article.gmane.org/gmane.comp.version-control.git/161825
-- 
Duy

```

## Matthijs Kooijman, 2010-11-24 08:50

Subject: Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
Message-ID: <20101124085030.GB22067@login.drsnuggles.stderr.nl>
URL: https://gitlist.dev/e/20101124085030.GB22067%40login.drsnuggles.stderr.nl
In-Reply-To: <AANLkTim_sPyVGK3XWEVseseRzcmNM-YS=aFSWZeBiB7n@mail.gmail.com>

```
Hi folks,

On Wed, Nov 24, 2010 at 03:45:43PM +0700, Nguyen Thai Ngoc Duy wrote:
> On Wed, Nov 24, 2010 at 3:01 PM, Ilyas -- <umask00@gmail.com> wrote:
> > The patch bellow for problem 'Versioning configuration files on a
> > server: fatal: Unable to create '//etc/.git/index.lock': No such file
> > or directory' works fine on FreeBSD/Linux.
> > Please fix this problem in upstream.
> 
> I also have another patch to fix this [1]. Hopefully Junio will pick it up soon.
The patch sent by Ilyas is mine and it was just a quick hack. Please use
the patch sent later by Nguyen instead, it solves the problem properly:

> [1] http://article.gmane.org/gmane.comp.version-control.git/161825

```

## Ilyas --, 2010-11-24 09:46

Subject: Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
Message-ID: <AANLkTinpwM=3P0Zz-t_j1sh=7s8h6mh-oiymuxdU9HL_@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTinpwM%3D3P0Zz-t_j1sh%3D7s8h6mh-oiymuxdU9HL_%40mail.gmail.com
In-Reply-To: <20101124085030.GB22067@login.drsnuggles.stderr.nl>

```
Yes, patch which I sent provided by Matthijs Kooijman in other thread
(with the same subject).

We use git on many servers for track configs and when we get troubles
with /.git we was really stressed.



I hope that this issue will be fixed in upstream soon.


Thank you.


On Wed, Nov 24, 2010 at 11:50 AM,  <matthijs@stdin.nl> wrote:
> Hi folks,
>
> On Wed, Nov 24, 2010 at 03:45:43PM +0700, Nguyen Thai Ngoc Duy wrote:
>> On Wed, Nov 24, 2010 at 3:01 PM, Ilyas -- <umask00@gmail.com> wrote:
>> > The patch bellow for problem 'Versioning configuration files on a
>> > server: fatal: Unable to create '//etc/.git/index.lock': No such file
>> > or directory' works fine on FreeBSD/Linux.
>> > Please fix this problem in upstream.
>>
>> I also have another patch to fix this [1]. Hopefully Junio will pick it up soon.
> The patch sent by Ilyas is mine and it was just a quick hack. Please use
> the patch sent later by Nguyen instead, it solves the problem properly:
>
>> [1] http://article.gmane.org/gmane.comp.version-control.git/161825
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkzs0dYACgkQz0nQ5oovr7xKwQCgqd/l6cuub7zXlnbepYCDRwEW
> i88AniNyZFrWeYS5gNlKJfEnENo6ml2p
> =uRWs
> -----END PGP SIGNATURE-----
>
>

```
