aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ding-libs/path_utils_ut-allow-single-as-well.patch
blob: 08cfe09b82d6420efd888fc6d41a1260758c2199 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 4236e323e8ab4f13770e1ac9e94666b304b693fb Mon Sep 17 00:00:00 2001
From: Henrik Riomar <henrik.riomar@gmail.com>
Date: Tue, 24 Jul 2018 21:59:36 +0000
Subject: [PATCH] path_utils_ut: allow single / as well
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_266
  Multiple successive slashes are considered to be the same as one slash.

When running the tests on a musl libc system
 get_dirname(p, PATH_MAX, "//foo//")
actually results in a / and not //

Reviewed-by: Michal Židek <mzidek@redhat.com>
---
 path_utils/path_utils_ut.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/path_utils/path_utils_ut.c b/path_utils/path_utils_ut.c
index 27c99b6..061abfb 100644
--- a/path_utils/path_utils_ut.c
+++ b/path_utils/path_utils_ut.c
@@ -62,7 +62,7 @@ START_TEST(test_dirname)
     fail_unless_str_equal(p, "//foo");
 
     fail_unless(get_dirname(p, PATH_MAX, "//foo//") == SUCCESS);
-    fail_unless_str_equal(p, "//");
+    fail_unless(!strcmp(p, "/") || !strcmp(p, "//"));
 
     fail_unless(get_dirname(p, PATH_MAX, "foo//bar") == SUCCESS);
     fail_unless_str_equal(p, "foo");
-- 
2.18.0