From b96966058f4291db8970ced70ee22103e63679e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
Date: Fri, 23 Jan 2026 17:39:34 +0100
Subject: [PATCH] glib/tests/unicode: Add test debug information when parsing
 input files

On case of failures makes it easier to understand on what line of the
source file we're at, as it might not be clear for non-ascii chars

CVE: CVE-2026-1489
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/b96966058f4291db8970ced70ee22103e63679e5]
Signed-off-by: Peter Marko <peter.marko@siemens.com>
---
 glib/tests/unicode.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/glib/tests/unicode.c b/glib/tests/unicode.c
index 90b5a98b8..44d1083dd 100644
--- a/glib/tests/unicode.c
+++ b/glib/tests/unicode.c
@@ -600,6 +600,7 @@ test_casemap_and_casefold (void)
   const char *locale;
   const char *test;
   const char *expected;
+  size_t line = 0;
   char *convert;
   char *current_locale = setlocale (LC_CTYPE, NULL);
   char *old_lc_all, *old_lc_messages, *old_lang;
@@ -620,6 +621,7 @@ test_casemap_and_casefold (void)
 
   while (fgets (buffer, sizeof (buffer), infile))
     {
+      line++;
       if (buffer[0] == '#')
         continue;
 
@@ -662,6 +664,9 @@ test_casemap_and_casefold (void)
 
       convert = g_utf8_strup (test, -1);
       expected = strings[4][0] ? strings[4] : test;
+      g_test_message ("Converting '%s' => '%s' (line %" G_GSIZE_FORMAT ")",
+                      test, expected, line);
+
       g_assert_cmpstr (convert, ==, expected);
       g_free (convert);
 
@@ -681,9 +686,11 @@ test_casemap_and_casefold (void)
 
   infile = fopen (filename, "r");
   g_assert (infile != NULL);
+  line = 0;
 
   while (fgets (buffer, sizeof (buffer), infile))
     {
+      line++;
       if (buffer[0] == '#')
         continue;
 
@@ -693,6 +700,9 @@ test_casemap_and_casefold (void)
       test = strings[0];
 
       convert = g_utf8_casefold (test, -1);
+      g_test_message ("Converting '%s' => '%s' (line %" G_GSIZE_FORMAT ")",
+                      test, strings[1], line);
+
       g_assert_cmpstr (convert, ==, strings[1]);
       g_free (convert);
 
