Skip Menu |

This queue is for tickets about the File-Temp CPAN distribution.

Report information
The Basics
Id: 28397
Status: resolved
Priority: 0/
Queue: File-Temp

People
Owner: Nobody in particular
Requestors: bitcard [...] fjarlq.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.16
  • 0.17
  • 0.18
Fixed in: 0.19



Subject: undocumented file locking in File::Temp
Dear File::Temp maintainer, In Perl v5.8.8, File::Lock::tempfile obtains an exclusive lock on the temporary file only on systems that support the O_EXLOCK sysopen flag. On systems that do not support O_EXLOCK, no lock is obtained by File::Lock::tempfile. This behavior is not documented in "perldoc File::Lock", and no way is provided to suppress the acquisition of the lock. For an example of the problem caused by this behavior, see: http://rt.cpan.org/Ticket/Display.html?id=28373 In this example, Brackup's test code wishes to create a database in a temporary file. So it creates a temporary file using File::Lock::tempfile, and tries to create a database in it using DBD::SQLite. When DBD::SQLite attempts to lock the file, the test fails because it blocks indefinitely on FreeBSD systems (which support O_EXLOCK) because the file has already been locked. But the test passes on Linux systems where O_EXLOCK is unsupported. Rather than documenting this behavior, I would prefer eliminating it. There is little value in automatically obtaining an exclusive lock only on the systems that support O_EXLOCK, and since the behavior is undocumented nobody should be depending on it. Attached is a patch which removes the use of EXLOCK from File::Temp 0.18. Thanks, Matt
File locking can now be disabled.