git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Stefan Beller <sbeller@google.com>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Torsten Bögershausen" <tboegi@web.de>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH] t1308: do not get fooled by symbolic links to the source tree
Date: Thu, 2 Jun 2016 21:07:17 -0400	[thread overview]
Message-ID: <20160603010717.GA16311@sigill.intra.peff.net> (raw)
In-Reply-To: <CAGZ79kY1ygqd4VmwMj4AGTxo2bO6HFKoShzv6S2MxFq6QNjM1w@mail.gmail.com>

On Thu, Jun 02, 2016 at 04:23:00PM -0700, Stefan Beller wrote:

> > To prevent this in the future, I switched my default --root= to point to
> > a symlink. I wonder if we could do something in the test suite, though,
> > as we did long ago by introducing "trash directory" with a space to
> > catch corner cases.
> >
> > I guess it would be something like:
> >
> >   if test_have_prereq SYMLINKS
> 
> IIUC this would need each test to be marked with SYMLINKS
> when testing with symlinks is desired. Marking a test with that
> is easily forgotten, so I'd rather do it by default as:
> 
> if (system supports symlinks):
> >   then
> >         mkdir "$TRASH_DIRECTORY.real" &&
> >         ln -s "$TRASH_DIRECTORY.real" "$TRASH_DIRECTORY"
> >   else
> >         mkdir "$TRASH_DIRECTORY"
> >   fi

I'm not sure I understand. My intent was to say "does the system support
symlinks" in test-lib.sh when setting up the trash directory. The
test_have_prereq function asks that, AFAIK (the "test_" prefix is not
"does _this_ test require it" but just "this function is in the test
namespace").

> I like the idea of testing with symlinks. (Does it have performance issues
> when everything goes through symlinks?)

I didn't notice any on my system (running with --root pointed at a
directory, and at a symlink to that directory). It would be extra work
whenever we determine a canonical absolute path, but I suspect that is
drowned out in the noise of the rest of the test suite. Plus some minor
extra work in the `ln` and `rm` calls during test setup/teardown, but
likewise that should be a small part of the total cost.

> On the other hand if we do tests by default in a symlinked path, we could
> introduce errors more easily in non-symlinked path, but that is what developers
> use for developing (I guess), so it's not as likely?

True, but I'd be surprised if there are bugs that show up in a
non-symlinked path that _do_ show up in a symlinked one.

I'm not sure if we've seen a case where this would find an actual bug in
git, though. The cases I remember were mostly about the test suite being
picky (i.e., git canonicalizes but the expected output doesn't, or vice
versa).

-Peff

  reply	other threads:[~2016-06-03  1:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31 22:15 What's cooking in git.git (May 2016, #09; Tue, 31) Junio C Hamano
2016-06-02 14:01 ` What's cooking in git.git (May 2016, #09; Tue, 31) t1308 broken Torsten Bögershausen
2016-06-02 21:22   ` Junio C Hamano
2016-06-02 21:31     ` Junio C Hamano
2016-06-02 21:39       ` Jeff King
2016-06-02 22:15         ` [PATCH] t1308: do not get fooled by symbolic links to the source tree Junio C Hamano
2016-06-02 23:16           ` Jeff King
2016-06-02 23:23             ` Stefan Beller
2016-06-03  1:07               ` Jeff King [this message]
2016-06-03  6:05           ` Johannes Sixt
2016-06-03  6:10             ` Jeff King
2016-06-03  6:53               ` Johannes Sixt
2016-06-03  9:19                 ` Torsten Bögershausen
2016-07-14 12:35                   ` Johannes Schindelin

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

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

  git send-email \
    --in-reply-to=20160603010717.GA16311@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sbeller@google.com \
    --cc=tboegi@web.de \
    /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.
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 NNTP newsgroup(s).