ZNC doesn't respect symlinked config files #268

Closed
opened 2026-10-05 04:08:56 +02:00 by adam · 7 comments
Owner

If my ZNC config file in ~/.znc/configs/znc.conf is a symlink to ~/dotfiles/znc/.znc/configs/znc.conf -- which it is, if I use stow to manage the file -- then ZNC should respect the symlink I have, and write its configuration to the underlying real file, not to the symlink.

As it is, I have to copy and update the symlink each time I want to start ZNC, and as soon as I do that, it overwrites the symlink with a file.

If my ZNC config file in `~/.znc/configs/znc.conf` is a symlink to `~/dotfiles/znc/.znc/configs/znc.conf` -- which it is, if I use stow to manage the file -- then ZNC should respect the symlink I have, and write its configuration to the underlying real file, not to the symlink. As it is, I have to copy and update the symlink each time I want to start ZNC, and as soon as I do that, it overwrites the symlink with a file. <!-- github-sync-id:20849874 -->
adam closed this issue 2026-10-05 04:08:56 +02:00
Author
Owner

ZNC doesn't write directly to the file, but to the other file first, and then moves it over the old config.
You don't want to lose the config in case of some ZNC crash, or electricity failure during the process of writing config, do you?

ZNC doesn't write directly to the file, but to the other file first, and then moves it over the old config. You don't want to lose the config in case of some ZNC crash, or electricity failure during the process of writing config, do you? <!-- github-comment-id:26114048 -->
Author
Owner

Start znc -d ~/dotfiles/znc/.znc instead, and it'll use that dir to store all configs

Start `znc -d ~/dotfiles/znc/.znc` instead, and it'll use that dir to store all configs <!-- github-comment-id:26114080 -->
Author
Owner

No, but it should be possible to effect the same change using the real path of the config file, as opposed to the symlinked path.

No, but it should be possible to effect the same change using the real path of the config file, as opposed to the symlinked path. <!-- github-comment-id:26114082 -->
Author
Owner

Hey, we love our dotfiles! Don't be like every miserable projects. I hope it's not because you are lazy.

Hey, we love our dotfiles! Don't be like every miserable projects. I hope it's not because you are lazy. <!-- github-comment-id:26114119 -->
Author
Owner

The suggestion to use -d only works if my .znc configuration is in a single stow. The setup of my stow configuration means that different hosts contribute different parts of the config, and that results in the ~/.znc directory being made up of many other parts.

It seems logical that the fix would be to update the file write method to:

while target_file is a symlink:
    target_file = target_file.linked_target
swap_content_safely(target_file)

That doesn't seem unreasonable, although that might be a bitch in the code as it is.

I don't seem to be able to reopen this, btw.

The suggestion to use -d only works if my .znc configuration is in a single stow. The setup of my stow configuration means that different hosts contribute different parts of the config, and that results in the ~/.znc directory being made up of many other parts. It seems logical that the fix would be to update the file write method to: ``` while target_file is a symlink: target_file = target_file.linked_target swap_content_safely(target_file) ``` That doesn't seem unreasonable, although that might be a bitch in the code as it is. I don't seem to be able to reopen this, btw. <!-- github-comment-id:26114448 -->
Author
Owner

It's not because I'm lazy, but because parts of config are elsewhere, so storing only znc.conf is not enough, while -d (or just symlinking .znc to whatever directory) causes ZNC to store everything at the specified dir.
So, what are other parts which you put to that stow except znc.conf?

It's not because I'm lazy, but because parts of config are elsewhere, so storing only znc.conf is not enough, while -d (or just symlinking .znc to whatever directory) causes ZNC to store everything at the specified dir. So, what are other parts which you put to that stow except znc.conf? <!-- github-comment-id:26114587 -->
Author
Owner

So, what are other parts which you put to that stow except znc.conf?

Silence...

> So, what are other parts which you put to that stow except znc.conf? Silence... <!-- github-comment-id:158876023 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#268