[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#5774) Modifications not saved on file by back-ldif (on Windows)



emmanuel.duru@atosorigin.com writes:
> Reading back-ldif code I see that when modifying an entry, back-ldif
> creates a temporary file containing the modified entry, and then
> renames the temporary file to the entry file.
>
> On Windows, renaming a file to an already existing file does not work,
> it gets an ERROR_ALREADY_EXISTS error (183), error code which is
> ignored by back-ldif.

If so we should rename cn=foo.ldif to cn=foo.save before moving the
new file in place and delete the .save afterwards, so the old file
won't be lost if slapd or the machine dies as just the wrong time.

Might try the same as a fallback on Mac/Unix if rename(tmpfile,
ldiffile) fails there.  There are lots of strange OSes out there,
or for that matter an OS might mount a filesystem from another OS.

It still needs manual cleanup though.  But we could maintain a "state"
file in the database directory which says which entry was last written,
and on startup in write mode rename that file back.  Read mode slapcat
could read any .save files as well as .ldif files.  Or all acceses to
.ldif files could, though that doubles the number of failed open/stat()
calls.

-- 
Hallvard