Subject: Re: [PATCH v2] t9604: Fix test for musl libc and new Debian

From: Đoàn Trần Công Danh <[email-masked]>
Date: Wed, 10 Apr 2024 14:10:40 +0700

On 2024-04-09 23:37:16-0400, Eric Sunshine <[email-masked]> wrote:
> On Tue, Apr 9, 2024 at 11:28 PM Đoàn Trần Công Danh
> <[email-masked]> wrote:
> > CST6CDT and the like are POSIX timezone, with no rule for transition.
> > And POSIX doesn't enforce how to interpret the rule if it's omited.
> > Some libc (e.g. glibc) resorted back to IANA (formerly Olson) db rules
> > for those timezones.  Some libc (e.g. FreeBSD) uses a fixed rule.
> > Other libc (e.g. musl) interpret that as no transition at all [1].
> >
> > In addition, distributions (notoriously Debian-derived, which uses IANA
> > db for CST6CDT and the like) started to split "legacy" timezones
> > like CST6CDT, EST5EDT into `tzdata-legacy', which will not be installed
> > by default [2].
> >
> > In those cases, t9604 will run into failure.
> >
> > Let's switch to POSIX timezone with rules to change timezone.
> >
> > Signed-off-by: Đoàn Trần Công Danh <[email-masked]>
> > ---
> > diff --git a/t/t9604-cvsimport-timestamps.sh b/t/t9604-cvsimport-timestamps.sh
> > @@ -3,11 +3,28 @@
> > +test_expect_success PERL,POSIX_TIMEZONE 'check timestamps are UTC' '
> >
> > -       TZ=CST6CDT git cvsimport -p"-x" -C module-1 module &&
> > +       TZ=CST6CDT,M4.1.0,M10.5.0 \
> > +       git cvsimport -p"-x" -C module-1 module &&
> >         git cvsimport -p"-x" -C module-1 module &&
> 
> Is this duplicated `git cvsimport` invocation intentional?

I have no idea whether that was intentional, it's there from the very
begining.  Apply this diff on top of my change, and tests still pass.
----- 8< ------

 t/t9604-cvsimport-timestamps.sh | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/t/t9604-cvsimport-timestamps.sh b/t/t9604-cvsimport-timestamps.sh
index 2d03259729b5f..c51a9fa8b6ca6 100755
--- a/t/t9604-cvsimport-timestamps.sh
+++ b/t/t9604-cvsimport-timestamps.sh
@@ -25,11 +25,7 @@ test_expect_success PERL,POSIX_TIMEZONE 'check timestamps are UTC' '
 
 	TZ=CST6CDT,M4.1.0,M10.5.0 \
 	git cvsimport -p"-x" -C module-1 module &&
-	git cvsimport -p"-x" -C module-1 module &&
-	(
-		cd module-1 &&
-		git log --format="%s %ai"
-	) >actual-1 &&
+	git -C module-1 log --format="%s %ai" >actual-1 &&
 	cat >expect-1 <<-EOF &&
 	Rev 16 2006-10-29 07:00:01 +0000
 	Rev 15 2006-10-29 06:59:59 +0000
@@ -60,10 +56,7 @@ test_expect_success PERL,POSIX_TIMEZONE 'check timestamps with author-specific t
 	user4=User Four <[email-masked]> MST7MDT,M4.1.0,M10.5.0
 	EOF
 	git cvsimport -p"-x" -A cvs-authors -C module-2 module &&
-	(
-		cd module-2 &&
-		git log --format="%s %ai %an"
-	) >actual-2 &&
+	git -C module-2 log --format="%s %ai %an" >actual-2 &&
 	cat >expect-2 <<-EOF &&
 	Rev 16 2006-10-29 01:00:01 -0600 User Two
 	Rev 15 2006-10-29 01:59:59 -0500 User Two
----- >8 ----------------

-- 
Danh