Douglas Mencken wrote: >> Could you try re-building git with the >> NO_THREAD_SAFE_PREAD build variable set? > > Yeah! It works!!! > > --- evil/Makefile > +++ good/Makefile > @@ -957,6 +957,7 @@ > HAVE_PATHS_H = YesPlease > LIBC_CONTAINS_LIBINTL = YesPlease > HAVE_DEV_TTY = YesPlease > + NO_THREAD_SAFE_PREAD = YesPlease > endif > ifeq ($(uname_S),GNU/kFreeBSD) > NO_STRLCPY = YesPlease > > With this, I do have correctly working git clone. OK, good. You didn't mention which platform you are on; from the above Makefile hunk, however, I can deduce that you are on *some* version of Linux. Hmm, it doesn't seem too likely that your pread() is thread-unsafe (possible, just unlikely), so it could be a more fundamental problem with the threaded index-pack code (ie commit b8a2486f1 et. seq.). However, as a first step could you try running the test program (given below) on your system to determine if your pread() is thread-safe or not. (gcc -I. -o test-pread test-pread.c; ./test-pread) Also, what is the output of "uname -a". ATB, Ramsay Jones -- >8 -- #include "git-compat-util.h" #include "thread-utils.h" #define DATA_FILE "junk.data" #define MAX_DATA 256 * 1024 #define NUM_THREADS 3 #define TRIALS 500000 struct thread_data { pthread_t t; int fd; int cnt; int fails; unsigned long n; }; static struct thread_data t[NUM_THREADS+1]; int create_data_file(void) { int i, fd = open(DATA_FILE, O_CREAT | O_TRUNC | O_WRONLY, 0600); if (fd < 0) return -1; for (i = 0; i < MAX_DATA; i++) if (write(fd, &i, sizeof(int)) < 0) { close(fd); unlink(DATA_FILE); return -1; } close(fd); return 0; } void *read_thread(void *data) { struct thread_data *d = (struct thread_data *)data; int i, j, rd; for (i = 0; i < TRIALS; i += MAX_DATA) { for (j = 0; j < MAX_DATA; j++) { ssize_t sz = read(d->fd, &rd, sizeof(int)); if (sz < 0 || rd != j) d->fails++; d->cnt++; } lseek(d->fd, 0, SEEK_SET); } return NULL; } void *pread_thread(void *data) { struct thread_data *d = (struct thread_data *)data; int i, j, rd; for (i = 0; i < TRIALS; i++) { ssize_t sz; d->n = d->n * 1103515245 + 12345; j = d->n % MAX_DATA; sz = pread(d->fd, &rd, sizeof(int), j * sizeof(int)); if (sz < 0 || rd != j) d->fails++; d->cnt++; } return NULL; } int main(int argc, char *argv[]) { int fd, i; if (create_data_file() < 0) { printf("can't create data file\n"); return 1; } if ((fd = open(DATA_FILE, O_RDONLY)) < 0) { printf("can't open data file\n"); unlink(DATA_FILE); return 1; } for (i = 0; i < NUM_THREADS+1; i++) { int ret; t[i].fd = fd; t[i].cnt = 0; t[i].fails = 0; t[i].n = i * 16381; ret = pthread_create(&t[i].t, NULL, (i == 0) ? read_thread : pread_thread, &t[i]); if (ret) { printf("can't create thread %d (%s)\n", i, strerror(ret)); unlink(DATA_FILE); return 1; } } for (i = 0; i < NUM_THREADS+1; i++) pthread_join(t[i].t, NULL); close(fd); for (i = 0; i < NUM_THREADS+1; i++) printf("%2d: trials %d, failed %d\n", i, t[i].cnt, t[i].fails); unlink(DATA_FILE); return 0; } -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html