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

Re: Unable to index file

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Dec 12, 2008, 18:07 UTC
Message-ID
<alpine.LFD.2.00.0812120956050.3340@localhost.localdomain>
In-Reply-To
<f25d5ad20812120647m646698d7t9849c8ccb08c465e@mail.gmail.com>
On Fri, 12 Dec 2008, Ramon Tayag wrote:
Show 12 quoted lines
> 
> I've come across a problem that I don't believe lies in Rails.  You
> needn't be familiar, I think, with Rails to see what's wrong.
> 
> I can't seem to add the files that are in
> http://dev.rubyonrails.org/archive/rails_edge.zip
> 
> 1) Unpack the zip
> 2) Initialize a git repo inside the folder that was unpacked
> 3) git add .
> 
> See the errors.. :o http://pastie.org/337571
What platform/filesystem is this?

Git is rather particular about symlinks, and it looks like your platform does something odd, and that makes git unhappy about your symlink.

In particular:
	ls -l vendor/rails/actionpack/test/fixtures/layout_tests/layouts/ 
	...
	lrwxrwxrwx 1 root root 48 2008-12-12 18:22 symlinked -> ../../symlink_parent

notice how the symlink content is "../../symlink_parent", but then take a look at the _size_ of the symlink: 48 bytes.

Git expects the lstat() information to match the return from readlink(), and it doesn't.

For exact details, see "index_path()" in sha1_file.c:
        case S_IFLNK:   
                len = xsize_t(st->st_size);
                target = xmalloc(len + 1);
                if (readlink(path, target, len + 1) != st->st_size) {
                        char *errstr = strerror(errno);

ie we consider it an error if we get less than st_size characters back from readlink().

Now, admittedly git is probably being really annoyingly anal about this all, and we probably should loosen the restrictions on it a bit, but I'd like to know why it happens. I cannot recall this having been reported before, so it's some specific filesystem or OS that causes this, I think.

		Linus
Previous: Ramon TayagNext: Linus Torvalds
Message 2 of 5 in “Unable to index file”
  1. Ramon TayagDec 12, 2008
  2. Linus TorvaldsDec 12, 2008
  3. Linus TorvaldsDec 12, 2008
  4. Ramon TayagDec 12, 2008
  5. Linus TorvaldsDec 12, 2008

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.