diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 79ce39296..c48d81398 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -30,6 +30,7 @@ New features:: Improvements:: + * core: add option weechat.look.save_config_with_fsync (issue #1083) * api: add argument "recurse_subdirs" in function exec_on_files() * script: add local variable "filter" in the script buffer (issue #1037) diff --git a/doc/de/autogen/user/weechat_options.adoc b/doc/de/autogen/user/weechat_options.adoc index bd8e6dbe5..5e860ca13 100644 --- a/doc/de/autogen/user/weechat_options.adoc +++ b/doc/de/autogen/user/weechat_options.adoc @@ -1094,6 +1094,12 @@ ** Werte: on, off ** Standardwert: `+on+` +* [[option_weechat.look.save_config_with_fsync]] *weechat.look.save_config_with_fsync* +** Beschreibung: pass:none[use fsync to synchronize the configuration file with the storage device (see man fsync); this is slower but should prevent any data loss in case of power failure during the save of configuration file] +** Typ: boolesch +** Werte: on, off +** Standardwert: `+off+` + * [[option_weechat.look.save_layout_on_exit]] *weechat.look.save_layout_on_exit* ** Beschreibung: pass:none[beim Beenden wird das aktuelle Layout gesichert (Buffer, Fenster oder beides)] ** Typ: integer diff --git a/doc/en/autogen/user/weechat_options.adoc b/doc/en/autogen/user/weechat_options.adoc index a87737fc4..1cebe569c 100644 --- a/doc/en/autogen/user/weechat_options.adoc +++ b/doc/en/autogen/user/weechat_options.adoc @@ -1094,6 +1094,12 @@ ** values: on, off ** default value: `+on+` +* [[option_weechat.look.save_config_with_fsync]] *weechat.look.save_config_with_fsync* +** description: pass:none[use fsync to synchronize the configuration file with the storage device (see man fsync); this is slower but should prevent any data loss in case of power failure during the save of configuration file] +** type: boolean +** values: on, off +** default value: `+off+` + * [[option_weechat.look.save_layout_on_exit]] *weechat.look.save_layout_on_exit* ** description: pass:none[save layout on exit (buffers, windows, or both)] ** type: integer diff --git a/doc/fr/autogen/user/weechat_options.adoc b/doc/fr/autogen/user/weechat_options.adoc index 9b6d95d63..faa83c8de 100644 --- a/doc/fr/autogen/user/weechat_options.adoc +++ b/doc/fr/autogen/user/weechat_options.adoc @@ -1094,6 +1094,12 @@ ** valeurs: on, off ** valeur par défaut: `+on+` +* [[option_weechat.look.save_config_with_fsync]] *weechat.look.save_config_with_fsync* +** description: pass:none[utiliser fsync pour synchroniser le fichier de configuration avec le périphérique de stockage (voir man fsync) ; cela est plus lent mais devrait éviter toute perte de données en cas de panne de courant durant la sauvegarde du fichier de configuration] +** type: booléen +** valeurs: on, off +** valeur par défaut: `+off+` + * [[option_weechat.look.save_layout_on_exit]] *weechat.look.save_layout_on_exit* ** description: pass:none[sauvegarder la disposition en quittant (tampons, fenêtres, ou les deux)] ** type: entier diff --git a/doc/it/autogen/user/weechat_options.adoc b/doc/it/autogen/user/weechat_options.adoc index 97ee5ee36..49e30df29 100644 --- a/doc/it/autogen/user/weechat_options.adoc +++ b/doc/it/autogen/user/weechat_options.adoc @@ -1094,6 +1094,12 @@ ** valori: on, off ** valore predefinito: `+on+` +* [[option_weechat.look.save_config_with_fsync]] *weechat.look.save_config_with_fsync* +** descrizione: pass:none[use fsync to synchronize the configuration file with the storage device (see man fsync); this is slower but should prevent any data loss in case of power failure during the save of configuration file] +** tipo: bool +** valori: on, off +** valore predefinito: `+off+` + * [[option_weechat.look.save_layout_on_exit]] *weechat.look.save_layout_on_exit* ** descrizione: pass:none[save layout on exit (buffers, windows, or both)] ** tipo: intero diff --git a/doc/ja/autogen/user/weechat_options.adoc b/doc/ja/autogen/user/weechat_options.adoc index 632bf727a..c7b7ce8cd 100644 --- a/doc/ja/autogen/user/weechat_options.adoc +++ b/doc/ja/autogen/user/weechat_options.adoc @@ -1094,6 +1094,12 @@ ** 値: on, off ** デフォルト値: `+on+` +* [[option_weechat.look.save_config_with_fsync]] *weechat.look.save_config_with_fsync* +** 説明: pass:none[use fsync to synchronize the configuration file with the storage device (see man fsync); this is slower but should prevent any data loss in case of power failure during the save of configuration file] +** タイプ: ブール +** 値: on, off +** デフォルト値: `+off+` + * [[option_weechat.look.save_layout_on_exit]] *weechat.look.save_layout_on_exit* ** 説明: pass:none[終了時にレイアウトを保存 (バッファ、ウィンドウ、両方)] ** タイプ: 整数 diff --git a/doc/pl/autogen/user/weechat_options.adoc b/doc/pl/autogen/user/weechat_options.adoc index 50ce593a4..ffb113cf7 100644 --- a/doc/pl/autogen/user/weechat_options.adoc +++ b/doc/pl/autogen/user/weechat_options.adoc @@ -1094,6 +1094,12 @@ ** wartości: on, off ** domyślna wartość: `+on+` +* [[option_weechat.look.save_config_with_fsync]] *weechat.look.save_config_with_fsync* +** opis: pass:none[use fsync to synchronize the configuration file with the storage device (see man fsync); this is slower but should prevent any data loss in case of power failure during the save of configuration file] +** typ: bool +** wartości: on, off +** domyślna wartość: `+off+` + * [[option_weechat.look.save_layout_on_exit]] *weechat.look.save_layout_on_exit* ** opis: pass:none[zapisz układ przy wyjściu (bufory, okna lub oba)] ** typ: liczba diff --git a/po/cs.po b/po/cs.po index a36fb465c..65a9da085 100644 --- a/po/cs.po +++ b/po/cs.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-09-05 07:26+0200\n" +"POT-Creation-Date: 2017-10-14 07:47+0200\n" "PO-Revision-Date: 2017-06-26 23:32+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -3462,6 +3462,12 @@ msgstr "" msgid "save configuration file on exit" msgstr "uložit soubor s nastavením při ukončení" +msgid "" +"use fsync to synchronize the configuration file with the storage device (see " +"man fsync); this is slower but should prevent any data loss in case of power " +"failure during the save of configuration file" +msgstr "" + #, fuzzy msgid "save layout on exit (buffers, windows, or both)" msgstr "uložit rozložení při ukončení (buffery, okna nebo obojí)" diff --git a/po/de.po b/po/de.po index 446f036f8..8f649556f 100644 --- a/po/de.po +++ b/po/de.po @@ -19,7 +19,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-09-05 07:26+0200\n" +"POT-Creation-Date: 2017-10-14 07:47+0200\n" "PO-Revision-Date: 2017-09-09 17:44+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -4154,6 +4154,12 @@ msgstr "" msgid "save configuration file on exit" msgstr "die aktuelle Konfiguration wird beim Beenden automatisch gesichert" +msgid "" +"use fsync to synchronize the configuration file with the storage device (see " +"man fsync); this is slower but should prevent any data loss in case of power " +"failure during the save of configuration file" +msgstr "" + msgid "save layout on exit (buffers, windows, or both)" msgstr "" "beim Beenden wird das aktuelle Layout gesichert (Buffer, Fenster oder beides)" diff --git a/po/es.po b/po/es.po index a695f316c..4035388a2 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-09-05 07:26+0200\n" +"POT-Creation-Date: 2017-10-14 07:47+0200\n" "PO-Revision-Date: 2017-06-26 23:32+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -3631,6 +3631,12 @@ msgstr "" msgid "save configuration file on exit" msgstr "guardar archivo de configuración al salir" +msgid "" +"use fsync to synchronize the configuration file with the storage device (see " +"man fsync); this is slower but should prevent any data loss in case of power " +"failure during the save of configuration file" +msgstr "" + #, fuzzy msgid "save layout on exit (buffers, windows, or both)" msgstr "guardar esquema al salir (buffers, ventanas o ambos)" diff --git a/po/fr.po b/po/fr.po index f3fdb1d00..53c51ced2 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-09-05 07:26+0200\n" -"PO-Revision-Date: 2017-09-05 07:27+0200\n" +"POT-Creation-Date: 2017-10-14 07:47+0200\n" +"PO-Revision-Date: 2017-10-14 07:48+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -4045,6 +4045,16 @@ msgstr "" msgid "save configuration file on exit" msgstr "sauvegarder la configuration en quittant" +msgid "" +"use fsync to synchronize the configuration file with the storage device (see " +"man fsync); this is slower but should prevent any data loss in case of power " +"failure during the save of configuration file" +msgstr "" +"utiliser fsync pour synchroniser le fichier de configuration avec le " +"périphérique de stockage (voir man fsync) ; cela est plus lent mais devrait " +"éviter toute perte de données en cas de panne de courant durant la " +"sauvegarde du fichier de configuration" + msgid "save layout on exit (buffers, windows, or both)" msgstr "" "sauvegarder la disposition en quittant (tampons, fenêtres, ou les deux)" diff --git a/po/hu.po b/po/hu.po index 5e469d2d7..d94999458 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-09-05 07:26+0200\n" +"POT-Creation-Date: 2017-10-14 07:47+0200\n" "PO-Revision-Date: 2017-06-26 23:32+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -3021,6 +3021,12 @@ msgstr "" msgid "save configuration file on exit" msgstr "beállítások mentése kilépéskor" +msgid "" +"use fsync to synchronize the configuration file with the storage device (see " +"man fsync); this is slower but should prevent any data loss in case of power " +"failure during the save of configuration file" +msgstr "" + msgid "save layout on exit (buffers, windows, or both)" msgstr "" diff --git a/po/it.po b/po/it.po index df12e5bca..6fc34a7bf 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-09-05 07:26+0200\n" +"POT-Creation-Date: 2017-10-14 07:47+0200\n" "PO-Revision-Date: 2017-06-26 23:32+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -3740,6 +3740,12 @@ msgstr "" msgid "save configuration file on exit" msgstr "salva file di configurazione all'uscita" +msgid "" +"use fsync to synchronize the configuration file with the storage device (see " +"man fsync); this is slower but should prevent any data loss in case of power " +"failure during the save of configuration file" +msgstr "" + #, fuzzy msgid "save layout on exit (buffers, windows, or both)" msgstr "salva layout all'uscita (buffer, finestre, o entrambi)" diff --git a/po/ja.po b/po/ja.po index 0c3854aa6..37b10e807 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-09-05 07:26+0200\n" +"POT-Creation-Date: 2017-10-14 07:47+0200\n" "PO-Revision-Date: 2017-09-10 09:00+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" "Language-Team: weechat-dev \n" @@ -3987,6 +3987,12 @@ msgstr "" msgid "save configuration file on exit" msgstr "zapisz plik konfiguracyjny przy wyjściu" +msgid "" +"use fsync to synchronize the configuration file with the storage device (see " +"man fsync); this is slower but should prevent any data loss in case of power " +"failure during the save of configuration file" +msgstr "" + msgid "save layout on exit (buffers, windows, or both)" msgstr "zapisz układ przy wyjściu (bufory, okna lub oba)" diff --git a/po/pt.po b/po/pt.po index 62926b2a6..7d7df4235 100644 --- a/po/pt.po +++ b/po/pt.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-09-05 07:26+0200\n" +"POT-Creation-Date: 2017-10-14 07:47+0200\n" "PO-Revision-Date: 2017-07-22 12:55+0200\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" @@ -3960,6 +3960,12 @@ msgstr "" msgid "save configuration file on exit" msgstr "guardar o ficheiro de configuração ao sair" +msgid "" +"use fsync to synchronize the configuration file with the storage device (see " +"man fsync); this is slower but should prevent any data loss in case of power " +"failure during the save of configuration file" +msgstr "" + msgid "save layout on exit (buffers, windows, or both)" msgstr "guardar a disposição ao sair (buffers, janelas ou ambos)" diff --git a/po/pt_BR.po b/po/pt_BR.po index cf579eef8..37863312d 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-09-05 07:26+0200\n" +"POT-Creation-Date: 2017-10-14 07:47+0200\n" "PO-Revision-Date: 2017-06-26 23:33+0200\n" "Last-Translator: Eduardo Elias \n" "Language-Team: weechat-dev \n" @@ -3636,6 +3636,12 @@ msgstr "" msgid "save configuration file on exit" msgstr "salva arquivo de configuração na saída" +msgid "" +"use fsync to synchronize the configuration file with the storage device (see " +"man fsync); this is slower but should prevent any data loss in case of power " +"failure during the save of configuration file" +msgstr "" + #, fuzzy msgid "save layout on exit (buffers, windows, or both)" msgstr "salva disposição na saída (buffers, janelas, ou ambos)" diff --git a/po/ru.po b/po/ru.po index 0a59ebd7d..24e2d6bf1 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-09-05 07:26+0200\n" +"POT-Creation-Date: 2017-10-14 07:47+0200\n" "PO-Revision-Date: 2017-06-26 23:33+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -3054,6 +3054,12 @@ msgstr "" msgid "save configuration file on exit" msgstr "сохранять конфигурационный файл при выходе" +msgid "" +"use fsync to synchronize the configuration file with the storage device (see " +"man fsync); this is slower but should prevent any data loss in case of power " +"failure during the save of configuration file" +msgstr "" + msgid "save layout on exit (buffers, windows, or both)" msgstr "" diff --git a/po/tr.po b/po/tr.po index 568a330ea..1c91062b5 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-09-05 07:26+0200\n" +"POT-Creation-Date: 2017-10-14 07:47+0200\n" "PO-Revision-Date: 2017-06-26 23:33+0200\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -2756,6 +2756,12 @@ msgstr "" msgid "save configuration file on exit" msgstr "" +msgid "" +"use fsync to synchronize the configuration file with the storage device (see " +"man fsync); this is slower but should prevent any data loss in case of power " +"failure during the save of configuration file" +msgstr "" + msgid "save layout on exit (buffers, windows, or both)" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index 3a174637f..21b8ffa53 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-09-05 07:26+0200\n" +"POT-Creation-Date: 2017-10-14 07:47+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -2752,6 +2752,12 @@ msgstr "" msgid "save configuration file on exit" msgstr "" +msgid "" +"use fsync to synchronize the configuration file with the storage device (see " +"man fsync); this is slower but should prevent any data loss in case of power " +"failure during the save of configuration file" +msgstr "" + msgid "save layout on exit (buffers, windows, or both)" msgstr "" diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c index 4a10443c4..19ac8c22f 100644 --- a/src/core/wee-config-file.c +++ b/src/core/wee-config-file.c @@ -2455,6 +2455,17 @@ config_file_write_internal (struct t_config_file *config_file, if (fflush (config_file->file) != 0) goto error; + /* + * ensure the file is really written on the storage device; + * this is disabled by default because it is really slow + * (about 20 to 200x slower) + */ + if (CONFIG_BOOLEAN(config_look_save_config_with_fsync)) + { + if (fsync (fileno (config_file->file)) != 0) + goto error; + } + /* close temp file */ fclose (config_file->file); config_file->file = NULL; diff --git a/src/core/wee-config.c b/src/core/wee-config.c index ff3497e17..d270dcfd3 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -178,6 +178,7 @@ struct t_config_option *config_look_read_marker; struct t_config_option *config_look_read_marker_always_show; struct t_config_option *config_look_read_marker_string; struct t_config_option *config_look_save_config_on_exit; +struct t_config_option *config_look_save_config_with_fsync; struct t_config_option *config_look_save_layout_on_exit; struct t_config_option *config_look_scroll_amount; struct t_config_option *config_look_scroll_bottom_after_switch; @@ -3347,6 +3348,17 @@ config_weechat_init_options () NULL, NULL, NULL, &config_change_save_config_on_exit, NULL, NULL, NULL, NULL, NULL); + config_look_save_config_with_fsync = config_file_new_option ( + weechat_config_file, ptr_section, + "save_config_with_fsync", "boolean", + N_("use fsync to synchronize the configuration file with the storage " + "device (see man fsync); this is slower but should prevent any " + "data loss in case of power failure during the save of " + "configuration file"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + &config_change_save_config_on_exit, NULL, NULL, + NULL, NULL, NULL); config_look_save_layout_on_exit = config_file_new_option ( weechat_config_file, ptr_section, "save_layout_on_exit", "integer", diff --git a/src/core/wee-config.h b/src/core/wee-config.h index f72c7de4d..4a438deaa 100644 --- a/src/core/wee-config.h +++ b/src/core/wee-config.h @@ -229,6 +229,7 @@ extern struct t_config_option *config_look_read_marker; extern struct t_config_option *config_look_read_marker_always_show; extern struct t_config_option *config_look_read_marker_string; extern struct t_config_option *config_look_save_config_on_exit; +extern struct t_config_option *config_look_save_config_with_fsync; extern struct t_config_option *config_look_save_layout_on_exit; extern struct t_config_option *config_look_scroll_amount; extern struct t_config_option *config_look_scroll_bottom_after_switch;