{"thread":{"id":"22611","subject":"Problem adding a symlinkg","startedAt":"2010-02-11T06:17:40Z","lastAt":"2010-02-21T22:20:29Z","messageCount":4,"participants":["Arnaud Bailly","Alex Riesen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"134206","messageId":"1265869060330-4553010.post@n2.nabble.com","threadId":"22611","inReplyTo":null,"subject":"Problem adding a symlinkg","fromName":"Arnaud Bailly","fromEmail":"abailly@oqube.com","sentAt":"2010-02-11T06:17:40Z","receivedAt":"2010-02-11T06:17:40Z","isPatch":false,"sender":{"key":"abailly@oqube.com","avatar":null},"body":"\nHello,\nI am trying to add some symlink to git and got the following error:\n\nerror: readlink(\"protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so\"): Invalid\nargument\nerror: unable to index file protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so\nfatal: adding files failed\n\nI thought it was possible to add symlinks to git. What  am I doing wrong ?\n\nTHanks for your help\nArnaud\n-- \nView this message in context: http://n2.nabble.com/Problem-adding-a-symlinkg-tp4553010p4553010.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"134218","messageId":"81b0412b1002110401mc77bd68w28034ca0e7fc537@mail.gmail.com","threadId":"22611","inReplyTo":"1265869060330-4553010.post@n2.nabble.com","subject":"Re: Problem adding a symlinkg","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2010-02-11T12:01:59Z","receivedAt":"2010-02-11T12:01:59Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On Thu, Feb 11, 2010 at 07:17, Arnaud Bailly <abailly@oqube.com> wrote:\n>\n> I am trying to add some symlink to git and got the following error:\n>\n> error: readlink(\"protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so\"): Invalid argument\n\nIs the file in fact a symlink? Maybe it was replaced by a file while\nGit was adding it?\nIf it is reproducable, could you strace \"git add\" and post the trace here?\n"},{"id":"135151","messageId":"854olcqlim.fsf@oqube.com","threadId":"22611","inReplyTo":"81b0412b1002110401mc77bd68w28034ca0e7fc537@mail.gmail.com","subject":"Re: Problem adding a symlinkg","fromName":"Arnaud Bailly","fromEmail":"abailly@oqube.com","sentAt":"2010-02-20T09:55:29Z","receivedAt":"2010-02-20T09:55:29Z","isPatch":false,"sender":{"key":"abailly@oqube.com","avatar":null},"body":"\nHello,\nMy apologies for the very late reply. Here is the strace dump:\n\nopen(\"pb-util/protoc/Linux-x86-2.6.28/lib/\", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 4\nfstat64(4, {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0\nfcntl64(4, F_GETFD)                     = 0x1 (flags FD_CLOEXEC)\ngetdents64(4, /* 24 entries */, 4096)   = 928\nopen(\".gitignore\", O_RDONLY|O_LARGEFILE) = 5\nfstat64(5, {st_mode=S_IFREG|0700, st_size=237, ...}) = 0\nread(5, \"auto\\r\\n*.log\\r\\n*.class\\r\\n*~\\r\\n*.exe\\r\\n\"..., 237) = 237\nclose(5)                                = 0\nopen(\".gitignore\", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)\nopen(\"pb-util/.gitignore\", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)\nopen(\"pb-util/protoc/.gitignore\", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)\nopen(\"pb-util/protoc/Linux-x86-2.6.28/.gitignore\", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)\nopen(\"pb-util/protoc/Linux-x86-2.6.28/lib/.gitignore\", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)\nlstat64(\"pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so\", {st_mode=S_IFLNK|0700, st_size=58, ...}) = 0\nlstat64(\"pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so.5\", {st_mode=S_IFLNK|0700, st_size=58, ...}) = 0\nlstat64(\"pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so.6\", {st_mode=S_IFLNK|0700, st_size=58, ...}) = 0\ngetdents64(4, /* 0 entries */, 4096)    = 0\nclose(4)                                = 0\nopen(\".git/index\", O_RDONLY|O_LARGEFILE) = 4\nfstat64(4, {st_mode=S_IFREG|0700, st_size=283832, ...}) = 0\nmmap2(NULL, 283832, PROT_READ|PROT_WRITE, MAP_PRIVATE, 4, 0) = 0xb7b3a000\nclose(4)                                = 0\nmmap2(NULL, 286720, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7af4000\nmunmap(0xb7b3a000, 283832)              = 0\nlstat64(\"pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so\", {st_mode=S_IFLNK|0700, st_size=58, ...}) = 0\nreadlink(\"pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so\", \"libprotobuf-lite.so.5.0.0\"..., 59) = 25\nwrite(2, \"error: readlink(\\\"pb-ut\"..., 104error: readlink(\"pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so\"): Invalid argument\n) = 104\nwrite(2, \"error: unable to index file pb-util\"..., 95error: unable to index file pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so\n) = 95\nwrite(2, \"fatal: adding files failed\\n\"..., 27fatal: adding files failed\n) = 27\nclose(3)                                = 0\nunlink(\".git/index.lock\")               = 0\nexit_group(128)                         = ?\n\nNote that when I do\n\n$> strace readlink pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so\n\nI got\n\nreadlink(\"pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so\", \"libprotobuf-lite.so.5.0.0\"..., 64) = 25\nfstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0\nmmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7c6d000\nwrite(1, \"libprotobuf-lite.so.5.0.0\\n\"..., 26libprotobuf-lite.so.5.0.0\n) = 26\nclose(1)                                = 0\nmunmap(0xb7c6d000, 4096)                = 0\nclose(2)                                = 0\nexit_group(0)                           = ?\n\nAny clue?\n\nThanks for your time,\n-- \nArnaud Bailly -- OQube\n<software engineering>\nhttp://www.oqube.com/\n"},{"id":"299160","messageId":"81b0412b1002211420k7bc73e4aub84ed6829d4a1acd@mail.gmail.com","threadId":"22611","inReplyTo":"854olcqlim.fsf@oqube.com","subject":"Re: Problem adding a symlinkg","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2010-02-21T22:20:29Z","receivedAt":"2010-02-21T22:20:29Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On Sat, Feb 20, 2010 at 10:55, Arnaud Bailly <abailly@oqube.com> wrote:\n> readlink(\"pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so\", \"libprotobuf-lite.so.5.0.0\"..., 59) = 25\n\nThe return value (25, positive) is no error. It is the length of the\nsymlink data.\nThis looks like an old Git (59 as buffer size, more recent version\nshould have used\n56 as returned by stat earlier).\n\n> lstat64(\"pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so\", {st_mode=S_IFLNK|0700, st_size=58, ...}) = 0\n> write(2, \"error: readlink(\\\"pb-ut\"..., 104error: readlink(\"pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so\"): Invalid argument\n> ) = 104\n\nThis looks like a bug in the version of Git you're using. It must be\nfixed by now (at least\nin 1.6.2, commit b760d3aa \"Make 'index_path()' use 'strbuf_readlink()'\").\n\nI don't know why your lstat returns size for a symlink which is\ndifferent from what readlink returns,\nbut this is why it fails: the code that you seem to be using assumed\nthat must be the case.\nNewer code just does not care and trusts the result of readlink.\n\nUpgrade your Git, it is worth the time anyway.\n"}]}