From: Alex Riesen Date: Sun, 21 Feb 2010 22:20:29 GMT Subject: Re: Problem adding a symlinkg Message-ID: <81b0412b1002211420k7bc73e4aub84ed6829d4a1acd@mail.gmail.com> In-Reply-To: <854olcqlim.fsf@oqube.com> On Sat, Feb 20, 2010 at 10:55, Arnaud Bailly wrote: > readlink("pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so", "libprotobuf-lite.so.5.0.0"..., 59) = 25 The return value (25, positive) is no error. It is the length of the symlink data. This looks like an old Git (59 as buffer size, more recent version should have used 56 as returned by stat earlier). > lstat64("pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so", {st_mode=S_IFLNK|0700, st_size=58, ...}) = 0 > write(2, "error: readlink(\"pb-ut"..., 104error: readlink("pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so"): Invalid argument > ) = 104 This looks like a bug in the version of Git you're using. It must be fixed by now (at least in 1.6.2, commit b760d3aa "Make 'index_path()' use 'strbuf_readlink()'"). I don't know why your lstat returns size for a symlink which is different from what readlink returns, but this is why it fails: the code that you seem to be using assumed that must be the case. Newer code just does not care and trusts the result of readlink. Upgrade your Git, it is worth the time anyway.