Package: mccode
Severity: normal
Tags: patch
User: [email protected]
Usertags: fileorder timestamps usernname
X-Debbugs-Cc: [email protected]

Several issues were identified in mccode.

The embedded documentation tarballs include timestamps and user and
group information:

│ │ │ ├── ./usr/mcstas/3.5/doc/manuals/mcstas-components-html.tgz
│ │ │ │ ├── mcstas-components-html.tgz-content
│ │ │ │ │ ├── file list
│ │ │ │ │ │ @@ -1,743 +1,743 @@
│ │ │ │ │ │ --rw-r--r--   0 pbuilder1  (1111) pbuilder1  (1111)   186746 
2027-12-28 07:48:37.000000 Component_manual.html
│ │ │ │ │ │ --rw-r--r--   0 pbuilder1  (1111) pbuilder1  (1111)    89544 
2027-12-28 07:48:37.000000 Component_manual16.html
...
│ │ │ │ │ │ +-rw-r--r--   0 pbuilder2  (2222) pbuilder2  (2222)   186746 
2026-11-25 01:56:23.000000 Component_manual.html
│ │ │ │ │ │ +-rw-r--r--   0 pbuilder2  (2222) pbuilder2  (2222)    89544 
2026-11-25 01:56:23.000000 Component_manual16.html

The contents of those tarballs include a build year of the build:

│ │ │ │ │ ├── Component_manual.html
...
│ │ │ │ │ │  <!--l. 46--><p class="noindent" >                                  
                     Physics Department <span class="mathjax-inline">\(\cdot 
\)</span> DTU <span class="mathjax-inline">\(\cdot \)</span>
│ │ │ │ │ │ -2027
│ │ │ │ │ │ +2026

There is also a filesystem issue where the order of files output by find
produces different results in .xbb files produced:

│ │ │ │ ├── figures/choose_backend.xbb
│ │ │ │ │ @@ -1,6 +1,8 @@
│ │ │ │ │ -%%Title: figures/choose_backend.jpg
│ │ │ │ │ +%%Title: figures/choose_backend.pdf
│ │ │ │ │  %%Creator: extractbb.lua v1.1.0 (2025-02-11)
│ │ │ │ │ -%%BoundingBox: 0 0 712 567
│ │ │ │ │ -%%HiResBoundingBox: 0.000000 0.000000 712.000000 567.000000
│ │ │ │ │ +%%BoundingBox: 0 0 595 842
│ │ │ │ │ +%%HiResBoundingBox: 0.000000 0.000000 594.999997 842.000001
│ │ │ │ │ +%%PDFVersion: 1.5
│ │ │ │ │ +%%Pages: 1
│ │ │ │ │  %%CreationDate: Tue Nov 24 17:11:53 2026

The attached patches fix these issues by ensuring texlive respects
SOURCE_DATE_EPOCH by setting the FORCE_SOURCE_DATE in debian/rules,
by patching the documentation generation to pass arguments to tar, and 
ensuring that the cmake TIMESTAMP function uses UTC as the timezone.

I believe with these patches applied, mccode should build reproducibly
on reproducible.debian.net:

  https://reproduce.debian.net/excuses.html?source_name=mccode

... and should fix *most* issues on tests.reproducible-builds.org (there
is still an outstanding timezone-specific issue I have not figured out):

  https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/mccode.html

Thanks for maintaining mccode!

live well,
  vagrant
From 9d2ce224503402dc2836c218db8acb79714c59ad Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <[email protected]>
Date: Wed, 25 Nov 2026 21:00:20 -0800
Subject: [PATCH 1/6] debian/rules: Set FORCE_SOURCE_DATE to ensure texlive
 respects SOURCE_DATE_EPOCH.

https://reproducible-builds.org/docs/source-date-epoch/
---
 debian/rules | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/debian/rules b/debian/rules
index 72792390..92927758 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,6 +2,8 @@
 
 include /usr/share/dpkg/pkg-info.mk
 
+export FORCE_SOURCE_DATE=1
+
 # INSTALL_PREFIX=/usr/share
 INSTALL_PREFIX=/usr/
 MCCODE_VERSION=3
-- 
2.47.3

From 78118746072451718e6969fed03f27d72f6087eb Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <[email protected]>
Date: Wed, 25 Nov 2026 20:59:23 -0800
Subject: [PATCH 2/6] docs/manuals/mcstas/CMakeLists.txt: Pass arguments to tar
 for reproducible tarballs.

