Bug #634
Locking error on windows when updating a TIFF file with MemoryMapping enabled
| Status: | Closed | Start: | 17 May 2009 | |
| Priority: | Normal | Due date: | ||
| Assigned to: | Robin Mills | % Done: | 100% |
|
| Category: | i/o | |||
| Target version: | 0.19 | |||
Description
C:\gnu.old\exiv2\msvc\bin\Debug>exiv2 -a 1:00:00 ad \R.tiff
Exiv2 exception in adjust action for file \R.tiff:
\R.tiff: Failed to open file (w+b): Invalid argument (errno = 22)
The cause is in basicio.cpp where the FileIo::close() method does not call munmap() (it defers munmap() to the destructor). I've moved the call to unmap from the destructor to close() and everybody's happy.
I don't believe MM creates a lock on unix, so this hasn't been seen until MM was added on Windows. Windows sets a lock on a MM file and causes tiffimage.cpp#180 ->transfer to fail when it tries to open a writable FILE* to the target file while holding a readonly lock.
I also found a bug in mmap.cpp in the array indexing which I've fixed in the same commit (although the change to mmap.cpp was not responsible for this bug).
The correct behavior (as before on Unix) is now:
C:\gnu\exiv2\msvc\bin\Debug>exiv2 -a 1:00:00 ad \R.tiff
C:\gnu\exiv2\msvc\bin\Debug>exiv2 -pt \R.tiff | grep -i date
Exif.Image.DateTime Ascii 20 2009:04:26 11:38:18
Exif.Photo.DateTimeOriginal Ascii 20 2009:04:26 11:38:18
Exif.Photo.DateTimeDigitized Ascii 20 2009:04:26 11:38:18
C:\gnu\exiv2\msvc\bin\Debug>exiv2 -a 1:00:00 ad \R.tiff
C:\gnu\exiv2\msvc\bin\Debug>exiv2 -pt \R.tiff | grep -i date
Exif.Image.DateTime Ascii 20 2009:04:26 12:38:18
Exif.Photo.DateTimeOriginal Ascii 20 2009:04:26 12:38:18
Exif.Photo.DateTimeDigitized Ascii 20 2009:04:26 12:38:18
C:\gnu\exiv2\msvc\bin\Debug>
Related issues
| related to Exiv2 - Feature #579 | Implement memory mapping for Windows platforms | Closed |
Associated revisions
#634 Locking error on windows when updating a TIFF file with MemoryMapping enabled
Prevent switchMode() from calling itself (fixes an incompatibility of the changes for #634 with the code to write to memory-mapped files.
History
Updated by Andreas Huggel 76 days ago
- Status changed from New to Resolved
- Target version changed from 1.0 to 0.19
- % Done changed from 0 to 100
Updated by Andreas Huggel 73 days ago
- Status changed from Resolved to Closed