[PATCH/RFC] t0060: basename("//") is implementation defined

Subsystems: the rest

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH/RFC] t0060: basename("//") is implementation defined

From: <hidden>
Date: 2016-06-15 23:07:44

From: Torsten Bögershausen <redacted>

From
http://pubs.opengroup.org/onlinepubs/9699919799/functions/basename.html
basename("//") may return either "//" or "/".

Linux returns "/", some systems like Mac OS X return "//".
Skip the test unless NO_LIBGEN_H is set and gitbasename() from
compat/basename is used.

Signed-off-by: Torsten Bögershausen <redacted>
---
My version of a hot fix
 test-path-utils.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/test-path-utils.c b/test-path-utils.c
index 4ab68ac..db0bb39 100644
--- a/test-path-utils.c
+++ b/test-path-utils.c
@@ -142,7 +142,9 @@ static struct test_data dirname_data[] = {
 	{ ".",               "."      },
 	{ "..",              "."      },
 	{ "/",               "/"      },
+#if defined(NO_LIBGEN_H)
 	{ "//",              "//"     },
+#endif
 #if defined(__CYGWIN__) && !defined(NO_LIBGEN_H)
 	{ "///",             "//"     },
 	{ "////",            "//"     },
-- 
2.7.0.278.g9379adb.dirty

Re: [PATCH/RFC] t0060: basename("//") is implementation defined

From: Johannes Schindelin <hidden>
Date: 2016-06-15 23:07:45

Hi Torsten,

On Wed, 13 Jan 2016, tboegi@web.de wrote:
quoted hunk
diff --git a/test-path-utils.c b/test-path-utils.c
index 4ab68ac..db0bb39 100644
--- a/test-path-utils.c
+++ b/test-path-utils.c
@@ -142,7 +142,9 @@ static struct test_data dirname_data[] = {
 	{ ".",               "."      },
 	{ "..",              "."      },
 	{ "/",               "/"      },
+#if defined(NO_LIBGEN_H)
 	{ "//",              "//"     },
+#endif
This would miss faulty implementations that return completely bogus
outputs for the "//" input. Not very likely, I agree, but the entire
intention of this regression test is to verify that Git's expectations are
met (and to document those expectations).

I hope you like the alternative patch I just sent out.

Ciao,
Dscho

Re: [PATCH/RFC] t0060: basename("//") is implementation defined

From: Torsten Bögershausen <hidden>
Date: 2016-06-15 23:07:45

On 01/14/2016 08:00 AM, Johannes Schindelin wrote:
Hi Torsten,

On Wed, 13 Jan 2016, tboegi@web.de wrote:
quoted
diff --git a/test-path-utils.c b/test-path-utils.c
index 4ab68ac..db0bb39 100644
--- a/test-path-utils.c
+++ b/test-path-utils.c
@@ -142,7 +142,9 @@ static struct test_data dirname_data[] = {
  	{ ".",               "."      },
  	{ "..",              "."      },
  	{ "/",               "/"      },
+#if defined(NO_LIBGEN_H)
  	{ "//",              "//"     },
+#endif
This would miss faulty implementations that return completely bogus
outputs for the "//" input. Not very likely, I agree, but the entire
intention of this regression test is to verify that Git's expectations are
met (and to document those expectations).

I hope you like the alternative patch I just sent out.
Yepp, looks good. Thanks for the work.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help