-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

tag 767584 + patch
thanks

Please see the attached patch. This essentially replaces g_error() by
g_printerr(), now preventing a SIGTERM after g_error() is called.
According to [0] this is intended behavior, because g_error() should
be used for things like assertion failures, not for "expected" errors.

[0]
https://developer.gnome.org/glib/stable/glib-Message-Logging.html#g-error

Regards,

Simon



[0]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCgAGBQJUbekfAAoJEBy08PeN7K/pbbwP/iJMAcOyMvy1mRz94crmE2ww
fS3RRyg7gyl45LEhU6GDvt50CVuJIt59cQFuwuWuyR78Ldy1kmxs14Lc8zOSfIdT
hAyaMCUuPwstuzplTcXVYl9gjGV7vZyDaOVDBV8V3qIMfpHxjLYHgdyO8kvZ/ed7
Mg3a0f+YCVravhhEREZzs5wBlitG7//tCogAcPkJ5f5ZKfhkQEIAzUw9nUBAdHB0
U63ekb7qDtNZVDpBMWxmq8tdXeOavMMVtr7KnmhvrhvUpWfIqOksnHQXkla4p90V
Ynve/Sgz51p/XyWHZHHd68ANGYhTSqZu/nBGrt2hvy5L7MaTPWNCPiuob/WOT0ws
Yegmww3y1xUjBcq4elhKVrXgIu8e5KD6gZaPaWfharwNAR1VjmM8yHcxxHGZ4nrA
A61em804QO/6AYYQjqGts+kBxa/Vq62RztAVOYdQeqkE+nwbTJfDP2VvQkZF+YiA
zsTos/IdkolJhSvm2DwoNkkZdQ5cQLUilk/EFYztZiFojebNoKuJTY07c6jzyHzr
UyaoZKyQl/g6C9nn8qGcmIUWUDWIk/AsHdq0X4aGjHUauQ7vVCwivjFBuTJHXT3D
q7RNRn/wjSXyo7IdbM0mg/RIWzWy5cyFIO0K5/WDGTPQTDMEQu9Vg0vejagLSYYY
/L1iyM9+wEnnk0MSdWlP
=F1A+
-----END PGP SIGNATURE-----
Description: Fix segfaults if dots are used in the config file 
 
This patch fixes the segault issue by using g_printerr() in favor 
of g_error(), because the latter is used to report fatal errors (e.g
assertion failures), followed by a core dump. 

Author: Simon Kainz <si...@familiekainz.at>
Bug-Debian: https://bugs.debian.org/767584

---

--- apt-dater-1.0.1.orig/src/apt-dater.c
+++ apt-dater-1.0.1/src/apt-dater.c
@@ -123,7 +123,7 @@ int main(int argc, char **argv, char **e
  cfg = initialConfig();
 
  if(!(loadConfig(cfgfilename, cfg))) {
-  g_error(_("Error on loading config file %s\n"), cfgfilename);
+  g_printerr(_("Error on loading config file %s\n"), cfgfilename);
   exit(EXIT_FAILURE);
  }
 
--- apt-dater-1.0.1.orig/src/keyfiles.c
+++ apt-dater-1.0.1/src/keyfiles.c
@@ -151,9 +151,9 @@ gboolean loadConfig(char *filename, CfgF
     if(config_read_file(&hcfg, filename) == CONFIG_FALSE) {
 #ifdef HAVE_LIBCONFIG_ERROR_MACROS
       const char *efn = config_error_file(&hcfg);
-      g_error ("Error reading config file [%s:%d]: %s", (efn ? efn : filename), config_error_line(&hcfg), config_error_text(&hcfg));
+    g_printerr ("Error reading config file [%s:%d]: %s\n", (efn ? efn : filename), config_error_line(&hcfg), config_error_text(&hcfg));
 #else
-      g_error ("Error reading config file %s!", filename);
+      g_printerr ("Error reading config file %s!\n", filename);
 #endif
 	config_destroy(&hcfg);
 	return (FALSE);
@@ -197,14 +197,14 @@ gboolean loadConfig(char *filename, CfgF
 
     h = NULL;
     if(config_setting_lookup_string(s_ssh, "Cmd", (const char **) &h) == CONFIG_FALSE) {
-	g_error ("%s: Config option SSH.Cmd not set!", filename);
+	g_printerr ("%s: Config option SSH.Cmd not set!", filename);
 	return (FALSE);
     }
     lcfg->ssh_cmd = g_strdup(h);
 
     h = NULL;
     if(config_setting_lookup_string(s_ssh, "SFTPCmd", (const char **) &h) == CONFIG_FALSE) {
-	g_error ("%s: Config option SSH.SFTPCmd not set!", filename);
+	g_printerr ("%s: Config option SSH.SFTPCmd not set!", filename);
 	return (FALSE);
     }
     lcfg->sftp_cmd = g_strdup(h);
@@ -228,7 +228,7 @@ gboolean loadConfig(char *filename, CfgF
 	    }
 	}
 	else {
-	    g_error ("%s: setting %s must be a single string or an array of strings", filename, config_setting_name(s_addkeys));
+	    g_printerr ("%s: setting %s must be a single string or an array of strings", filename, config_setting_name(s_addkeys));
 	}
     }
 
@@ -295,9 +295,9 @@ GList *loadHosts (const char *filename)
     if(config_read_file(&hcfg, filename) == CONFIG_FALSE) {
 #ifdef HAVE_LIBCONFIG_ERROR_MACROS
       const char *efn = config_error_file(&hcfg);
-      g_error ("Error reading host file [%s:%d]: %s", (efn ? efn : filename), config_error_line(&hcfg), config_error_text(&hcfg));
+      g_printerr ("Error reading host file [%s:%d]: %s\n", (efn ? efn : filename), config_error_line(&hcfg), config_error_text(&hcfg));
 #else
-      g_error ("Error reading host file %s!", filename);
+      g_printerr ("Error reading host file %s!\n", filename);
 #endif
 	config_destroy(&hcfg);
 	return (FALSE);
@@ -305,7 +305,7 @@ GList *loadHosts (const char *filename)
 
     config_setting_t *cfghosts = config_lookup(&hcfg, "Hosts");
     if(cfghosts == NULL) {
-	g_error ("%s: No Hosts entries found.", filename);
+	g_printerr ("%s: No Hosts entries found.\n", filename);
 	config_destroy(&hcfg);
 	return (FALSE);
     }

Attachment: 00_fix_segfaults_when_dot_in_conffile.patch.sig
Description: PGP signature

Reply via email to