https://reproducible-builds.org/docs/archives/
---
 docs/manuals/mcstas/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/manuals/mcstas/CMakeLists.txt b/docs/manuals/mcstas/CMakeLists.txt
index 8c577123..3e45e39e 100644
--- a/docs/manuals/mcstas/CMakeLists.txt
+++ b/docs/manuals/mcstas/CMakeLists.txt
@@ -141,7 +141,7 @@ if(HTLATEX_EXECUTABLE AND BASH_EXECUTABLE AND PYTHON3_EXECUTABLE)
       COMMAND "${HTLATEX_EXECUTABLE}" "${DOC}.tex" "html,3,mathjax,charset=utf-8" " -cvalidate -cunihtf -utf8" ""
       COMMAND "${PYTHON3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/inject-toc-sidebar.py" "${DOC}"
       COMMAND "${BASH_EXECUTABLE}" "-c" "cat '${CMAKE_CURRENT_SOURCE_DIR}/html-style-overrides.css' >> '${DOC}.css'"
-      COMMAND "${BASH_EXECUTABLE}" "-c" "tar czf '${DOC}-html.tgz' ${DOC}*.html ${DOC}.css figures 2>/dev/null || tar czf '${DOC}-html.tgz' ${DOC}*.html ${DOC}.css"
+      COMMAND "${BASH_EXECUTABLE}" "-c" "tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner -czf '${DOC}-html.tgz' ${DOC}*.html ${DOC}.css figures 2>/dev/null || tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner -czf '${DOC}-html.tgz' ${DOC}*.html ${DOC}.css"
       WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
       DEPENDS "${PROJECT_BINARY_DIR}/${DOC}.pdf" "${CMAKE_CURRENT_SOURCE_DIR}/html-style-overrides.css" "${CMAKE_CURRENT_SOURCE_DIR}/generate-xbb-files.sh" "${CMAKE_CURRENT_SOURCE_DIR}/inject-toc-sidebar.py"
       COMMENT "Building HTML version of ${DOC} (tex4ht/MathJax), injecting TOC sidebar, and packaging as ${DOC}-html.tgz"
-- 
2.47.3

From 53060a0f2470ba334336499b49dee248656b2037 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <[email protected]>
Date: Thu, 26 Nov 2026 11:41:13 -0800
Subject: [PATCH 3/6] docs/manuals/mcxtrace/CMakeLists.txt: Pass arguments to
 tar for reproducible builds.

https://reproducible-builds.org/docs/archives/
---
 docs/manuals/mcxtrace/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/manuals/mcxtrace/CMakeLists.txt b/docs/manuals/mcxtrace/CMakeLists.txt
index 7b0b6c87..3d2bc959 100644
--- a/docs/manuals/mcxtrace/CMakeLists.txt
+++ b/docs/manuals/mcxtrace/CMakeLists.txt
@@ -142,7 +142,7 @@ if(HTLATEX_EXECUTABLE AND BASH_EXECUTABLE AND PYTHON3_EXECUTABLE)
       COMMAND "${HTLATEX_EXECUTABLE}" "${DOC}.tex" "html,3,mathjax,charset=utf-8" " -cvalidate -cunihtf -utf8" ""
       COMMAND "${PYTHON3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/inject-toc-sidebar.py" "${DOC}"
       COMMAND "${BASH_EXECUTABLE}" "-c" "cat '${CMAKE_CURRENT_SOURCE_DIR}/html-style-overrides.css' >> '${DOC}.css'"
-      COMMAND "${BASH_EXECUTABLE}" "-c" "tar czf '${DOC}-html.tgz' ${DOC}*.html ${DOC}.css figures 2>/dev/null || tar czf '${DOC}-html.tgz' ${DOC}*.html ${DOC}.css"
+      COMMAND "${BASH_EXECUTABLE}" "-c" "tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner -czf '${DOC}-html.tgz' ${DOC}*.html ${DOC}.css figures 2>/dev/null || tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner -czf '${DOC}-html.tgz' ${DOC}*.html ${DOC}.css"
       WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
       DEPENDS "${PROJECT_BINARY_DIR}/${DOC}.pdf" "${CMAKE_CURRENT_SOURCE_DIR}/html-style-overrides.css" "${CMAKE_CURRENT_SOURCE_DIR}/generate-xbb-files.sh" "${CMAKE_CURRENT_SOURCE_DIR}/inject-toc-sidebar.py"
       COMMENT "Building HTML version of ${DOC} (tex4ht/MathJax), injecting TOC sidebar, and packaging as ${DOC}-html.tgz"
