git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH 2/7] t0301: remove trailing / for dir creation

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 26, 2018, 06:40 UTC
Message-ID
<xmqqpnusxrxx.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<fdf6f2ec6296cf48f5e5ac5edc5fe93adca77f32.1543143503.git.carenas@gmail.com>
Carlo Marcelo Arenas Belón  <carenas@gmail.com> writes:
> the semantics of how mkdir -p should work, specially when using -m are
> not standard and in this case NetBSD will assume that the permision
> should not be changed, breaking the test

This does not explain, except for the fuzzy "in this case", why we want to lose trailing slash at all. If what you wanted to say was

    On NetBSD, "mkdir -p -m $bits path/to/dir/" ignores the
    permission bits when creating the directory component 'dir', but
    without the trailing slash at the end of "dir/", it works as
    expected.

then that would be an understandable justification for the patch. If you meant to say something else, then I couldn't read it from what you wrote, so the log message needs updating to help future readers.

> -p is technically not needed either, but will be cleared in a future
> patch eventhough it could be considered an alternative fix

I haven't seen the steps 3-7/7 yet, but if they remove "-p", then "but" would be a strange thing to say here. If they indeed do, then perhaps:

    The '-p' option is not needed in thse cases, as we know $HOME/
    exists in the test environment and we are creating a new
    directory directly under it.  It will be removed in a future
    patch in the series.  Removing '-p' could be an alternative fix,
    as the command then works as expected even on NetBSD with the
    trailing slash after directory name.

On the other hand, if future changes make it necessary to create two or more levels here, then

    At this point in the series, '-p' is not needed in thse cases,
    as we know $HOME/ exists in the test environment and we are
    creating .git-credential-cache directory directly under it.
    However, in later patches, we'll make it necessary for these
    'mkdir -p' to create two or more levels, so removing '-p' would
    be an alternative fix for this step, but would not work for the
    series as a whole.

would also make sense. I simply do not have enough information yet to tell which at this point in the series.

Show 34 quoted lines
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
>  t/t0301-credential-cache.sh | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/t/t0301-credential-cache.sh b/t/t0301-credential-cache.sh
> index fd92533acf..9529c612af 100755
> --- a/t/t0301-credential-cache.sh
> +++ b/t/t0301-credential-cache.sh
> @@ -77,9 +77,9 @@ test_expect_success "use custom XDG_CACHE_HOME even if xdg socket exists" '
>  test_expect_success 'use user socket if user directory exists' '
>  	test_when_finished "
>  		git credential-cache exit &&
> -		rmdir \"\$HOME/.git-credential-cache/\"
> +		rmdir \"\$HOME/.git-credential-cache\"
>  	" &&
> -	mkdir -p -m 700 "$HOME/.git-credential-cache/" &&
> +	mkdir -p -m 700 "$HOME/.git-credential-cache" &&
>  	check approve cache <<-\EOF &&
>  	protocol=https
>  	host=example.com
> @@ -92,10 +92,10 @@ test_expect_success 'use user socket if user directory exists' '
>  test_expect_success SYMLINKS 'use user socket if user directory is a symlink to a directory' '
>  	test_when_finished "
>  		git credential-cache exit &&
> -		rmdir \"\$HOME/dir/\" &&
> +		rmdir \"\$HOME/dir\" &&
>  		rm \"\$HOME/.git-credential-cache\"
>  	" &&
> -	mkdir -p -m 700 "$HOME/dir/" &&
> +	mkdir -p -m 700 "$HOME/dir" &&
>  	ln -s "$HOME/dir" "$HOME/.git-credential-cache" &&
>  	check approve cache <<-\EOF &&
>  	protocol=https
Previous: Carlo Marcelo Arenas BelónNext: Carlo Marcelo Arenas Belón
Message 5 of 16 in “test: NetBSD support”
  1. 0/7 test: NetBSD supportCarlo Marcelo Arenas Belón, Nov 25, 2018
  2. 1/7 Documentation: update INSTALL for NetBSDCarlo Marcelo Arenas Belón, Nov 25, 2018
  3. Junio C HamanoNov 26, 2018
  4. 2/7 t0301: remove trailing / for dir creationCarlo Marcelo Arenas Belón, Nov 25, 2018
  5. Junio C HamanoNov 26, 2018
  6. 3/7 config.mak.uname: NetBSD uses BSD semantics with fread for directoriesCarlo Marcelo Arenas Belón, Nov 25, 2018
  7. Junio C HamanoNov 26, 2018
  8. 4/7 config.mak.uname: NetBSD uses old iconv interfaceCarlo Marcelo Arenas Belón, Nov 25, 2018
  9. Junio C HamanoNov 26, 2018
  10. 5/7 test-lib: use pkgsrc provided unzip for NetBSDCarlo Marcelo Arenas Belón, Nov 25, 2018
  11. Junio C HamanoNov 26, 2018
  12. 6/7 t5004: use GNU tar to avoid known issues with BSD tarCarlo Marcelo Arenas Belón, Nov 25, 2018
  13. Junio C HamanoNov 26, 2018
  14. 7/7 config.mak.uname: use pkgsrc perl for NetBSDCarlo Marcelo Arenas Belón, Nov 25, 2018
  15. Junio C HamanoNov 26, 2018
  16. Ævar Arnfjörð BjarmasonNov 26, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.