diff --git a/0001-Revert-settings.c-allow-load_open_settings-NULL.patch b/0001-Revert-settings.c-allow-load_open_settings-NULL.patch new file mode 100644 index 0000000..30f93d8 --- /dev/null +++ b/0001-Revert-settings.c-allow-load_open_settings-NULL.patch @@ -0,0 +1,78 @@ +From 39c20d4819794417e4e84429d1eb5430e3865b25 Mon Sep 17 00:00:00 2001 +From: Simon Tatham +Date: Sat, 13 Apr 2019 18:52:28 +0100 +Subject: [PATCH] Revert "settings.c: allow load_open_settings(NULL)." + +This reverts commit 1b2f39c24bb6591a4192377d9393f5c3e45cb5bd. + +The intention of that commit was to support the development of Uppity, +by arranging that I could get a Conf populated with completely default +values by calling load_open_settings(NULL,conf), with no risk of +interference from the normal PuTTY saved sessions full of client-side +configuration (which would have been confusing to apply unexpectedly +in a server). + +So I arranged that a NULL session handle was never passed to the +low-level read_setting_[type] functions, in case it caused a segfault. +But I overlooked two things. + +Firstly, on Unix, read_setting_* is where we check the tree234 of data +derived from X resources and/or -xrm command-line options. So if you +don't call those functions at all (e.g. if you have no on-disk PuTTY +saved configuration at all, not even Default Settings), you also don't +get your X defaults honoured. + +Secondly, those functions themselves already all checked their +argument for NULL before doing anything dangerous with it. So the +thing I wanted to make possible was already possible _anyway_, without +me having to do anything! + +So I'm exactly reverting that commit, because the _only_ thing it did +was to introduce a bug in X resource handling. +--- + settings.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/settings.c b/settings.c +index 54424f49..2c767a7a 100644 +--- a/settings.c ++++ b/settings.c +@@ -107,7 +107,7 @@ char *get_remote_username(Conf *conf) + + static char *gpps_raw(settings_r *sesskey, const char *name, const char *def) + { +- char *ret = sesskey ? read_setting_s(sesskey, name) : NULL; ++ char *ret = read_setting_s(sesskey, name); + if (!ret) + ret = platform_default_s(name); + if (!ret) +@@ -131,7 +131,7 @@ static void gpps(settings_r *sesskey, const char *name, const char *def, + static void gppfont(settings_r *sesskey, char *name, + Conf *conf, int primary) + { +- FontSpec *result = sesskey ? read_setting_fontspec(sesskey, name) : NULL; ++ FontSpec *result = read_setting_fontspec(sesskey, name); + if (!result) + result = platform_default_fontspec(name); + conf_set_fontspec(conf, primary, result); +@@ -140,7 +140,7 @@ static void gppfont(settings_r *sesskey, char *name, + static void gppfile(settings_r *sesskey, const char *name, + Conf *conf, int primary) + { +- Filename *result = sesskey ? read_setting_filename(sesskey, name) : NULL; ++ Filename *result = read_setting_filename(sesskey, name); + if (!result) + result = platform_default_filename(name); + conf_set_filename(conf, primary, result); +@@ -162,7 +162,7 @@ static void gppb(settings_r *sesskey, const char *name, bool def, + static int gppi_raw(settings_r *sesskey, const char *name, int def) + { + def = platform_default_i(name, def); +- return sesskey ? read_setting_i(sesskey, name, def) : def; ++ return read_setting_i(sesskey, name, def); + } + + static void gppi(settings_r *sesskey, const char *name, int def, +-- +2.21.0 + diff --git a/putty.changes b/putty.changes index 23cf191..fa14d78 100644 --- a/putty.changes +++ b/putty.changes @@ -3,6 +3,8 @@ Wed Apr 24 07:24:56 UTC 2019 - Jan Engelhardt - Reenable Xresources / remove -DNOT_X_WINDOWS [boo#1133181], the crash under Wayland appears gone. +- Add 0001-Revert-settings.c-allow-load_open_settings-NULL.patch + [boo#1133181] ------------------------------------------------------------------- Mon Mar 18 17:57:39 UTC 2019 - Jan Engelhardt diff --git a/putty.spec b/putty.spec index 5506d97..825d439 100644 --- a/putty.spec +++ b/putty.spec @@ -31,6 +31,7 @@ Source2: http://the.earth.li/~sgtatham/putty/latest/%name-%version.tar.gz Source4: %name.keyring Patch1: putty-03-config.diff Patch2: reproducible.patch +Patch3: 0001-Revert-settings.c-allow-load_open_settings-NULL.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: ImageMagick BuildRequires: gtk3-devel @@ -53,8 +54,7 @@ to xterm, "plink" is just the (console-based) SSH client similar to openssh, and "putty" is the program that combines both in one. %prep -%setup -q -%patch -P 1 -P 2 -p1 +%autosetup -p1 %build export CFLAGS="%optflags -Wno-error"