Bug#1056916: freeciv fails to load saved games

2023-11-27 Thread Giacomo Mulas

On Mon, 27 Nov 2023, Marko Lindqvist wrote:


 This fix works at least in my tests.
 And it turned out to be a bit more complex than I thought, and it was on
the loading side after all.


I tested it, it works for me as well, apparently without ill side-effects.

Thanks.

Bye
Giacomo

--
_

Giacomo Mulas 
_

INAF - Osservatorio Astronomico di Cagliari
via della scienza 5 - 09047 Selargius (CA)

tel.   +39 070 71180255
mob. : +39 329  6603810
_

"every year keeps getting shorter, never seem to find the time
 plans that either come to naught, or half a page of scribbled lines
 the time is gone, the song is over, thought I'd something more to say"
 (Pink Floyd)
_

Bug#1056916: freeciv fails to load saved games

2023-11-26 Thread Marko Lindqvist
 This fix works at least in my tests.
 And it turned out to be a bit more complex than I thought, and it was on
the loading side after all.


 - ML
From 56d18b3c06e3c3b61908da30ab130d62f3e0e85d Mon Sep 17 00:00:00 2001
From: Marko Lindqvist 
Date: Mon, 27 Nov 2023 01:29:52 +0200
Subject: [PATCH] Reserve space for terminating NULL on astr_buffer

Growing the buffer was always considered a failure,
as it was one byte too small even after giving out
the requested size.

Reported by Giacomo Mulas

Debian Bug#1056916

Signed-off-by: Marko Lindqvist <
---
 utility/astring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/utility/astring.c b/utility/astring.c
index 44d39f582c..cfcb67565f 100644
--- a/utility/astring.c
+++ b/utility/astring.c
@@ -234,8 +234,8 @@ static inline void astr_vadd_at(struct astring *astr, size_t at,
   va_copy(copy, ap);
 
   req_len = fc_vsnprintf(buffer, buffer_size, format, ap);
-  if (req_len > buffer_size) {
-buffer = astr_buffer_grow(req_len, _size);
+  if (req_len + 1 > buffer_size) {
+buffer = astr_buffer_grow(req_len + 1, _size);
 /* Even if buffer is *still* too small, we fill what we can */
 req_len = fc_vsnprintf(buffer, buffer_size, format, copy);
 if (req_len > buffer_size) {
-- 
2.42.0



Bug#1056916: freeciv fails to load saved games

2023-11-26 Thread Giacomo Mulas

On Sun, 26 Nov 2023, Marko Lindqvist wrote:


 I confirmed the issue upstream. Our bugtracker is currently down, so
there's no upstream ticket to link to yet.

 The problem is on the saving side, not loading. Unfortunately this means
that some information is permanently lost, i.e., one will not be able to
load those saved games even after the bug gets fixed.


well, it's not like it's crucial data of strategic world importance, at
least in my case :) 
I will be more than happy if it gets fixed, I don't care that much if I will

not be able to load specific old saved games written before the fix.  Let me
know if I can help with testing.

Bye
Giacomo

--
_

Giacomo Mulas 
_

INAF - Osservatorio Astronomico di Cagliari
via della scienza 5 - 09047 Selargius (CA)

tel.   +39 070 71180255
mob. : +39 329  6603810
_

"every year keeps getting shorter, never seem to find the time
 plans that either come to naught, or half a page of scribbled lines
 the time is gone, the song is over, thought I'd something more to say"
 (Pink Floyd)
_

Bug#1056916: freeciv fails to load saved games

2023-11-26 Thread Marko Lindqvist
 I confirmed the issue upstream. Our bugtracker is currently down, so
there's no upstream ticket to link to yet.

 The problem is on the saving side, not loading. Unfortunately this means
that some information is permanently lost, i.e., one will not be able to
load those saved games even after the bug gets fixed.


Bug#1056916: freeciv fails to load saved games

2023-11-26 Thread Giacomo Mulas
Package: freeciv
Version: 3.0.8-1
Severity: normal

Dear Maintainer,

When playing a game in a large scenario (earth, giant), games saved after some 
turn do not get reloaded correctly. I attach here the last save that reloads 
correctly and the first that does not, to help debugging this. Let me know if 
there is some test I can do to help.

Best regards,
Giacomo Mulas


-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (401, 'unstable'), (10, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.5.0-4-amd64 (SMP w/12 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages freeciv depends on:
ii  freeciv-client-gtk3  3.0.8-1
ii  freeciv-data 3.0.8-1

freeciv recommends no packages.

freeciv suggests no packages.

-- no debconf information