Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


#868 pcmanfm.conf symlinks destroyed

Jeffrey Lund

I am running pcmanfm version 1.1.2 on Fedora 20. I like to keep my configuration files in a git repository so that I can easily keep all my machines in sync. I have a script which creates symlinks so this can be easily done. For example on my machines, $HOME/.config/pcmanfm/LXDE/pcmanfm.conf should be a symlink to $HOME/config/dotfiles/config/pcmanfm/LXDE/pcmanfm.conf. This way, any changes I make to config files are detected by git, and syncing my configuration is as simple as a git pull. Unfortunately, this doesn't always work with pcmanfm.conf, as updating it with some of the GUI tools seems to remove the symlink, create a new file, and write to that new file instead of simply opening the existing file and writing to the existing file. A simple example of this is changing the wallpaper using the desktop preferences, the entire pcmanfm.conf file is overwritten and my symlink is no longer present. I then have to copy the new file into my git repo and remember to rerun the setup script everywhere else. Admittedly, I have never even looked in the codebase for pcmanfm, but I cannot see why the deletion of the old file is needed when simply opening the file in write mode will do the right thing regardless of whether the file is an actual file or a symlink.


  • Jeffrey Lund
    Jeffrey Lund

    I've looked a bit more and it seems that src/desktop.c line 402 is where the saving of the pcmanfm.conf file is done. The docs for g_file_set_contents say that if the file is a symlink, it will be replaced. Is there a similar call somewhere which does not exhibit this behavior?

    • status: open --> closed-wont-fix
    • assigned_to: Lonely Stranger
  • You cannot do "safe replace" if you overwrite the same file - as soon you start to write it, its old contents will be lost forever. It's why the safe API g_file_set_contents() is used there. I'm sorry but your approach is impossible to do. I would suggest to change your script that it will create a hardlink for $HOME/.config/pcmanfm/LXDE/pcmanfm.conf into $HOME/config/dotfiles/config/pcmanfm/LXDE/pcmanfm.conf from time to time and then it can be used to do your sync.
    Thank you for understanding.