On Sun, May 27, 2007 at 07:38:26PM +0200, Raphael Hertzog wrote: > On Sun, 27 May 2007, Stephen Gran wrote: > > It seems odd, but not impossible. I'll take another look at nss-pgsql > > and let you know - if I can force it to set errno to ERANGE, and it > > continues to break, then the problem is with updatedb. If it doesn't > > return ERANGE, then the problem is with the backend. > > AFAIK, libnss-pgsql sets errno appropriately: > > Line 442 of src/backend.c has this: > BAIL_OUT: > /* Set errnop so glibc will call the us again with a bigger buffer */ > if (status == NSS_STATUS_TRYAGAIN) > *errnop = ERANGE; Yes it does, but that doesn't seem to be sufficient. If you look at nss/files-XXX.c you see:
if (status == NSS_STATUS_SUCCESS) { status = internal_getent (result, buffer, buflen, errnop H_ERRNO_ARG EXTRA_ARGS_VALUE); /* Remember this position if we were successful. If the operation failed we give the user a chance to repeat the operation (perhaps the buffer was too small). */ if (status == NSS_STATUS_SUCCESS) fgetpos (stream, &position); else /* We must make sure we reposition the stream the next call. */ last_use = nouse; } So the nss module itself takes care of not advancing to the next group, which is sensibile behaviour and this is indeed what nss_updatedb shows when using the file backend: Starting 112 gid_t: 112 done Starting 112 Enlarging buffer from 64 to 128 Starting 112 Enlarging buffer from 128 to 256 Starting 112 Enlarging buffer from 256 to 512 Starting 10000 gid_t: 10000 done Starting 10000 done. Note that the group stays 112 until the buffer is large enough to fit the "huge" group 10000 into it. This is something that must be handled by the nss modul internally. So the pgsql module should IMHO do somehting like: res = fetch("group"); if (PQresultStatus(res)==PGRES_TUPLES_OK) { status = res2grp(res, result, buffer, buflen, errnop); if(status == NSS_STATUS_TRYAGAIN && *errnop = ERANGE) move("group", backwards) } else status = NSS_STATUS_UNAVAIL; Where move() just moves the cursor one row back. So I'll reassign to libnss-pgsql1, if you agree? Cheers, -- Guido -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]