threads / discuss / 2962

Strange unable to unlink error with git-prune-packed

Subject: Strange unable to unlink error with git-prune-packed

## tl;dr

3 messages between Jan 4, 2006 and Jan 4, 2006.

replies: 2people: 2as markdown or json

Martin Langhoff· Jan 4, 2006, 04:46 UTC · lore

Weilding a recent git version 1.0.6-g58e3 it turns out I cannot run git-prune-packed on a simple repo on my OSX (Panther 10.3.9). The local repo looks fine in my eyes, and permissions are similar to those on Linux. Relaxing permissions doesn't help either, so there may be something else afoot.

When I invoke git-prune-packed I am greeted by (3-line sample):

error: unable to unlink .git/objects/43/2251e8488dc3c72d94d698ed69003137c47244 error: unable to unlink .git/objects/43/6bc8b274ab96944a6f8c3cf5e3fbeef422042b error: unable to unlink .git/objects/43/fe47e9508289ad4eca71613a9f20d7f3323602

File modes after I ran chmod -R u+w .git/objects to see if prune-packed was taking the mode too seriously on OSX

$ ls -la .git/objects/43 total 24 drwxr-xr-x 5 martin martin 170 4 Jan 17:37 . drwxr-xr-x 229 martin martin 7786 4 Jan 17:37 .. -rw-r--r-- 1 martin martin 211 30 Dec 11:21 2251e8488dc3c72d94d698ed69003137c47244 -rw-r--r-- 1 martin martin 53 30 Dec 11:21 6bc8b274ab96944a6f8c3cf5e3fbeef422042b -rw-r--r-- 1 martin martin 152 30 Dec 11:21 fe47e9508289ad4eca71613a9f20d7f3323602

This is low priority for me, and so weird that it has to be a pilot error -- OTOH I may do a bisect to try and figure out whether it's a recent change...

cheers,
martin
Linus Torvalds· Jan 4, 2006, 16:34 UTC · re: Martin Langhoff · lore

Re: Strange unable to unlink error with git-prune-packed

On Wed, 4 Jan 2006, Martin Langhoff wrote:
Show 6 quoted lines
> 
> When I invoke git-prune-packed I am greeted by (3-line sample):
> 
> error: unable to unlink .git/objects/43/2251e8488dc3c72d94d698ed69003137c47244
> error: unable to unlink .git/objects/43/6bc8b274ab96944a6f8c3cf5e3fbeef422042b
> error: unable to unlink .git/objects/43/fe47e9508289ad4eca71613a9f20d7f3323602

Does it happen for all your files? All your repositories? Or just one repo? Or just one subdirectory in that repo?

The code is _literally_ just doing a
	if (unlink(pathname) < 0)
		error("unable to unlink %s", pathname);

but maybe you could just make it print out the reason too. So add a "(%s)" and a "strerror(errno)" to that error line..

> $ ls -la .git/objects/43
> total 24
> drwxr-xr-x    5 martin  martin   170  4 Jan 17:37 .

I don't see why you couldn't unlink those files. Maybe it's some strange HFS issue and you can't just unlink() things that have attributes or something? Maybe some crazy file manager has added a default icon attribute to your files if you happened to look at the .git objects directory?

		Linus
Martin Langhoff· Jan 4, 2006, 22:10 UTC · re: Linus Torvalds · lore

Re: Strange unable to unlink error with git-prune-packed

On 1/5/06, Linus Torvalds <torvalds@osdl.org> wrote:
> Does it happen for all your files? All your repositories? Or just one
> repo?

Good questions -- should have sorted those basic things out before posting. Apologies. In any case, I haven't seen that before, but I don't run git-prune-packed that often on the OSX commandline. My main dev host is a linux machine, and I have a weekly cron that does repack and prune packed on all my repos.

> Or just one subdirectory in that repo?
It refused to unlink _any_ files within .git/objects
Show 7 quoted lines
> The code is _literally_ just doing a
>
>         if (unlink(pathname) < 0)
>                 error("unable to unlink %s", pathname);
>
> but maybe you could just make it print out the reason too. So add a "(%s)"
> and a "strerror(errno)" to that error line..

This morning, after a reboot, I patched prune-packed.c as suggested and ran it... and it all worked.

Initially I suspected the files were locked somehow, but I just did a new clone && git-repack && git-prune-packed and it just worked... Grrr.

Show 5 quoted lines
> I don't see why you couldn't unlink those files. Maybe it's some strange
> HFS issue and you can't just unlink() things that have attributes or
> something? Maybe some crazy file manager has added a default icon
> attribute to your files if you happened to look at the .git objects
> directory?

It is indeed HFS but I'm pretty sure things should be transparent to the unix side of things. In any case, the (crazy filemanager) Finder wasn't involved, as this is a newish repo, I haven't looked at any directory around it with Finder, and it's known to leave hidden files all over the place.

In any case, I've got my git-prune-packed patched now, and will be trying to repro the bug.

cheers,
martin

← back to recent threads