Bug #634

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

Added by Robin Mills almost 8 years ago. Updated over 7 years ago.

Status:ClosedStart date:17 May 2009
Priority:NormalDue date:
Assignee:Robin Mills% Done:

100%

Category:basicio
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

Revision 1799
Added by Robin Mills almost 8 years ago

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

Revision 1807
Added by Andreas Huggel almost 8 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
Added by Andreas Huggel almost 8 years ago

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

History

#1 Updated by Andreas Huggel over 7 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 7 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux