git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Problem adding a symlinkg
@ 2010-02-11  6:17 Arnaud Bailly
  2010-02-11 12:01 ` Alex Riesen
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaud Bailly @ 2010-02-11  6:17 UTC (permalink / raw)
  To: git


Hello,
I am trying to add some symlink to git and got the following error:

error: readlink("protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so"): Invalid
argument
error: unable to index file protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so
fatal: adding files failed

I thought it was possible to add symlinks to git. What  am I doing wrong ?

THanks for your help
Arnaud
-- 
View this message in context: http://n2.nabble.com/Problem-adding-a-symlinkg-tp4553010p4553010.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problem adding a symlinkg
  2010-02-11  6:17 Problem adding a symlinkg Arnaud Bailly
@ 2010-02-11 12:01 ` Alex Riesen
  2010-02-20  9:55   ` Arnaud Bailly
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Riesen @ 2010-02-11 12:01 UTC (permalink / raw)
  To: Arnaud Bailly; +Cc: git

On Thu, Feb 11, 2010 at 07:17, Arnaud Bailly <abailly@oqube.com> wrote:
>
> I am trying to add some symlink to git and got the following error:
>
> error: readlink("protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so"): Invalid argument

Is the file in fact a symlink? Maybe it was replaced by a file while
Git was adding it?
If it is reproducable, could you strace "git add" and post the trace here?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problem adding a symlinkg
  2010-02-11 12:01 ` Alex Riesen
@ 2010-02-20  9:55   ` Arnaud Bailly
  2010-02-21 22:20     ` Alex Riesen
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaud Bailly @ 2010-02-20  9:55 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git


Hello,
My apologies for the very late reply. Here is the strace dump:

open("pb-util/protoc/Linux-x86-2.6.28/lib/", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 4
fstat64(4, {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
fcntl64(4, F_GETFD)                     = 0x1 (flags FD_CLOEXEC)
getdents64(4, /* 24 entries */, 4096)   = 928
open(".gitignore", O_RDONLY|O_LARGEFILE) = 5
fstat64(5, {st_mode=S_IFREG|0700, st_size=237, ...}) = 0
read(5, "auto\r\n*.log\r\n*.class\r\n*~\r\n*.exe\r\n"..., 237) = 237
close(5)                                = 0
open(".gitignore", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("pb-util/.gitignore", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("pb-util/protoc/.gitignore", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("pb-util/protoc/Linux-x86-2.6.28/.gitignore", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("pb-util/protoc/Linux-x86-2.6.28/lib/.gitignore", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
lstat64("pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so", {st_mode=S_IFLNK|0700, st_size=58, ...}) = 0
lstat64("pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so.5", {st_mode=S_IFLNK|0700, st_size=58, ...}) = 0
lstat64("pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so.6", {st_mode=S_IFLNK|0700, st_size=58, ...}) = 0
getdents64(4, /* 0 entries */, 4096)    = 0
close(4)                                = 0
open(".git/index", O_RDONLY|O_LARGEFILE) = 4
fstat64(4, {st_mode=S_IFREG|0700, st_size=283832, ...}) = 0
mmap2(NULL, 283832, PROT_READ|PROT_WRITE, MAP_PRIVATE, 4, 0) = 0xb7b3a000
close(4)                                = 0
mmap2(NULL, 286720, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7af4000
munmap(0xb7b3a000, 283832)              = 0
lstat64("pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so", {st_mode=S_IFLNK|0700, st_size=58, ...}) = 0
readlink("pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so", "libprotobuf-lite.so.5.0.0"..., 59) = 25
write(2, "error: readlink(\"pb-ut"..., 104error: readlink("pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so"): Invalid argument
) = 104
write(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
) = 95
write(2, "fatal: adding files failed\n"..., 27fatal: adding files failed
) = 27
close(3)                                = 0
unlink(".git/index.lock")               = 0
exit_group(128)                         = ?

Note that when I do

$> strace readlink pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so

I got

readlink("pb-util/protoc/Linux-x86-2.6.28/lib/libprotobuf-lite.so", "libprotobuf-lite.so.5.0.0"..., 64) = 25
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7c6d000
write(1, "libprotobuf-lite.so.5.0.0\n"..., 26libprotobuf-lite.so.5.0.0
) = 26
close(1)                                = 0
munmap(0xb7c6d000, 4096)                = 0
close(2)                                = 0
exit_group(0)                           = ?

Any clue?

Thanks for your time,
-- 
Arnaud Bailly -- OQube
<software engineering>
http://www.oqube.com/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problem adding a symlinkg
  2010-02-20  9:55   ` Arnaud Bailly
@ 2010-02-21 22:20     ` Alex Riesen
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Riesen @ 2010-02-21 22:20 UTC (permalink / raw)
  To: Arnaud Bailly; +Cc: git, Linus Torvalds, Junio C Hamano

On Sat, Feb 20, 2010 at 10:55, Arnaud Bailly <abailly@oqube.com> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-02-21 22:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-11  6:17 Problem adding a symlinkg Arnaud Bailly
2010-02-11 12:01 ` Alex Riesen
2010-02-20  9:55   ` Arnaud Bailly
2010-02-21 22:20     ` Alex Riesen

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).