git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Tao Klerks <tao@klerks.biz>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Tao Klerks via GitGitGadget" <gitgitgadget@gmail.com>,
	git@vger.kernel.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Jeff Hostetler" <git@jeffhostetler.com>
Subject: Re: [PATCH v2 2/2] t7063: mtime-mangling instead of delays in untracked cache testing
Date: Tue, 1 Mar 2022 23:13:38 +0100	[thread overview]
Message-ID: <CAPMMpojJhw40DK7mEpZ-4ht6FHohAms=G9LsPQQx6+LCMmWtwA@mail.gmail.com> (raw)
In-Reply-To: <xmqqk0ddr1n1.fsf@gitster.g>

On Tue, Mar 1, 2022 at 7:03 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Tao Klerks via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > +chmtime_worktree_root () {
> > +     # chmtime doesnt handle relative paths on windows, so need
> > +     # to "hardcode" a reference to the worktree folder name.
> > +     test-tool -C .. chmtime $1 worktree
> > +}
> > +
>
> Enclose $1 in a pair of double-quotes to help readers.  They do not
> have to wonder if the caller is interested in (or has to worry
> about) triggering word splitting at $IFS if you did so.

Absolutely, thx.

>
> >  avoid_racy() {
> >       sleep 1
> >  }
> > @@ -90,6 +96,9 @@ test_expect_success 'setup' '
> >       cd worktree &&
> >       mkdir done dtwo dthree &&
> >       touch one two three done/one dtwo/two dthree/three &&
> > +     test-tool chmtime =-300 one two three done/one dtwo/two dthree/three &&
> > +     test-tool chmtime =-300 done dtwo dthree &&
> > +     chmtime_worktree_root =-300 &&
>
> I am wondering if it is better to spelling it out like this:
>
>         test-tool -C.. chmtime =-300 worktree &&
>
> instead of hiding the fact that "../worktree" is being touched
> behind a one-line helper.  Being able to explicitly write "worktree"
> in the context that this particular code path uses the "worktree"
> directory is a big plus, but at the same time, bypassing the helper
> makes it unclear why we just don't chmtime "../worktree", and will
> strongly tempt future developers into breaking it, so, I dunno.
>
> What's the reason why utime() works only on a path in the current
> directory and cannot take "../worktree" again? If we cannot solve
> that, I guess an extra helper with a big comment, like we see in
> this patch, would be the least bad solution.
>

Heh. It didn't work, in my initial tests. Now it does. It turns out I was
initially getting the directory handle with
"FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES", and
everything worked except modifying the current folder via a relative
path expression, which yielded a "Permission denied" error. I
worked around it by explicitly changing the current directory...

Then I realized FILE_WRITE_DATA wasn't necessary (but didn't
connect the dots). Then you noted the "-C .." arg to test-tool
(and I still didn't connect the dots).

The problem was never relative paths, but rather trying to get a
writable handle to the current directory. The only reason "-C .."
worked was that I already stopped trying to get a writable handle.

I have no idea what it means to get a writable handle to a
directory, but apparently you can't do it for your current
directory. Now I know.

Thanks for the nudge, this is all clean now.

  reply	other threads:[~2022-03-01 22:13 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-28  9:40 [PATCH 0/2] Reduce explicit sleep calls in t7063 untracked cache tests Tao Klerks via GitGitGadget
2022-02-28  9:40 ` [PATCH 1/2] t/helper/test-chmtime: update mingw to support chmtime on directories Tao Klerks via GitGitGadget
2022-02-28 15:27   ` Jeff Hostetler
2022-02-28 22:01     ` Junio C Hamano
2022-03-01  8:16     ` Tao Klerks
2022-02-28 22:00   ` Junio C Hamano
2022-03-01  8:21     ` Tao Klerks
2022-02-28  9:40 ` [PATCH 2/2] t7063: mtime-mangling instead of delays in untracked cache testing Tao Klerks via GitGitGadget
2022-02-28 22:19   ` Junio C Hamano
2022-03-01  9:44     ` Tao Klerks
2022-02-28 11:03 ` [PATCH 0/2] Reduce explicit sleep calls in t7063 untracked cache tests Ævar Arnfjörð Bjarmason
2022-02-28 15:29 ` Jeff Hostetler
2022-03-01  9:45 ` [PATCH v2 " Tao Klerks via GitGitGadget
2022-03-01  9:45   ` [PATCH v2 1/2] t/helper/test-chmtime: update mingw to support chmtime on directories Tao Klerks via GitGitGadget
2022-03-01 16:34     ` Jeff Hostetler
2022-03-01 21:14       ` Tao Klerks
2022-03-01  9:45   ` [PATCH v2 2/2] t7063: mtime-mangling instead of delays in untracked cache testing Tao Klerks via GitGitGadget
2022-03-01 18:03     ` Junio C Hamano
2022-03-01 22:13       ` Tao Klerks [this message]
2022-03-01  9:49   ` [PATCH v2 0/2] Reduce explicit sleep calls in t7063 untracked cache tests Tao Klerks
2022-03-01 17:49   ` Junio C Hamano
2022-03-02  6:05   ` [PATCH v3 " Tao Klerks via GitGitGadget
2022-03-02  6:05     ` [PATCH v3 1/2] t/helper/test-chmtime: update mingw to support chmtime on directories Tao Klerks via GitGitGadget
2022-03-09 21:46       ` Johannes Schindelin
2022-03-02  6:05     ` [PATCH v3 2/2] t7063: mtime-mangling instead of delays in untracked cache testing Tao Klerks via GitGitGadget
2022-03-09 21:53       ` Johannes Schindelin
2022-03-05  4:24     ` [PATCH v3 0/2] Reduce explicit sleep calls in t7063 untracked cache tests Tao Klerks
2022-03-06 21:57       ` Junio C Hamano
2022-03-07  5:37         ` Tao Klerks
2022-03-07 18:15           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPMMpojJhw40DK7mEpZ-4ht6FHohAms=G9LsPQQx6+LCMmWtwA@mail.gmail.com' \
    --to=tao@klerks.biz \
    --cc=avarab@gmail.com \
    --cc=git@jeffhostetler.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).