leading dot and trailing # in lock files

Olivier Tilloy olivier.tilloy at canonical.com
Thu Jul 12 17:36:56 UTC 2018

Hi all,

I maintain a snap package for libreoffice¹, and it has been reported
that document files cannot be saved to $HOME/ ² because of the strict
confinement rules of snappy, whereby writing hidden files (filename
starting with a dot) in $HOME is forbidden.

I looked into the document file lock code, and came up with a simple
patch that removes the leading dot. So far, so good. It was pointed
out to me that file managers like Nautilus also consider files with a
trailing tilde (~) to be hidden, so I updated that patch so that lock
files are represented like so:

    $HOME/foobar.odt -> $HOME/foobar.odt.lock~

I was wondering about the trailing # in the current lock file
implementation. I dug into the git history, and it's always been there
as far as I can tell, but I'm not sure why. Can anyone shed some light
on this?
Is it safe to replace "#" with ".lock~" (only in the context of the
snap package, I don't intend to upstream that change unless it's
deemed sensible) ?



¹ https://snapcraft.io/libreoffice
² https://launchpad.net/bugs/1766192

More information about the LibreOffice mailing list