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

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

From
Đoàn Trần Công Danh <congdanhqx@gmail.com>
Date
Apr 10, 2024, 03:28 UTC
Message-ID
<20240410032812.30476-1-congdanhqx@gmail.com>
In-Reply-To
<23a4298eababe54ca4b43d7b675b858605d20ec5.1712374021.git.congdanhqx@gmail.com>

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.

1: http://mm.icann.org/pipermail/tz/2024-March/058751.html 2: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1043250

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
Range-diff against v1:
1:  23a4298eababe ! 1:  9494adb39120c t9604: Fix test for musl libc and new Debian
    @@ Commit message
     
         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 resorted back to IANA (formerly Olson) db rules for those
    -    timezones.  Other libc (e.g. musl) interpret that as no transition at
    -    all [1].
    +    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
    @@ Commit message
         Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
     
      ## t/t9604-cvsimport-timestamps.sh ##
    -@@ t/t9604-cvsimport-timestamps.sh: test_description='git cvsimport timestamps'
    +@@
    + test_description='git cvsimport timestamps'
    + . ./lib-cvs.sh
      
    ++test_lazy_prereq POSIX_TIMEZONE '
    ++	local tz=XST-1XDT,M3.5.0,M11.1.0
    ++	echo "1711846799 -> 2024-03-31 01:59:59 +0100" >expected &&
    ++	TZ="$tz" test-tool date show:iso-local 1711846799 >actual &&
    ++	test_cmp expected actual &&
    ++	echo "1711846800 -> 2024-03-31 03:00:00 +0200" >expected &&
    ++	TZ="$tz" test-tool date show:iso-local 1711846800 >actual &&
    ++	test_cmp expected actual &&
    ++	echo "1730591999 -> 2024-11-03 01:59:59 +0200" >expected &&
    ++	TZ="$tz" test-tool date show:iso-local 1730591999 >actual &&
    ++	test_cmp expected actual &&
    ++	echo "1730592000 -> 2024-11-03 01:00:00 +0100" >expected &&
    ++	TZ="$tz" test-tool date show:iso-local 1730592000 >actual &&
    ++	test_cmp expected actual
    ++'
    ++
      setup_cvs_test_repository t9604
      
     -test_expect_success PERL 'check timestamps are UTC (TZ=CST6CDT)' '
    -+test_expect_success PERL 'check timestamps are UTC (TZ=America/Chicago)' '
    ++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 \
    @@ t/t9604-cvsimport-timestamps.sh: test_description='git cvsimport timestamps'
      	git cvsimport -p"-x" -C module-1 module &&
      	(
      		cd module-1 &&
    -@@ t/t9604-cvsimport-timestamps.sh: test_expect_success PERL 'check timestamps with author-specific timezones' '
    +@@ t/t9604-cvsimport-timestamps.sh: test_expect_success PERL 'check timestamps are UTC (TZ=CST6CDT)' '
    + 	test_cmp expect-1 actual-1
    + '
    + 
    +-test_expect_success PERL 'check timestamps with author-specific timezones' '
    ++test_expect_success PERL,POSIX_TIMEZONE 'check timestamps with author-specific timezones' '
      
      	cat >cvs-authors <<-EOF &&
      	user1=User One <user1@domain.org>
 t/t9604-cvsimport-timestamps.sh | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/t/t9604-cvsimport-timestamps.sh b/t/t9604-cvsimport-timestamps.sh
index 2ff4aa932df44..2d03259729b5f 100755
--- a/t/t9604-cvsimport-timestamps.sh
+++ b/t/t9604-cvsimport-timestamps.sh
@@ -3,11 +3,28 @@
 test_description='git cvsimport timestamps'
 . ./lib-cvs.sh
 
+test_lazy_prereq POSIX_TIMEZONE '
+	local tz=XST-1XDT,M3.5.0,M11.1.0
+	echo "1711846799 -> 2024-03-31 01:59:59 +0100" >expected &&
+	TZ="$tz" test-tool date show:iso-local 1711846799 >actual &&
+	test_cmp expected actual &&
+	echo "1711846800 -> 2024-03-31 03:00:00 +0200" >expected &&
+	TZ="$tz" test-tool date show:iso-local 1711846800 >actual &&
+	test_cmp expected actual &&
+	echo "1730591999 -> 2024-11-03 01:59:59 +0200" >expected &&
+	TZ="$tz" test-tool date show:iso-local 1730591999 >actual &&
+	test_cmp expected actual &&
+	echo "1730592000 -> 2024-11-03 01:00:00 +0100" >expected &&
+	TZ="$tz" test-tool date show:iso-local 1730592000 >actual &&
+	test_cmp expected actual
+'
+
 setup_cvs_test_repository t9604
 
-test_expect_success PERL 'check timestamps are UTC (TZ=CST6CDT)' '
+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 &&
 	(
 		cd module-1 &&
@@ -34,13 +51,13 @@ test_expect_success PERL 'check timestamps are UTC (TZ=CST6CDT)' '
 	test_cmp expect-1 actual-1
 '
 
-test_expect_success PERL 'check timestamps with author-specific timezones' '
+test_expect_success PERL,POSIX_TIMEZONE 'check timestamps with author-specific timezones' '
 
 	cat >cvs-authors <<-EOF &&
 	user1=User One <user1@domain.org>
-	user2=User Two <user2@domain.org> CST6CDT
-	user3=User Three <user3@domain.org> EST5EDT
-	user4=User Four <user4@domain.org> MST7MDT
+	user2=User Two <user2@domain.org> CST6CDT,M4.1.0,M10.5.0
+	user3=User Three <user3@domain.org> EST5EDT,M4.1.0,M10.5.0
+	user4=User Four <user4@domain.org> MST7MDT,M4.1.0,M10.5.0
 	EOF
 	git cvsimport -p"-x" -A cvs-authors -C module-2 module &&
 	(
-- 
2.44.0.rc0.258.g7320e9588666f
Previous: Đoàn Trần Công DanhNext: Eric Sunshine
Message 8 of 12 in “t9604: Fix test for musl libc and new Debian”
  1. t9604: Fix test for musl libc and new DebianĐoàn Trần Công Danh, Apr 6, 2024
  2. Junio C HamanoApr 6, 2024
  3. Đoàn Trần Công DanhApr 7, 2024
  4. Junio C HamanoApr 8, 2024
  5. Jeff KingApr 7, 2024
  6. Đoàn Trần Công DanhApr 7, 2024
  7. Đoàn Trần Công DanhApr 7, 2024
  8. t9604: Fix test for musl libc and new DebianĐoàn Trần Công Danh, Apr 10, 2024
  9. Eric SunshineApr 10, 2024
  10. Đoàn Trần Công DanhApr 10, 2024
  11. Eric SunshineApr 10, 2024
  12. Đoàn Trần Công DanhApr 10, 2024

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.