git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] t/Makefile: make sure that file names are truly platform-independent
Date: Mon, 15 Aug 2016 14:03:01 -0700	[thread overview]
Message-ID: <xmqqoa4tg2yi.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <xmqqk2fihv90.fsf@gitster.mtv.corp.google.com> (Junio C. Hamano's message of "Mon, 15 Aug 2016 09:06:35 -0700")

Junio C Hamano <gitster@pobox.com> writes:

> Good thinking.
>
> Some tests may have to be skipped on platforms that cannot express
> certain paths, but even then they shouldn't ship a file with
> pathname that cannot even be checked out (they should instead create
> and use such a path, protected behind filesystem specific test
> prerequisite).
>
>> +test-lint-filenames:
>> +	@illegal="$$(git ls-files | grep '["*:<>?\\|]')"; \
>
> This pattern must exclude questionables on either NTFS or HFS+; it
> is ironic that it is not even sufficient to limit ourselves to the
> Portable Character Set [*1*], but such is life.
>
> By the way, doesn't ls-files take pathspec glob, saving one extra
> process to run grep?
>
>     master$ git ls-files '*["*:<>?\\|]*'
>     pu$ git ls-files '*["*:<>?\\|]*'
>     t/t4013/diff.diff_--diff-line-prefix=-->_master_master^_side

One more thing you may want to exclude is HT.  Here is a suggested
reroll.  I reworded to avoid a subjective "truly platform-independent",
which is not what we intend to aim for anyway (we only try to support
the platforms we care about).

-- >8 --
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Mon, 15 Aug 2016 16:08:41 +0200
Subject: [PATCH] t/Makefile: make sure that paths can be checked out on
 platforms we care

Some pathnames that are okay on ext4 and on HFS+ cannot be checked
out on Windows.  Tests that want to see operations on such paths on
filesystems that support them must do so behind appropriate test
prerequisites, and must not include them in the source tree (instead
they should create them when they run).  Otherwise, the source tree
cannot be even checked out.

Make sure that double-quotes, asterisk, colon, greater/less-than,
question-mark, backslash, tab and vertical-bar never appears in the
pathnames with a new test-lint-* target as part of a `make test`.

Noticed when a topic wanted to add a pathname with '>' in it.  A
check like this will prevent a similar problems from happening.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/t/Makefile b/t/Makefile
index 18e2b28..d4b2a50 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -52,7 +52,8 @@ clean-except-prove-cache:
 clean: clean-except-prove-cache
 	$(RM) .prove
 
-test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
+test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \
+	test-lint-filenames
 
 test-lint-duplicates:
 	@dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
@@ -67,6 +68,11 @@ test-lint-executable:
 test-lint-shell-syntax:
 	@'$(PERL_PATH_SQ)' check-non-portable-shell.pl $(T) $(THELPERS)
 
+test-lint-filenames:
+	@bad=$$(git ls-files '*[	"*:<>?\\|]*'); \
+		test -z "$$bad" || { \
+		echo >&2 "do not use non-portable file name(s): $$bad"; exit 1; }
+
 aggregate-results-and-cleanup: $(T)
 	$(MAKE) aggregate-results
 	$(MAKE) clean
-- 
2.10.0-rc0-132-gce76bc9


  parent reply	other threads:[~2016-08-15 21:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-15 14:08 [PATCH] t/Makefile: make sure that file names are truly platform-independent Johannes Schindelin
2016-08-15 16:06 ` Junio C Hamano
2016-08-15 16:57   ` Junio C Hamano
2016-08-15 18:43     ` Jeff King
2016-08-16 13:10       ` Johannes Schindelin
2016-08-16 14:55         ` Jeff King
2016-08-16 15:37           ` Johannes Schindelin
2016-08-16 15:39             ` Jeff King
2016-08-15 21:03   ` Junio C Hamano [this message]
2016-08-16  8:29     ` Johannes Schindelin
2016-08-16  8:42       ` Johannes Schindelin
2016-08-16  9:53         ` Junio C Hamano
2016-08-16 10:07           ` Junio C Hamano
2016-08-16 15:10             ` Johannes Schindelin
2016-08-16 21:10         ` Johannes Sixt
2016-08-16  8:50 ` [PATCH v2] t/Makefile: make sure that paths can be checked out on platforms we care Johannes Schindelin
2016-08-16 15:13   ` [PATCH v3] t/Makefile: ensure that paths are valid " 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

  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=xmqqoa4tg2yi.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.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.
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).