Lightroom: Writes preferences file directly rather than into a temp file first

  • 2
  • Problem
  • Updated 1 month ago
  • Acknowledged
Lightroom on Windows directly overwrites its preferences file with the new version of preferences. This is an elementary programming mistake -- if the writing is interrupted for whatever reason (application crash, operating system crash, power failure), the preferences will be left in an inconsistent state. Lightroom should instead write the new preferences to a temporary file and then rename the temporary file to "Lightroom 6 Preferences.agprefs".

Lightroom has long had a reputation for corrupting its preferences, and how to reset the preferences is one of the top FAQs and recommended fixes on the forums. Lightroom 6 even added a keyboard shortcut for doing it. Fixing this programming mistake will eliminate at least one of the causes of corruption.

Here's a trace from Process Monitor showing Lightroom CC 2015.3 overwriting the preferences file without first creating a temp file:

Photo of John R. Ellis

John R. Ellis, Champion

  • 4063 Posts
  • 1070 Reply Likes

Posted 3 years ago

  • 2
Photo of Simon Chen

Simon Chen, Principal Computer Scientist

  • 1540 Posts
  • 498 Reply Likes
Thanks for the report. Will prioritize the work.
Photo of John R. Ellis

John R. Ellis, Champion

  • 4063 Posts
  • 1070 Reply Likes
Thanks.
Photo of John R. Ellis

John R. Ellis, Champion

  • 4063 Posts
  • 1070 Reply Likes
I just re-tested LR 8.1 / Windows 10, and the issue still exists: 



This is likely a rare cause of corruption, since it appears that most people for whom "reset preferences" solves a problem haven't experienced a crash or hard stop of their computer. And if writing the .agprefs file got interrupted, most likely the Lua-syntax data in the file wouldn't be readable at all.  

But it should be a trivial fix, and given how many users "reset preferences" affects, this might be worthwhile to take off the table.