Blob Blame History Raw
From c65ba4b00ee3a98b80fa1a76e08ab06659a94ad4 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <fsumsal@redhat.com>
Date: Mon, 2 Aug 2021 20:31:42 +0200
Subject: [PATCH] test: add a test/reproducer for BZ#1989245

Taken from https://github.com/systemd/systemd/issues/8056#issue-293156936.

rhel-only
Related: #1989245
---
 src/test/test-strv.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/test/test-strv.c b/src/test/test-strv.c
index 5ae929c3f8..c86e07f592 100644
--- a/src/test/test-strv.c
+++ b/src/test/test-strv.c
@@ -542,6 +542,16 @@ static void test_strv_reverse(void) {
         assert_se(streq_ptr(d[3], NULL));
 }
 
+static void test_utf8(void) {
+        _cleanup_strv_free_ char **v = NULL;
+        _cleanup_free_ char *s = NULL;
+
+        v = strv_new("/usr/bin/echo ", "привет", NULL);
+        assert_se(v);
+        s = strv_join_quoted(v);
+        assert_se(s);
+}
+
 int main(int argc, char *argv[]) {
         test_specifier_printf();
         test_strv_foreach();
@@ -598,6 +608,7 @@ int main(int argc, char *argv[]) {
         test_strv_equal();
         test_strv_is_uniq();
         test_strv_reverse();
+        test_utf8();
 
         return 0;
 }