Project

General

Profile

Bug #634

Locking error on windows when updating a TIFF file with MemoryMapping enabled

Added by Robin Mills over 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
basicio
Target version:
Start date:
17 May 2009
Due date:
% Done:

100%

Estimated time:

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 platformsClosed

Actions

Associated revisions

Revision 1799 (diff)
Added by Robin Mills over 10 years ago

#634 Locking error on windows when updating a TIFF file with MemoryMapping enabled

Revision 1807 (diff)
Added by Andreas Huggel about 10 years ago

Prevent switchMode() from calling itself (fixes an incompatibility of the changes for #634 with the code to write to memory-mapped files.

Revision 1832 (diff)
Added by Andreas Huggel about 10 years ago

Removed r1799, r1797 from trunk (#634, #579)

History

#1

Updated by Andreas Huggel over 9 years ago

  • Status changed from New to Resolved
  • Target version changed from 1.0 to 0.19
  • % Done changed from 0 to 100
#2

Updated by Andreas Huggel over 9 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF