* Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
@ 2010-11-17 6:24 Albert Strasheim
2010-11-17 11:20 ` Matthijs Kooijman
0 siblings, 1 reply; 12+ messages in thread
From: Albert Strasheim @ 2010-11-17 6:24 UTC (permalink / raw)
To: git
Hello all
I'm trying to use git to version all the configuration files on a server:
su
cd /
git init
cd /
touch k
git add k #this works
cd /etc
git add hosts
This fails with:
fatal: Unable to create '//etc/.git/index.lock': No such file or directory
I'm running git-1.7.3.2-1.fc14.x86_64.
Is there any way to convince git to work in this scenario?
Regards
Albert
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
2010-11-17 6:24 Albert Strasheim
@ 2010-11-17 11:20 ` Matthijs Kooijman
2010-11-18 15:52 ` Matthijs Kooijman
0 siblings, 1 reply; 12+ messages in thread
From: Matthijs Kooijman @ 2010-11-17 11:20 UTC (permalink / raw)
To: Albert Strasheim; +Cc: git
[-- Attachment #1: Type: text/plain, Size: 626 bytes --]
Hey,
> su
> cd /
> git init
I've been using git for exactly this purpose succesfully for a while now
(git 1.5.6.5 from Debian stable and I think also 1.7.2.3 from Debian
testing). The only problem I've found was that, with the former version,
a lot of operations need to happen while the current dir is /, otherwise
it wouldn't find the git repository properly (or do other weird stuff).
This problem was gone in the latter version.
> fatal: Unable to create '//etc/.git/index.lock': No such file or directory
This sounds like git assumes /etc/.git exists, but it really doesn't.
Not sure why that happens.
Gr.
Matthijs
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
2010-11-17 11:20 ` Matthijs Kooijman
@ 2010-11-18 15:52 ` Matthijs Kooijman
2010-11-18 16:00 ` Santi Béjar
2010-11-18 16:07 ` Nguyen Thai Ngoc Duy
0 siblings, 2 replies; 12+ messages in thread
From: Matthijs Kooijman @ 2010-11-18 15:52 UTC (permalink / raw)
To: Albert Strasheim, git
[-- Attachment #1: Type: text/plain, Size: 724 bytes --]
Hi all,
> I've been using git for exactly this purpose succesfully for a while now
> (git 1.5.6.5 from Debian stable and I think also 1.7.2.3 from Debian
> testing).
Coming back to the testing machine I was using this on, I see this
problem as well now. I'm pretty sure it wasn't there before, which would
mean it was introduced by a recent upgrade.
Checking the logs shows that I was running 1.7.1 before, and now 1.7.2.3
is broken. Downgrading to 1.7.1 indeed removes the problem.
I've rummaged around in the source a bit, haven't found the cause yet
(and I'm out of time now).
The issue also still occurs with a fairly recent git master (ca209065f:
completion: fix zsh check under bash with 'set -u').
Gr.
Matthijs
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
2010-11-18 15:52 ` Matthijs Kooijman
@ 2010-11-18 16:00 ` Santi Béjar
2010-11-18 16:07 ` Nguyen Thai Ngoc Duy
1 sibling, 0 replies; 12+ messages in thread
From: Santi Béjar @ 2010-11-18 16:00 UTC (permalink / raw)
To: Albert Strasheim, git
On Thu, Nov 18, 2010 at 4:52 PM, Matthijs Kooijman <matthijs@stdin.nl> wrote:
> Hi all,
>
>> I've been using git for exactly this purpose succesfully for a while now
>> (git 1.5.6.5 from Debian stable and I think also 1.7.2.3 from Debian
>> testing).
> Coming back to the testing machine I was using this on, I see this
> problem as well now. I'm pretty sure it wasn't there before, which would
> mean it was introduced by a recent upgrade.
>
> Checking the logs shows that I was running 1.7.1 before, and now 1.7.2.3
> is broken. Downgrading to 1.7.1 indeed removes the problem.
>
> I've rummaged around in the source a bit, haven't found the cause yet
> (and I'm out of time now).
Alternatively, you could try to bisect, with "git bisect", between
these two commits, 1.7.2.3=bad and 1.7.1=good. It is roughly 10 steps.
HTH,
Santi
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
2010-11-18 15:52 ` Matthijs Kooijman
2010-11-18 16:00 ` Santi Béjar
@ 2010-11-18 16:07 ` Nguyen Thai Ngoc Duy
2010-11-18 16:26 ` Nguyen Thai Ngoc Duy
1 sibling, 1 reply; 12+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2010-11-18 16:07 UTC (permalink / raw)
To: Albert Strasheim, git
On Thu, Nov 18, 2010 at 10:52 PM, Matthijs Kooijman <matthijs@stdin.nl> wrote:
> Hi all,
>
>> I've been using git for exactly this purpose succesfully for a while now
>> (git 1.5.6.5 from Debian stable and I think also 1.7.2.3 from Debian
>> testing).
> Coming back to the testing machine I was using this on, I see this
> problem as well now. I'm pretty sure it wasn't there before, which would
> mean it was introduced by a recent upgrade.
>
> Checking the logs shows that I was running 1.7.1 before, and now 1.7.2.3
> is broken. Downgrading to 1.7.1 indeed removes the problem.
>
> I've rummaged around in the source a bit, haven't found the cause yet
> (and I'm out of time now).
>
> The issue also still occurs with a fairly recent git master (ca209065f:
> completion: fix zsh check under bash with 'set -u').
You may be interested in 72ec8ba (Support working directory located at
root - 2010-02-14). t1509 reports the breakages. Unfortunately this
kind of tests can't be run automatically
--
Duy
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
2010-11-18 16:07 ` Nguyen Thai Ngoc Duy
@ 2010-11-18 16:26 ` Nguyen Thai Ngoc Duy
2010-11-18 17:17 ` Matthijs Kooijman
0 siblings, 1 reply; 12+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2010-11-18 16:26 UTC (permalink / raw)
To: Albert Strasheim, git, Clemens Buchacher, Matthijs Kooijman
On Thu, Nov 18, 2010 at 11:07 PM, Nguyen Thai Ngoc Duy
<pclouds@gmail.com> wrote:
> On Thu, Nov 18, 2010 at 10:52 PM, Matthijs Kooijman <matthijs@stdin.nl> wrote:
>> Hi all,
>>
>>> I've been using git for exactly this purpose succesfully for a while now
>>> (git 1.5.6.5 from Debian stable and I think also 1.7.2.3 from Debian
>>> testing).
>> Coming back to the testing machine I was using this on, I see this
>> problem as well now. I'm pretty sure it wasn't there before, which would
>> mean it was introduced by a recent upgrade.
>>
>> Checking the logs shows that I was running 1.7.1 before, and now 1.7.2.3
>> is broken. Downgrading to 1.7.1 indeed removes the problem.
>>
>> I've rummaged around in the source a bit, haven't found the cause yet
>> (and I'm out of time now).
>>
>> The issue also still occurs with a fairly recent git master (ca209065f:
>> completion: fix zsh check under bash with 'set -u').
>
> You may be interested in 72ec8ba (Support working directory located at
> root - 2010-02-14). t1509 reports the breakages. Unfortunately this
> kind of tests can't be run automatically
I think 490544b (get_cwd_relative(): do not misinterpret suffix as
subdirectory - 2010-05-22) causes it. Haven't fully understood what's
going on in that function though :P
Will look again tomorrow, if nobody beats me to it.
--
Duy
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
2010-11-18 16:26 ` Nguyen Thai Ngoc Duy
@ 2010-11-18 17:17 ` Matthijs Kooijman
2010-11-18 20:36 ` Matthijs Kooijman
0 siblings, 1 reply; 12+ messages in thread
From: Matthijs Kooijman @ 2010-11-18 17:17 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: Albert Strasheim, git, Clemens Buchacher
[-- Attachment #1: Type: text/plain, Size: 540 bytes --]
Hi Nguyen,
> I think 490544b (get_cwd_relative(): do not misinterpret suffix as
> subdirectory - 2010-05-22) causes it. Haven't fully understood what's
> going on in that function though :P
Seems you're right. I just reverted this commit and the problem seems to
go away.
In case you're investigation, here's the relevant call to
get_cwd_relative in this case is:
Breakpoint 3, get_relative_cwd (buffer=0x756e20 "", size=4096, dir=0x764040 "/") at dir.c:944
Not sure what the return value is, that one got optimized out.
Gr.
Matthijs
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
2010-11-18 17:17 ` Matthijs Kooijman
@ 2010-11-18 20:36 ` Matthijs Kooijman
0 siblings, 0 replies; 12+ messages in thread
From: Matthijs Kooijman @ 2010-11-18 20:36 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy, Albert Strasheim, git, Clemens Buchacher
[-- Attachment #1: Type: text/plain, Size: 2700 bytes --]
Hi folks,
> > I think 490544b (get_cwd_relative(): do not misinterpret suffix as
> > subdirectory - 2010-05-22) causes it. Haven't fully understood what's
> > going on in that function though :P
> Seems you're right. I just reverted this commit and the problem seems to
> go away.
A bit more gdb'ing with -O0, I found the following. get_cwd_relative is
called with dir="/". The cwd is "/etc". The stack looks like:
#0 get_relative_cwd (buffer=0x7a44c0 "/etc", size=4096, dir=0x7b1041 "") at dir.c:961
#1 0x00000000004dfdf1 in setup_git_directory () at setup.c:612
#2 0x0000000000404f69 in run_builtin (p=0x75ea10, argc=2, argv=0x7fffffffc918) at git.c:257
#3 0x00000000004051e3 in handle_internal_command (argc=2, argv=0x7fffffffc918) at git.c:431
#4 0x000000000040538a in main (argc=2, argv=0x7fffffffc918) at git.c:516
After the following code runs:
while (*dir && *dir == *cwd) {
dir++;
cwd++;
}
I have dir="" and cwd="etc". Then the following code runs:
switch (*cwd) {
case '\0':
return cwd;
case '/':
return cwd + 1;
default:
return NULL;
}
Since *cwd='e', it returns NULL.
The old code (before 490544b) was:
if (*cwd == '/')
return cwd + 1;
return cwd;
So this would return "etc".
So, that's what is happens. I think this happens because
get_relative_cwd expects dir to not contain a trailing slash. Normally,
there is no trailing slash, but in the special case of dir="/" there is
(sort of) a trailing slash.
I'm not completely sure how to fix this. Looking at 72ec8ba (Support
working directory located at root - 2010-02-14), perhaps something like
this?
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++;
I'm not sure how this stuff really works, though. I think this works for *nix,
but I'm unsure about Windows.
Gr.
Matthijs
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
@ 2010-11-24 8:01 Ilyas --
2010-11-24 8:45 ` Nguyen Thai Ngoc Duy
0 siblings, 1 reply; 12+ messages in thread
From: Ilyas -- @ 2010-11-24 8:01 UTC (permalink / raw)
To: git
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++;
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
2010-11-24 8:01 Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory Ilyas --
@ 2010-11-24 8:45 ` Nguyen Thai Ngoc Duy
2010-11-24 8:50 ` Matthijs Kooijman
0 siblings, 1 reply; 12+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2010-11-24 8:45 UTC (permalink / raw)
To: Ilyas --; +Cc: git
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
2010-11-24 8:45 ` Nguyen Thai Ngoc Duy
@ 2010-11-24 8:50 ` Matthijs Kooijman
2010-11-24 9:46 ` Ilyas --
0 siblings, 1 reply; 12+ messages in thread
From: Matthijs Kooijman @ 2010-11-24 8:50 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy; +Cc: Ilyas --, git
[-- Attachment #1: Type: text/plain, Size: 699 bytes --]
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
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory
2010-11-24 8:50 ` Matthijs Kooijman
@ 2010-11-24 9:46 ` Ilyas --
0 siblings, 0 replies; 12+ messages in thread
From: Ilyas -- @ 2010-11-24 9:46 UTC (permalink / raw)
To: Nguyen Thai Ngoc Duy, Ilyas --, git
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-----
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2010-11-24 9:46 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-24 8:01 Versioning configuration files on a server: fatal: Unable to create '//etc/.git/index.lock': No such file or directory Ilyas --
2010-11-24 8:45 ` Nguyen Thai Ngoc Duy
2010-11-24 8:50 ` Matthijs Kooijman
2010-11-24 9:46 ` Ilyas --
-- strict thread matches above, loose matches on Subject: below --
2010-11-17 6:24 Albert Strasheim
2010-11-17 11:20 ` Matthijs Kooijman
2010-11-18 15:52 ` Matthijs Kooijman
2010-11-18 16:00 ` Santi Béjar
2010-11-18 16:07 ` Nguyen Thai Ngoc Duy
2010-11-18 16:26 ` Nguyen Thai Ngoc Duy
2010-11-18 17:17 ` Matthijs Kooijman
2010-11-18 20:36 ` Matthijs Kooijman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).