-- 
2.47.3

From c7efc00509b0609e826dd97fc9cdcc147eb55ab5 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <[email protected]>
Date: Fri, 27 Nov 2026 10:26:43 -0800
Subject: [PATCH 4/6] docs/manuals/mcstas/generate-xbb-files.sh: generate xbb
 files in a predictible order.

Using find appears to generate XYZ.xbb from both XYZ.pdf and XYZ.png,
but in an unpredictible order.

https://reproducible-builds.org/docs/stable-inputs/
---
 docs/manuals/mcstas/generate-xbb-files.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/docs/manuals/mcstas/generate-xbb-files.sh b/docs/manuals/mcstas/generate-xbb-files.sh
index ddfde59d..ea0c7319 100644
--- a/docs/manuals/mcstas/generate-xbb-files.sh
+++ b/docs/manuals/mcstas/generate-xbb-files.sh
@@ -4,4 +4,6 @@
 # geometry directly out of these formats). Run from the manual's build
 # directory, before htlatex.
 set -e
-find figures -type f \( -iname '*.pdf' -o -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' \) -exec extractbb {} \; 2>/dev/null || true
+for x in pdf jpg jpeg png ; do
+	find figures -type f \( -iname '*.'"$x" \) -exec extractbb {} \; 2>/dev/null || true
+done
-- 
2.47.3

From 487424c7f9950e33a122cbedc7125e023b180eb8 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <[email protected]>
Date: Fri, 27 Nov 2026 10:28:42 -0800
Subject: [PATCH 5/6] docs/manuals/mcxtrace/generate-xbb-files.sh: generate xbb
 files in a predictible order.

Using find appears to generate XYZ.xbb from both XYZ.pdf and XYZ.png,
but in an unpredictible order.

https://reproducible-builds.org/docs/stable-inputs/
---
 docs/manuals/mcxtrace/generate-xbb-files.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/docs/manuals/mcxtrace/generate-xbb-files.sh b/docs/manuals/mcxtrace/generate-xbb-files.sh
index ddfde59d..ea0c7319 100644
--- a/docs/manuals/mcxtrace/generate-xbb-files.sh
+++ b/docs/manuals/mcxtrace/generate-xbb-files.sh
@@ -4,4 +4,6 @@
 # geometry directly out of these formats). Run from the manual's build
 # directory, before htlatex.
 set -e
-find figures -type f \( -iname '*.pdf' -o -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' \) -exec extractbb {} \; 2>/dev/null || true
+for x in pdf jpg jpeg png ; do
+	find figures -type f \( -iname '*.'"$x" \) -exec extractbb {} \; 2>/dev/null || true
+done
-- 
2.47.3

From 56d27907fd65d0dd97cbfa0fa089f40121cb2b54 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <[email protected]>
Date: Fri, 27 Nov 2026 13:23:17 -0800
Subject: [PATCH 6/6] cmake/Modules/InstallMCCODE.cmake: Use UTC to set
 MCCODE_YEAR.

https://tests.reproducible-builds.org/debian/issues/unstable/timestamps_in_cmake_issue.html
---
 cmake/Modules/InstallMCCODE.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmake/Modules/InstallMCCODE.cmake b/cmake/Modules/InstallMCCODE.cmake
index 928571dc..00842edf 100644
--- a/cmake/Modules/InstallMCCODE.cmake
+++ b/cmake/Modules/InstallMCCODE.cmake
@@ -73,7 +73,7 @@ macro(installMCCODE)
   
   include(CPack)
   
-  string(TIMESTAMP MCCODE_YEAR "%Y")
+  string(TIMESTAMP MCCODE_YEAR "%Y" UTC)
 
   ## Add global definitions
   # set_property(DIRECTORY ${CMAKE_SOURCE_DIR} APPEND PROPERTY COMPILE_DEFINITIONS
-- 
2.47.3

Attachment: signature.asc
Description: PGP signature

Reply via email to