All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC] t0060: basename("//") is implementation defined
@ 2016-01-13 20:56 tboegi
  2016-01-13 21:16 ` Junio C Hamano
  2016-01-14  7:00 ` Johannes Schindelin
  0 siblings, 2 replies; 4+ messages in thread
From: tboegi @ 2016-01-13 20:56 UTC (permalink / raw)
  To: tboegi, git

From: Torsten Bögershausen <tboegi@web.de>

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 <tboegi@web.de>
---
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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH/RFC] t0060: basename("//") is implementation defined
  2016-01-13 20:56 [PATCH/RFC] t0060: basename("//") is implementation defined tboegi
@ 2016-01-13 21:16 ` Junio C Hamano
  2016-01-14  7:00 ` Johannes Schindelin
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2016-01-13 21:16 UTC (permalink / raw)
  To: tboegi; +Cc: git

tboegi@web.de writes:

> From: Torsten Bögershausen <tboegi@web.de>
>
> 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 <tboegi@web.de>
> ---
> My version of a hot fix
>  test-path-utils.c | 2 ++
>  1 file changed, 2 insertions(+)

Thanks.  Ramsay gave a nice analysis at

  http://thread.gmane.org/gmane.comp.version-control.git/283928

and Dscho already is working on it, IIUC, in a slightly different
direction.

> 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)
>  	{ "///",             "//"     },
>  	{ "////",            "//"     },

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH/RFC] t0060: basename("//") is implementation defined
  2016-01-13 20:56 [PATCH/RFC] t0060: basename("//") is implementation defined tboegi
  2016-01-13 21:16 ` Junio C Hamano
@ 2016-01-14  7:00 ` Johannes Schindelin
  2016-01-14 11:47   ` Torsten Bögershausen
  1 sibling, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2016-01-14  7:00 UTC (permalink / raw)
  To: tboegi; +Cc: git

Hi Torsten,

On Wed, 13 Jan 2016, tboegi@web.de wrote:

> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH/RFC] t0060: basename("//") is implementation defined
  2016-01-14  7:00 ` Johannes Schindelin
@ 2016-01-14 11:47   ` Torsten Bögershausen
  0 siblings, 0 replies; 4+ messages in thread
From: Torsten Bögershausen @ 2016-01-14 11:47 UTC (permalink / raw)
  To: Johannes Schindelin, tboegi; +Cc: git

On 01/14/2016 08:00 AM, Johannes Schindelin wrote:
> Hi Torsten,
>
> On Wed, 13 Jan 2016, tboegi@web.de wrote:
>
>> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-14 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-13 20:56 [PATCH/RFC] t0060: basename("//") is implementation defined tboegi
2016-01-13 21:16 ` Junio C Hamano
2016-01-14  7:00 ` Johannes Schindelin
2016-01-14 11:47   ` Torsten Bögershausen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.