NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Cédric, > there is a little problem in libsrc/posixio.c > (I think). > > In px_pgout, you do: > ----- > if(write(nciop->fd, vp, extent) != (ssize_t) extent) > { > return errno; > } > ----- > Problem is 'write' may write less bytes than you request. > In which case errno will be ENOERR, so the caller of px_pgout > thinks everything went fine, 'extent' bytes were written > to the file. > On the next call to px_pgout, the following assert will fail. > ----- > assert(*posp == OFF_NONE || *posp == lseek(nciop->fd, 0, > SEEK_CUR)); > ----- > because the previous call didn't update posp. (Or other functions > where a similar assert is done will fail.) > > You should loop the write, something like > (adapt to match your taste): > ----- > count = 0; > while ((n = write(XXX)) != -1) { > count += n; > if (count == extent) break; > } > if (n == -1) return errno; > ----- Thanks for diagnosing the problem and suggesting a fix! You are absolutely right about this, and we have already tested the fix, which will be in the upcoming 4.1 release. This is an important bug fix that explains several previously reported assertion violations when writing to a disk that was nearly full. --Russ
netcdfgroup
archives: