Hello OmegaPhil,

OmegaPhil:
> The actual problem is happening in git's
> sha1_file.c:prepare_packed_git_one, the closedir call right at the
> bottom is setting errno to 'Bad file descriptor', git later on notices
> that errno is bad and panics (ironically the fetch itself looks good).
>
> Any idea what libau is doing here? Have confirmed the problem on a VM.

I could reproduce the problem, and added some debug print into
aufs-util.git/libau/rdu_lib.c:closedir(). See the attachment.

It must be an application's problem instead of libau.
Generally applications should not use errno after a systemcall/library
succeeded. Actually the manual of errno(3) says


DESCRIPTION
       The <errno.h> header file defines the integer variable errno, which is 
set by system calls
       and some library functions in the event of an error to  indicate  what  
went  wrong.   Its
       value  is  significant only when the return value of the call indicated 
an error (i.e., -1
       from most system calls; -1 or NULL from most library functions); a 
function that  succeeds
       is allowed to change errno.
        :::


I didn't check the source files of git-fetch, but this symptom indicates
that git-fetch incorrectly tests errno after libau:closedir() returned a
success.
libau can fix this problem (see the attachment again), but it is
definitly better to fix git-fetch.


> It took me a very long time to realise it could be aufs' doing - as soon
> as I killed off LD_PRELOAD, the fetch started working...

I can understand it very hard. Good job!


J. R. Okajima

Attachment: a.patch.bz2
Description: BZip2 compressed data

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot

Reply via email to