Prevent WeeChat from overwriting its own configuration files

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Prevent WeeChat from overwriting its own configuration files

Jérémie Roquet
Hello everyone,

Everytime I start weechat, it overwrites its own configuration files
(~/.weechat/*.conf) and even re-generates the ones I've deleted there.

Which means I'm unable to start with a minimal configuration
(customized settings only for the few I fully understand and want to
differ from the default; “sane default” settings of the last release
of weechat for everything else).

Setting “weechat.look.save_config_on_exit” to “off” doesn't change
anything (which comes as expected, since the files are overwritten on
startup, not when exiting).

The workaround I'm currently using is a “chmod u-w ~/.weechat”, but
that doesn't seem right and is obviously inconvenient when I want to
edit my configuration (and I'd like to avoid depending on SELinux for
something as simple).

Is there any way to prevent this behavior? If there isn't any yet,
would a patch to add such feature have a chance to get merged in?

Thanks in advance for your help.

Best regards,

--
Jérémie

_______________________________________________
Weechat-support mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-support
Reply | Threaded
Open this post in threaded view
|

Re: Prevent WeeChat from overwriting its own configuration files

Nils G
Am 02.04.2016 um 22:04 schrieb Jérémie Roquet:

> Is there any way to prevent this behavior? If there isn't any yet,
> would a patch to add such feature have a chance to get merged in?

Config files will not be overwritten on startup!

i read your comments in #weechat. The behaviour is not normal and
people told you to not edit config files by hand, if you don't know what you
are doing!

/set weechat.look.save_config_on_exit off
/save



_______________________________________________
Weechat-support mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-support
Reply | Threaded
Open this post in threaded view
|

Re: Prevent WeeChat from overwriting its own configuration files

Bradley D. Thornton


On 4/2/2016 1:27 PM, Nils G wrote:
> Am 02.04.2016 um 22:04 schrieb Jérémie Roquet:
>
>> Is there any way to prevent this behavior? If there isn't any yet,
>> would a patch to add such feature have a chance to get merged in?
> Config files will not be overwritten on startup!
>
> i read your comments in #weechat. The behaviour is not normal and
> people told you to not edit config files by hand, if you don't know what you
> are doing!

He can also just do a:

# chattr +i /home/username/.weechat/*.conf

That'll fix it good ;)

>
> /set weechat.look.save_config_on_exit off
> /save
>
>
>
> _______________________________________________
> Weechat-support mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/weechat-support


_______________________________________________
Weechat-support mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-support
Reply | Threaded
Open this post in threaded view
|

Re: Prevent WeeChat from overwriting its own configuration files

Jérémie Roquet
In reply to this post by Nils G
Dear Nils,

Thank you for your kind answer.

2016-04-02 22:27 GMT+02:00 Nils G <[hidden email]>:
> i read your comments in #weechat. The behaviour is not normal and
> people told you to not edit config files by hand, if you don't know what you
> are doing!

That must have been someone else. I've never been on #weechat yet.

> Config files will not be overwritten on startup!

Actually, I've made some additional tests and here's what happens:

 1) Configuration files that I've deleted are re-created on startup.
Here's for example what happens for sec.conf I've deleted before
(using strace):

access("/home/arkanosis/.weechat/sec.conf", F_OK) = -1 ENOENT (No such
file or directory)
lstat("/home/arkanosis/Arkonf/weechat/.weechat/sec.conf",
0x7ffe37cb6590) = -1 ENOENT (No such file or directory)
open("/home/arkanosis/.weechat/sec.conf.weechattmp",
O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
write(4, "#\n# weechat -- sec.conf\n#\n\n[cryp"..., 109) = 109
chmod("/home/arkanosis/.weechat/sec.conf.weechattmp", 0600) = 0
rename("/home/arkanosis/.weechat/sec.conf.weechattmp",
"/home/arkanosis/.weechat/sec.conf") = 0
open("/home/arkanosis/.weechat/sec.conf", O_RDONLY) = 4
read(4, "#\n# weechat -- sec.conf\n#\n\n[cryp"..., 4096) = 109

Note that weechat is still running and I haven't pressed any key yet.
And the same happens for every configuration file.

 2) Configuration files I've not deleted are overwritten on /quit,
regardless of weechat.look.save_config_on_exit. Here's for example
what happens for irc.conf I've *not* deleted before (still using
strace):

access("/home/arkanosis/.weechat/irc.conf", F_OK) = 0
open("/home/arkanosis/.weechat/irc.conf", O_RDONLY) = 7

<at this point, I /quit weechat>

[pid   424] lstat("/home/arkanosis/Arkonf/weechat/.weechat/irc.conf",
{st_mode=S_IFREG|0664, st_size=490, ...}) = 0
[pid   424] open("/home/arkanosis/.weechat/irc.conf.weechattmp",
O_WRONLY|O_CREAT|O_TRUNC, 0666)
 = 17
[pid   424] write(17, "#\n# weechat -- irc.conf\n#\n\n[look"..., 4096) = 4096
[pid   424] chmod("/home/arkanosis/.weechat/irc.conf.weechattmp", 0600) = 0
[pid   424] rename("/home/arkanosis/.weechat/irc.conf.weechattmp",
"/home/arkanosis/Arkonf/weechat/.weechat/irc.conf") = 0

Note that my settings are preserved, but the file itself is
overwritten by settings I don't want in it (mostly because they are
the defaults, so I don't care, plus I hate having settings I don't
need or understand in my dotfiles). Also, formating and comments are
lost.

3) weechat.look.save_config_on_exit = off seems to preserve
weechat.conf and only weechat.conf (sorry, I missed that before
sending my first email).

I'm using the last version for Ubuntu 14.04 LTS, from the weechat deb
repository; that is version 1.4.

So, are these two bugs? Or is it by design that:
1) files are created on startup when I've deleted them;
2) files others than weechat.conf are overwritten on /quit even with
weechat.look.save_config_on_exit = off.

If these are bugs, then I'm willing to fix them. If these are not,
would new settings to change this behavior be welcome in the code
base?

Thanks again for you help and best regards,

--
Jérémie

_______________________________________________
Weechat-support mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-support
Reply | Threaded
Open this post in threaded view
|

Re: Prevent WeeChat from overwriting its own configuration files

Jérémie Roquet
In reply to this post by Bradley D. Thornton
Dear Bradley,

2016-04-02 22:50 GMT+02:00 Bradley D. Thornton <[hidden email]>:
> He can also just do a:
> # chattr +i /home/username/.weechat/*.conf
>
> That'll fix it good ;)

That's right, but it's as inconvenient as the “chmod u-w” trick I've
mentioned in my first email and unlike this one, it also requires
superuser rights.

Still, thank you for the suggestion.

Best regards,

--
Jérémie

_______________________________________________
Weechat-support mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-support
Reply | Threaded
Open this post in threaded view
|

Re: Prevent WeeChat from overwriting its own configuration files

Nils G
In reply to this post by Jérémie Roquet
Am 03.04.2016 um 01:07 schrieb Jérémie Roquet:

> Note that my settings are preserved, but the file itself is
> overwritten by settings I don't want in it (mostly because they are
> the defaults, so I don't care, plus I hate having settings I don't
> need or understand in my dotfiles). Also, formating and comments are
> lost.
If you remove settings from config files they will be restored.
Once again, don't edit config files manually. Use /set command or /iset script!


> 3) weechat.look.save_config_on_exit = off seems to preserve
> weechat.conf and only weechat.conf (sorry, I missed that before
> sending my first email).
All config files will be saved on exit, execpt layouts!


> So, are these two bugs? Or is it by design that:
No. Don't mess with config files. This is a user bug!


> 1) files are created on startup when I've deleted them;
Config files will be re-created on startup, if they are missing.


> 2) files others than weechat.conf are overwritten on /quit even with
> weechat.look.save_config_on_exit = off.
No, they won't be overwritten if you set option to "off". But you have
to set this option inside weechat. If you manually edit config file the
option will be overwritten and never take effect.

Don't delete any line from weechat.conf (or any other config file!)
or add something to it.

You can disable option "save_config_on_exit" and manually /save config file if you want.

Once again: use /set command or /iset script to change configuration.
Its not a weechat bug, its a user bug!


_______________________________________________
Weechat-support mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-support
Reply | Threaded
Open this post in threaded view
|

Re: Prevent WeeChat from overwriting its own configuration files

Sébastien Helleu
In reply to this post by Jérémie Roquet
On Sat, Apr 02, 2016 at 10:04:44PM +0200, Jérémie Roquet wrote:

> Hello everyone,
>
> Everytime I start weechat, it overwrites its own configuration files
> (~/.weechat/*.conf) and even re-generates the ones I've deleted there.
>
> Which means I'm unable to start with a minimal configuration
> (customized settings only for the few I fully understand and want to
> differ from the default; “sane default” settings of the last release
> of weechat for everything else).
>
> Setting “weechat.look.save_config_on_exit” to “off” doesn't change
> anything (which comes as expected, since the files are overwritten on
> startup, not when exiting).
>
> The workaround I'm currently using is a “chmod u-w ~/.weechat”, but
> that doesn't seem right and is obviously inconvenient when I want to
> edit my configuration (and I'd like to avoid depending on SELinux for
> something as simple).
>
> Is there any way to prevent this behavior? If there isn't any yet,
> would a patch to add such feature have a chance to get merged in?
>
> Thanks in advance for your help.
>
> Best regards,
>
> --
> Jérémie
>

Hi Jérémie,

Instead of deleting config files, you can create empty files.
On startup, config files are created only if they are not found.

--
Sébastien Helleu

web: weechat.org / flashtux.org
irc: FlashCode @ irc.freenode.net

_______________________________________________
Weechat-support mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/weechat-support