2aacef
From 1ef6ffdf0923095752665c7ff6062514dfa6c6bf Mon Sep 17 00:00:00 2001
2aacef
From: Luca Boccassi <bluca@debian.org>
2aacef
Date: Fri, 4 Nov 2022 00:01:16 +0000
2aacef
Subject: [PATCH] firstboot: fix segfault when --locale-messages= is passed
2aacef
 without --locale=
2aacef
2aacef
\#0  __strcmp_evex () at ../sysdeps/x86_64/multiarch/strcmp-evex.S:295
2aacef
No locals.
2aacef
\#1  0x0000557444eb172b in process_locale () at ../src/firstboot/firstboot.c:342
2aacef
        etc_localeconf = 0x7ffd40217b80 "/root/root/etc/locale.conf"
2aacef
        locales = {0x0, 0x0, 0x0}
2aacef
        i = 0
2aacef
        r = <optimized out>
2aacef
        __PRETTY_FUNCTION__ = "process_locale"
2aacef
        __func__ = "process_locale"
2aacef
\#2  0x0000557444eaff93 in run (argv=0x7ffd40217d98, argc=3) at ../src/firstboot/firstboot.c:1401
2aacef
        loop_device = 0x0
2aacef
        unlink_dir = 0x0
2aacef
        r = <optimized out>
2aacef
        loop_device = <optimized out>
2aacef
        unlink_dir = <optimized out>
2aacef
        r = <optimized out>
2aacef
        __func__ = <optimized out>
2aacef
        __PRETTY_FUNCTION__ = <optimized out>
2aacef
        enabled = <optimized out>
2aacef
        _error = <optimized out>
2aacef
        _level = <optimized out>
2aacef
        _e = <optimized out>
2aacef
        _level = <optimized out>
2aacef
        _e = <optimized out>
2aacef
\#3  main (argc=3, argv=0x7ffd40217d98) at ../src/firstboot/firstboot.c:1432
2aacef
        r = <optimized out>
2aacef
        __PRETTY_FUNCTION__ = "main"
2aacef
2aacef
Fixes https://github.com/systemd/systemd/issues/25249
2aacef
2aacef
(cherry picked from commit 4c4a73ce068ef16cfe7ad07c7c3386ac1dbc58fe)
2aacef
2aacef
Related #2138081
2aacef
---
2aacef
 src/firstboot/firstboot.c | 2 +-
2aacef
 1 file changed, 1 insertion(+), 1 deletion(-)
2aacef
2aacef
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
2aacef
index 065ee896cd..63db78b52d 100644
2aacef
--- a/src/firstboot/firstboot.c
2aacef
+++ b/src/firstboot/firstboot.c
2aacef
@@ -339,7 +339,7 @@ static int process_locale(void) {
2aacef
 
2aacef
         if (!isempty(arg_locale))
2aacef
                 locales[i++] = strjoina("LANG=", arg_locale);
2aacef
-        if (!isempty(arg_locale_messages) && !streq(arg_locale_messages, arg_locale))
2aacef
+        if (!isempty(arg_locale_messages) && !streq_ptr(arg_locale_messages, arg_locale))
2aacef
                 locales[i++] = strjoina("LC_MESSAGES=", arg_locale_messages);
2aacef
 
2aacef
         if (i == 0)