eb6853
From c65ba4b00ee3a98b80fa1a76e08ab06659a94ad4 Mon Sep 17 00:00:00 2001
eb6853
From: Frantisek Sumsal <fsumsal@redhat.com>
eb6853
Date: Mon, 2 Aug 2021 20:31:42 +0200
eb6853
Subject: [PATCH] test: add a test/reproducer for BZ#1989245
eb6853
eb6853
Taken from https://github.com/systemd/systemd/issues/8056#issue-293156936.
eb6853
eb6853
rhel-only
eb6853
Related: #1989245
eb6853
---
eb6853
 src/test/test-strv.c | 11 +++++++++++
eb6853
 1 file changed, 11 insertions(+)
eb6853
eb6853
diff --git a/src/test/test-strv.c b/src/test/test-strv.c
eb6853
index 5ae929c3f8..c86e07f592 100644
eb6853
--- a/src/test/test-strv.c
eb6853
+++ b/src/test/test-strv.c
eb6853
@@ -542,6 +542,16 @@ static void test_strv_reverse(void) {
eb6853
         assert_se(streq_ptr(d[3], NULL));
eb6853
 }
eb6853
 
eb6853
+static void test_utf8(void) {
eb6853
+        _cleanup_strv_free_ char **v = NULL;
eb6853
+        _cleanup_free_ char *s = NULL;
eb6853
+
eb6853
+        v = strv_new("/usr/bin/echo ", "привет", NULL);
eb6853
+        assert_se(v);
eb6853
+        s = strv_join_quoted(v);
eb6853
+        assert_se(s);
eb6853
+}
eb6853
+
eb6853
 int main(int argc, char *argv[]) {
eb6853
         test_specifier_printf();
eb6853
         test_strv_foreach();
eb6853
@@ -598,6 +608,7 @@ int main(int argc, char *argv[]) {
eb6853
         test_strv_equal();
eb6853
         test_strv_is_uniq();
eb6853
         test_strv_reverse();
eb6853
+        test_utf8();
eb6853
 
eb6853
         return 0;
eb6853
 }