You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey chobie, it seems to me that the offset you are getting from git_index_find is actually GIT_ENOTFOUND, because the specified file cannot be found. That's why the lookup with git_index_get is failing and returning a NULL pointer. Can you tell me exactly what's the offset you are getting?
there is README.md entry on my repository.
try to execute my program ./git_index_test
offset:1
pointer_address: 9
Segmentation fault
i also try gdb ./git_index_test.
git_index_entry->path is correct in git_index_get().
but git_index_entry->path was wrong address in main scope.
(git_index_entry->path was just strdup() string. so i wondered about that.)
ummmm. I couldn't find this solution because i don't have enough C skill.
i tried my code in some environment.
OS: Result
OS X(snow leopard): OK
Ubuntu 10.10(gcc-4.4, i686-linux-gnu): Segmentation Fault
CentOS5.5(with remi repository, gcc-4.1.2 i386-redhat-linux): Segmentation Fault
rugged work fine on my ubuntu desktop.
probably i missunderstod something in my code...
Hmmm... I'm opening this bug again. You shouldn't have to force _FILE_OFFSET_BITS to compile the library. I'll look into this, thanks a lot for the warning.
The problem is that index.c compiles by including the internal src/common.h which defines the correct off_t. But user programs don't have access to that header, so they assume off_t is 32 bits.
This affects windows versions too.
User applications need access to the headers defining the right sizes to be compatible (the currently private mingw-compat and msvc-compat.h files)
Actually, I've changed the public header to use more generic types (unsigned int instead of off_t), since the file_size entry in the Index is always 32-bits (defined as such in the standard). I think this should fix the problem everywhere.
Activity
vmg commentedon Dec 27, 2010
Hey chobie, it seems to me that the
offsetyou are getting fromgit_index_findis actuallyGIT_ENOTFOUND, because the specified file cannot be found. That's why the lookup withgit_index_getis failing and returning aNULLpointer. Can you tell me exactly what's the offset you are getting?chobie commentedon Dec 28, 2010
Hi tanoku. thanks for your reply.
i put my code on this directory. and just added show offset value feature.
compile program
check git index file.
there is
README.mdentry on my repository.try to execute my program
./git_index_testi also try
gdb ./git_index_test.git_index_entry->pathis correct ingit_index_get().but
git_index_entry->pathwas wrong address in main scope.(
git_index_entry->pathwas juststrdup()string. so i wondered about that.)ummmm. I couldn't find this solution because i don't have enough C skill.
i tried my code in some environment.
OS: Result
OS X(snow leopard): OK
Ubuntu 10.10(gcc-4.4, i686-linux-gnu): Segmentation Fault
CentOS5.5(with remi repository, gcc-4.1.2 i386-redhat-linux): Segmentation Fault
ruggedwork fine on my ubuntu desktop.probably i missunderstod something in my code...
chobie commentedon Dec 29, 2010
I'm sorry to post so many questions.
finally, i added
-D_FILE_OFFSET_BITS=64option to compile my code. everything works great :)Thank you so much for providing great library.
then i can enjoy New Year's holidays.
vmg commentedon Dec 29, 2010
Hmmm... I'm opening this bug again. You shouldn't have to force
_FILE_OFFSET_BITSto compile the library. I'll look into this, thanks a lot for the warning.chobie commentedon Dec 30, 2010
oh, i have not to force
_FILE_OFFSET_BITSto compile my code right?just write down my code what reappear this probrem.
on 32bit machine
i found
D_FILE_OFFSET_BITSoption whereruggedgenerated Makefile on my machine.(because rugged work fine on my machine.)
scorpion007-zz commentedon Jan 9, 2011
The problem is that index.c compiles by including the internal src/common.h which defines the correct off_t. But user programs don't have access to that header, so they assume off_t is 32 bits.
This affects windows versions too.
User applications need access to the headers defining the right sizes to be compatible (the currently private mingw-compat and msvc-compat.h files)
vmg commentedon Jan 10, 2011
Actually, I've changed the public header to use more generic types (unsigned int instead of off_t), since the file_size entry in the Index is always 32-bits (defined as such in the standard). I think this should fix the problem everywhere.
scorpion007-zz commentedon Jan 10, 2011
By standard, you mean the git ABI?
sha1dc: update to fix errors with endianess and unaligned access