On 2026/10/16 02:34, Andrea Pinski wrote:
> On Thu, Oct 15, 2026 at 6:09 AM Zhongteng Gui via Gcc <[email protected]> wrote:
>>
>> Hi,
>>
>> I am setting up GitHub Actions builds of GCC snapshots for MSYS2,
>> MinGW-w64, and Cygwin, using their existing package recipes.
>>
>> When testing GCC 17 snapshot 17-20261011, the MSYS2 builds failed while
>> extracting the source archive with bsdtar [1]:
>>
>>   gcc-17.0.0+20261011/.github/PULL_REQUEST_TEMPLATE.md:
>>   Can't create 'gcc-17.0.0+20261011/.github/PULL_REQUEST_TEMPLATE.md':
>>   No such file or directory
>>
>> .github/PULL_REQUEST_TEMPLATE.md is a symlink to CONTRIBUTING.md. This
>> means that extracting it on Windows with either GNU tar or bsdtar is
>> likely broken, see [2].
>>
>> Git blame shows that this change is GCC 17 only, so currently the mainline
>> MSYS2 and other Windows distributions are not interfered.
>>
>> Although this can be work arounded downstream by ignoring the error, it'd be
>> better if this could be solved upstream, by either of the following:
>>
>> 1. Add --dereference when creating archives (snapshots and releases) with tar
>>
>> 2. Remove the symlink from git, by making .github/PULL_REQUEST_TEMPLATE.md a
>> copy of .github/CONTRIBUTING.md.
> 
> Can you file this as a bug?  Or maybe propose a patch for either way;
> both ways seem fine?  I wonder if we could ignore these files while
> creating a snapshot too.  That is to ignore the files under .github.
> For case 1, the script is maintainer-scripts/gcc_release (for both
> snapshots and releases).
> 
> Thanks,
> Andrea
> 
>>
>> [1]: 
>> https://github.com/dragon-archer/gcc-for-windows/actions/runs/38725206073/job/116389828251
>> [2]: https://www.msys2.org/docs/symlinks/#known-issues
>>

Hi Andrea,

Thanks for pointing me to maintainer-scripts/gcc_release.

After several small tests, I chose not to add -h or --dereference, as
symlinks are filtered by `find`, so they aren't md5sum'ed.  I'm not sure
whether it's safe to replacing them with normal files.

Instead, the following patch allow excluding directories from both source
archives and checksums.  I default it to .github and .forgejo, which may
be changed in the future.

---

>From 28f7edcbbbae4850d48491467195fe84f8864889 Mon Sep 17 00:00:00 2001
From: Zhongteng Gui <[email protected]>
Date: Fri, 16 Oct 2026 03:13:11 +0800
Subject: [PATCH] maintainer-scripts: Exclude .github and .forgejo from
 archives and checksums

They are unrelated to building.  This also avoid including symlinks into
archives, which may break extracting on Windows (the only symlink now is
.github/PULL_REQUEST_TEMPLATE.md -> CONTRIBUTING.md).

Also bump copyright year.

maintainer-scripts/ChangeLog:

        * gcc_release: Allow excluding directories from archives and
        checksums, default to exclude .github and .forgejo.
        Bump copyright year.

Signed-off-by: Zhongteng Gui <[email protected]>
---
 maintainer-scripts/gcc_release | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/maintainer-scripts/gcc_release b/maintainer-scripts/gcc_release
index c7af3fdcb31..5e80cb45677 100755
--- a/maintainer-scripts/gcc_release
+++ b/maintainer-scripts/gcc_release
@@ -9,7 +9,7 @@
 # Contents:
 #   Script to create a GCC release.
 #
-# Copyright (c) 2001-2020 Free Software Foundation.
+# Copyright (c) 2001-2026 Free Software Foundation.
 #
 # This file is part of GCC.
 #
@@ -307,7 +307,11 @@ EOF
 # md5sum -c MD5SUMS | grep -v \"OK$\"
 #" > MD5SUMS
 
-  find . -type f |
+  find_excludes=""
+  for exclude in ${EXCLUDE_LIST}; do
+    find_excludes="${find_excludes} -name ${exclude} -prune -o"
+  done
+  find . ${find_excludes} -type f -print |
   sed -e 's:^\./::' -e '/MD5SUMS/d' |
   sort |
   xargs md5sum >>MD5SUMS
@@ -323,8 +327,13 @@ build_tarfile() {
   TARFILE="$1.tar.xz"
   shift
 
+  tar_excludes=""
+  for exclude in ${EXCLUDE_LIST}; do
+    tar_excludes="${tar_excludes} --exclude=${exclude}"
+  done
+
   # Build the tar file itself.
-  (${TAR} cf - "$@" | ${XZ} > ${TARFILE}) || \
+  (${TAR} cf - ${tar_excludes} "$@" | ${XZ} > ${TARFILE}) || \
     error "Could not build tarfile"
   FILE_LIST="${FILE_LIST} ${TARFILE}"
 }
@@ -624,6 +633,9 @@ MODE_UPLOAD=0
 # List of archive files generated; used to create .gz files from .xz.
 FILE_LIST=""
 
+# Folders to exclude from archive
+EXCLUDE_LIST="${EXCLUDE_LIST-.github .forgejo}"
+
 # Programs we use.
 
 BZIP2="${BZIP2:-bzip2}"
-- 
2.56.0.windows.2


Reply via email to