Repository: OCamlPro/gnucobol
Pull request #225: [GC4] Update CIs
Author: login: ddeclerck
Created: 2025-04-17T12:54:13Z | Merged: 2025-05-16T13:13:05Z

This PR:
- adds an Ubuntu Clang CI
- updates the MacOS CI
- makes some adjustments to all workflows to make them more similar to the ones in 3.x
- updates codegen to remove the need to use `-Wno-parentheses-equality` with Clang-based compilers


Diff:
diff --git a/.github/workflows/build_nightly.yml b/.github/workflows/build_nightly.yml
index 58cff0f70..957252836 100644
--- a/.github/workflows/build_nightly.yml
+++ b/.github/workflows/build_nightly.yml
@@ -9,6 +9,7 @@ on:
 
 jobs:
   build:
+    name: Build, test and provide nightly
     runs-on: ubuntu-latest
     timeout-minutes: 10
     strategy:
@@ -37,20 +38,45 @@ jobs:
           sudo apt -y install autoconf automake make libtool flex bison \
                               autopoint gettext help2man texinfo texlive \
                               gcc libgmp-dev libncurses-dev \
-                              libdb-dev libxml2-dev libcjson-dev
+                              libdb5.3-dev libxml2-dev libcjson-dev
 
-      - name: Install VISAM
+      - name: Restore VISAM cache
         if: ${{ matrix.isam == 'visam' }}
+        id: restore-visam
+        uses: actions/cache/restore@v4
+        with:
+          key: cache-visam
+          path: visam
+
+      - name: Build VISAM
+        if: ${{ matrix.isam == 'visam' &&
+                steps.restore-visam.outputs.cache-hit != 'true' }}
         run: |
           curl -LO http://inglenet.ca/Products/GnuCOBOL/visam-2.2.tar.Z
-          tar -xvzf visam-2.2.tar.Z
-          cd visam-2.2
-          ./configure --prefix=/opt/visam --enable-vbisamdefault
-          make && sudo make install
+          mkdir visam && tar -xvzf visam-2.2.tar.Z -C visam --strip-components=1
+          cd visam
+          ./configure --prefix=/opt/visam --enable-vbisamdefault \
+                      CFLAGS="-fstack-protector-strong -fstack-clash-protection -ggdb3 -fasynchronous-unwind-tables" \
+                      LDFLAGS="-fstack-protector-strong -fstack-clash-protection" \
+                      CPPFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
+          make --jobs=$(($(nproc)+1))
+
+      - name: Install VISAM
+        if: ${{ matrix.isam == 'visam' }}
+        run: |
+          sudo make -C visam install
           echo "CPATH=/opt/visam/include" >> $GITHUB_ENV
           echo "LIBRARY_PATH=/opt/visam/lib" >> $GITHUB_ENV
           echo "LD_LIBRARY_PATH=/opt/visam/lib" >> $GITHUB_ENV
 
+      - name: Save VISAM cache
+        if: ${{ matrix.isam == 'visam' &&
+                steps.restore-visam.outputs.cache-hit != 'true' }}
+        uses: actions/cache/save@v4
+        with:
+          key: cache-visam
+          path: visam
+
       - name: Bootstrap GnuCOBOL
         run: ./build_aux/bootstrap install
 
@@ -60,17 +86,19 @@ jobs:
           ../configure --with-${{ matrix.isam }} \
                        --with-indexed=${{ matrix.isam }} \
                        --enable-cobc-internal-checks \
-                       --enable-hardening
+                       --enable-hardening \
+                       --prefix=/opt/gnucobol \
+                       --with-pkgversion="GnuCOBOL CI"
           echo "VERSION=PACKAGE_VERSION" | cpp -P -imacros config.h | tr -d \" >> $GITHUB_ENV
 
       - name: Build GnuCOBOL
         run: make -C _build --jobs=$(($(nproc)+1))
 
-      - name: Upload config-${{ matrix.isam }}.log
+      - name: Upload config.log
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
-          name: config-${{ matrix.isam }}.log
+          name: config-${{ github.job }}-${{ matrix.isam }}.log
           path: _build/config.log
 
       # note: distcheck also creates the dist tarball
@@ -83,11 +111,11 @@ jobs:
           make -C _build --jobs=$(($(nproc)+1)) dist DIST_TARGETS="dist-gzip distwin-zip"
           make -C _build --jobs=$(($(nproc)+1)) distbin DISTBIN_TARGETS="distbin-xz"
 
-      - name: Upload testsuite-${{ matrix.isam }}.log
+      - name: Upload testsuite.log
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
-          name: testsuite-${{ matrix.isam }}.log
+          name: testsuite-${{ github.job }}-${{ matrix.isam }}.log
           path: _build/gnucobol-${{ env.VERSION }}/_build/sub/tests/testsuite.log
 
       - name: Upload dist tarball
@@ -131,7 +159,136 @@ jobs:
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
-          name: NIST85 results on ${{ matrix.isam }}
+          name: NIST85 results on ${{ github.job }}-${{ matrix.isam }}
+          path: |
+            _build/tests/cobol85/summary.*
+            _build/tests/cobol85/**/*.log
+            _build/tests/cobol85/**/*.out
+            _build/tests/cobol85/**/duration.txt
+
+
+  build_clang:
+    name: Build, test and provide nightly (Clang)
+    runs-on: ubuntu-latest
+    timeout-minutes: 10
+    strategy:
+      fail-fast: false
+      matrix:
+        isam:
+          - db
+          - visam
+
+    steps:
+
+      - name: Set git user
+        run: |
+          git config --global user.name github-actions
+          git config --global user.email github-actions-bot@users.noreply.github.com
+
+      - name: Checkout code
+        uses: actions/checkout@v4
+
+      - name: Setup build environment
+        run: echo "TERM=vt100" >> $GITHUB_ENV
+
+      - name: Install packages
+        run: |
+          sudo apt -y update
+          sudo apt -y install autoconf automake make libtool flex bison \
+                              autopoint gettext help2man texinfo texlive \
+                              clang libgmp-dev libncurses-dev \
+                              libdb5.3-dev libxml2-dev libcjson-dev
+
+      - name: Restore VISAM cache
+        if: ${{ matrix.isam == 'visam' }}
+        id: restore-visam
+        uses: actions/cache/restore@v4
+        with:
+          key: cache-visam-clang
+          path: visam
+
+      - name: Build VISAM
+        if: ${{ matrix.isam == 'visam' &&
+                steps.restore-visam.outputs.cache-hit != 'true' }}
+        run: |
+          curl -LO http://inglenet.ca/Products/GnuCOBOL/visam-2.2.tar.Z
+          mkdir visam && tar -xvzf visam-2.2.tar.Z -C visam --strip-components=1
+          cd visam
+          ./configure --prefix=/opt/visam --enable-vbisamdefault \
+                      CC=clang \
+                      CFLAGS="-fstack-protector-strong -fstack-clash-protection -ggdb3 -fasynchronous-unwind-tables" \
+                      LDFLAGS="-fstack-protector-strong -fstack-clash-protection" \
+                      CPPFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
+          make --jobs=$(($(nproc)+1))
+
+      - name: Install VISAM
+        if: ${{ matrix.isam == 'visam' }}
+        run: |
+          sudo make -C visam install
+          echo "CPATH=/opt/visam/include" >> $GITHUB_ENV
+          echo "LIBRARY_PATH=/opt/visam/lib" >> $GITHUB_ENV
+          echo "LD_LIBRARY_PATH=/opt/visam/lib" >> $GITHUB_ENV
+
+      - name: Save VISAM cache
+        if: ${{ matrix.isam == 'visam' &&
+                steps.restore-visam.outputs.cache-hit != 'true' }}
+        uses: actions/cache/save@v4
+        with:
+          key: cache-visam-clang
+          path: visam
+
+      - name: Bootstrap GnuCOBOL
+        run: ./build_aux/bootstrap install
+
+      - name: Configure GnuCOBOL
+        run: |
+          mkdir _build && cd _build
+          ../configure --with-${{ matrix.isam }} \
+                       --with-indexed=${{ matrix.isam }} \
+                       --enable-cobc-internal-checks \
+                       --enable-hardening \
+                       --prefix=/opt/gnucobol \
+                       --with-pkgversion="GnuCOBOL CI" \
+                       CC=clang
+          echo "VERSION=PACKAGE_VERSION" | cpp -P -imacros config.h | tr -d \" >> $GITHUB_ENV
+
+      - name: Build GnuCOBOL
+        run: make -C _build --jobs=$(($(nproc)+1))
+
+      - name: Upload config.log
+        if: ${{ !cancelled() }}
+        uses: actions/upload-artifact@v4
+        with:
+          name: config-${{ github.job }}-${{ matrix.isam }}.log
+          path: _build/config.log
+
+      - name: Run testsuite
+        run: |
+          make -C _build check TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" || \
+          make -C _build check TESTSUITEFLAGS="--recheck --verbose"
+
+      - name: Upload testsuite.log
+        if: ${{ !cancelled() }}
+        uses: actions/upload-artifact@v4
+        with:
+          name: testsuite-${{ github.job }}-${{ matrix.isam }}.log
+          path: _build/tests/testsuite.log
+
+      - name: Cache newcob.val
+        uses: actions/cache@v4
+        with:
+          path: _build/tests/cobol85/newcob.val
+          key: newcob-val
+          enableCrossOsArchive: true
+
+      - name: Run NIST85 testsuite
+        run: make -C _build test --jobs=$(($(nproc)+1))
+
+      - name: Upload NIST85 Test Suite results
+        if: ${{ !cancelled() }}
+        uses: actions/upload-artifact@v4
+        with:
+          name: NIST85 results on ${{ github.job }}-${{ matrix.isam }}
           path: |
             _build/tests/cobol85/summary.*
             _build/tests/cobol85/**/*.log
@@ -140,6 +297,7 @@ jobs:
 
 
   minmal_build:
+    name: Build and test with minimal dependencies
     needs: build
     runs-on: ubuntu-latest
     timeout-minutes: 10
@@ -172,11 +330,11 @@ jobs:
       - name: Build GnuCOBOL
         run: make -C _build --jobs=$(($(nproc)+1))
 
-      - name: Upload config-minimal.log
+      - name: Upload config.log
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
-          name: config-minimal.log
+          name: config-${{ github.job }}.log
           path: _build/config.log
 
       - name: Run testsuite
@@ -184,11 +342,11 @@ jobs:
           make -C _build check TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" || \
           make -C _build check TESTSUITEFLAGS="--recheck --verbose"
 
-      - name: Upload testsuite-minimal.log
+      - name: Upload testsuite.log
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
-          name: testsuite-minimal.log
+          name: testsuite-${{ github.job }}.log
           path: _build/tests/testsuite.log
 
       - name: Cache newcob.val
@@ -205,7 +363,7 @@ jobs:
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
-          name: NIST85 results on minimal
+          name: NIST85 results on ${{ github.job }}
           path: |
             _build/tests/cobol85/summary.*
             _build/tests/cobol85/**/*.log
@@ -214,7 +372,11 @@ jobs:
 
 
   coverage:
+    name: Coverage and Warnings
     needs: build
+# Since the latest Ubuntu image, lcov fails complaining about negative branch counts,
+# and using fprofile-update=atomic as suggested does not help, so use the previous image
+#    runs-on: ubuntu-latest
     runs-on: ubuntu-22.04
     timeout-minutes: 10
 
@@ -243,19 +405,19 @@ jobs:
       - name: Configure GnuCOBOL
         run: |
           mkdir _build && cd _build
-          ../configure --with-db --with-indexed=db \
-                       --enable-code-coverage \
+          ../configure --enable-code-coverage \
+                       --with-db --with-indexed=db --with-xml2 --with-json=cjson --with-curses=ncursesw \
                        CPPFLAGS="-Werror=declaration-after-statement" \
                        CC="gcc -std=c89"
 
       - name: Build GnuCOBOL
         run: make -C _build --jobs=$(($(nproc)+1))
 
-      - name: Upload config-coverage.log
+      - name: Upload config.log
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
-          name: config-coverage.log
+          name: config-${{ github.job }}.log
           path: _build/config.log
 
       - name: Coverage
@@ -265,18 +427,18 @@ jobs:
           make -C _build code-coverage-capture \
                          CODE_COVERAGE_DIRECTORY="$(realpath .)/_build"
 
-      - name: Upload testsuite-coverage.log
+      - name: Upload testsuite.log
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
-          name: testsuite-coverage.log
+          name: testsuite-${{ github.job }}.log
           path: _build/tests/testsuite.log
 
       - name: Upload coverage report
         uses: actions/upload-artifact@v4
         with:
           name: coverage
-          path: _build/GnuCOBOL-**-coverage/
+          path: _build/GnuCOBOL-**-coverage
 
       - name: Cache newcob.val
         uses: actions/cache@v4
@@ -300,7 +462,7 @@ jobs:
           path: _build/extended-coverage
 
       - name: Upload coverage to codecov
-        uses: codecov/codecov-action@v2
+        uses: codecov/codecov-action@v3
         with:
           # token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
           directory: _build
@@ -366,7 +528,6 @@ jobs:
             echo CFGOPT="--with-pkgversion=GnuCOBOL-CI-MSYS-Debug --enable-debug --enable-cobc-internal-checks --enable-hardening" >> $env:GITHUB_ENV
           }
 
-
       - name: Restore MSYS1 cache
         id: restore-msys
         uses: actions/cache/restore@v4
@@ -389,7 +550,7 @@ jobs:
         run: |
           rmdir /Q /S %MSYS_ROOT%\docs
           rmdir /Q /S %MSYS_ROOT%\var
-          del /Q %MSYS_ROOT%\bin\gdb.exe
+          del /Q %MSYS_ROOT%\bin\gdb*
 
       - name: Save MSYS1 cache
         if: steps.restore-msys.outputs.cache-hit != 'true'
@@ -540,7 +701,7 @@ jobs:
           rem  Note: the extra CPATH above is only required in debug builds
           rem  (otherwise gcc invoked from cobc does not find libcob.h [pre-inst-env]), for some reason...
 
-      - name: Upload config-msys-${{ matrix.target }}.log
+      - name: Upload config.log
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
@@ -589,7 +750,7 @@ jobs:
           rem  Note: the extra CPATH above is only required in debug builds
           rem  (otherwise gcc invoked from cobc does not find libcob.h [atlocal]), for some reason...
 
-      - name: Upload testsuite-msys-${{ matrix.target }}.log
+      - name: Upload testsuite.log
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
@@ -599,7 +760,7 @@ jobs:
       - name: Package GnuCOBOL MinGW nightly
         run: bash -lc "make -C _build distmingw"
 
-      - name: Upload GnuCOBOL_mingw-${{ matrix.target }}
+      - name: Upload GnuCOBOL_mingw
         uses: actions/upload-artifact@v4
         with:
           name: GnuCOBOL_mingw-${{ matrix.target }}
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml
index 52f004ad9..8d7c149b9 100644
--- a/.github/workflows/macos.yml
+++ b/.github/workflows/macos.yml
@@ -51,25 +51,51 @@ jobs:
           echo "LDFLAGS=-L$HOMEBREW_ROOT/berkeley-db@4/lib -L$HOMEBREW_ROOT/libiconv/lib ${LDFLAGS}" >> $GITHUB_ENV
           echo "CPPFLAGS=-I$HOMEBREW_ROOT/berkeley-db@4/include -I$HOMEBREW_ROOT/libiconv/include ${CPPFLAGS}" >> $GITHUB_ENV
 
-
-      - name: Install VISAM
+      - name: Restore VISAM cache
         if: ${{ matrix.isam == 'visam' }}
+        id: restore-visam
+        uses: actions/cache/restore@v4
+        with:
+          key: cache-visam-macos
+          path: visam
+
+      - name: Build VISAM
+        if: ${{ matrix.isam == 'visam' &&
+                steps.restore-visam.outputs.cache-hit != 'true' }}
         run: |
           curl -LO http://inglenet.ca/Products/GnuCOBOL/visam-2.2.tar.Z
-          tar -xvzf visam-2.2.tar.Z
-          cd visam-2.2
-          ./configure --prefix=/opt/visam --enable-vbisamdefault
+          mkdir visam && tar -xvzf visam-2.2.tar.Z -C visam --strip-components=1
+          cd visam
+          ./configure --prefix=/opt/visam --enable-vbisamdefault \
+                      CFLAGS="-fstack-protector-strong -fstack-clash-protection -ggdb3 -fasynchronous-unwind-tables" \
+                      LDFLAGS="-fstack-protector-strong -fstack-clash-protection" \
+                      CPPFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
           chmod u+x build_aux/install-sh
-          make && sudo make install
+          make --jobs=$(($(nproc)+1))
+
+      - name: Install VISAM
+        if: ${{ matrix.isam == 'visam' }}
+        run: |
+          sudo make -C visam install
           echo "CPATH=/opt/visam/include" >> $GITHUB_ENV
           echo "LIBRARY_PATH=/opt/visam/lib" >> $GITHUB_ENV
           echo "LD_LIBRARY_PATH=/opt/visam/lib" >> $GITHUB_ENV
 
+      - name: Save VISAM cache
+        if: ${{ matrix.isam == 'visam' &&
+                steps.restore-visam.outputs.cache-hit != 'true' }}
+        uses: actions/cache/save@v4
+        with:
+          key: cache-visam-macos
+          path: visam
+
       - name: Bootstrap GnuCOBOL
         run: |
           ./build_aux/bootstrap install
           gettextize -f
 
+      # Note: READ_WRITE_NEEDS_FLUSH is required, otherwise this test fails:
+      #           LINE SEQUENTIAL COMMIT / ROLLBACK (run_file.at)
       - name: Configure GnuCOBOL
         run: |
           mkdir _build && cd _build
@@ -79,13 +105,12 @@ jobs:
                        --enable-hardening \
                        --with-curses=ncurses \
                        --prefix=/opt/cobol/gnucobol \
-                       CPPFLAGS="-DREAD_WRITE_NEEDS_FLUSH $CPPFLAGS" \
-                       CFLAGS="-Wno-parentheses-equality $CFLAGS"
+                       CPPFLAGS="-DREAD_WRITE_NEEDS_FLUSH $CPPFLAGS"
 
       - name: Build GnuCOBOL
         run: make -C _build --jobs=$((${NPROC}+1))
 
-      - name: Upload config-${{ matrix.isam }}.log
+      - name: Upload config.log
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
@@ -99,7 +124,7 @@ jobs:
           sudo make -C _build install
           find /opt/cobol > _build/install.log
 
-      - name: Upload install-${{ matrix.isam }}.log
+      - name: Upload install.log
         uses: actions/upload-artifact@v4
         with:
           name: install-${{ matrix.isam }}.log
@@ -124,7 +149,7 @@ jobs:
           make -C _build check TESTSUITEFLAGS="--jobs=$((${NPROC}+1))" || \
           make -C _build check TESTSUITEFLAGS="--recheck --verbose"
 
-      - name: Upload testsuite-${{ matrix.isam }}.log
+      - name: Upload testsuite.log
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
diff --git a/.github/workflows/windows-msvc.yml b/.github/workflows/windows-msvc.yml
index b2ed1fac8..8a1279ddb 100644
--- a/.github/workflows/windows-msvc.yml
+++ b/.github/workflows/windows-msvc.yml
@@ -31,7 +31,7 @@ defaults:
 jobs:
   build:
     runs-on: windows-latest
-    timeout-minutes: ${{ matrix.target == 'Debug' && 40 || 25 }}
+    timeout-minutes: 25
     strategy:
       fail-fast: false
       matrix:
@@ -203,7 +203,7 @@ jobs:
           set MSYS2_PATH_TYPE=inherit
           C:\shells\msys2bash.cmd -c "./testsuite --jobs=4 || ./testsuite --recheck --verbose"
 
-      - name: Upload testsuite-${{ matrix.arch }}-${{ matrix.target }}.log
+      - name: Upload testsuite.log
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
diff --git a/.github/workflows/windows-msys2.yml b/.github/workflows/windows-msys2.yml
index 87bd48198..f8d4e9f6d 100644
--- a/.github/workflows/windows-msys2.yml
+++ b/.github/workflows/windows-msys2.yml
@@ -41,7 +41,10 @@ jobs:
         shell: msys2 {0}
         run: |
           mkdir _build && cd _build
-          ../configure --without-curses --without-db --without-xml2 --without-json CFLAGS=-std=c17
+          # this is a "prepare" only step for this workflow only, so build
+          # without any optional packages as one-time build speeding up this part
+          ../configure --without-curses --without-db --without-xml2 --without-json \
+                       --without-iconv --disable-dependency-tracking CFLAGS=-std=c17
 
       - name: Build GnuCOBOL source distribution
         shell: msys2 {0}
@@ -50,7 +53,7 @@ jobs:
           OSTYPE=msys make -C _build --jobs=$(($(nproc)+1))
           OSTYPE=msys make -C _build --jobs=$(($(nproc)+1)) dist
 
-      - name: Upload config-dist.log
+      - name: Upload config.log
         uses: actions/upload-artifact@v4
         if: ${{ !cancelled() }}
         with:
@@ -132,13 +135,15 @@ jobs:
         shell: msys2 {0}
         run: |
           mkdir _build && cd _build
-          PATH="$PATH:/c/Program Files/Git/usr/bin" ../configure $CFGOPT CFLAGS="-std=c17 -Wno-parentheses-equality $CFLAGS"
+          # Note: we add the path to git-bash so that we can use the diff
+          # command it provides, to workaround a diff bug under the MSYS2 CI
+          PATH="$PATH:/c/Program Files/Git/usr/bin" ../configure $CFGOPT CFLAGS=-std=c17
 
       - name: Build GnuCOBOL
         shell: msys2 {0}
         run: make -C _build --jobs=$(($(nproc)+1))
 
-      - name: Upload config-${{ matrix.sys }}-${{ matrix.target }}.log
+      - name: Upload config.log
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
@@ -176,11 +181,13 @@ jobs:
         continue-on-error: true
         shell: msys2 {0}
         run: |
+          # to work around regular hangs we run NIST first, then the internal
+          # and the later only with 2 jobs
           # OSTYPE added on 2025-02-11 to fix texi2dvi bug
-          OSTYPE=msys make -C _build check TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" || \
+          OSTYPE=msys make -C _build check TESTSUITEFLAGS="--jobs=2" || \
           OSTYPE=msys make -C _build check TESTSUITEFLAGS="--recheck --verbose"
 
-      - name: Upload testsuite-${{ matrix.sys }}-${{ matrix.target }}.log
+      - name: Upload testsuite.log
         if: ${{ !cancelled() }}
         uses: actions/upload-artifact@v4
         with:
@@ -193,7 +200,7 @@ jobs:
           make -C _build distmingw
           tar -cvf GnuCOBOL_msys2-${{ matrix.sys }}-${{ matrix.target }}.tar _build/$DISTDIR
 
-      - name: Upload GnuCOBOL_msys2-${{ matrix.sys }}-${{ matrix.target }}.tar
+      - name: Upload GnuCOBOL_msys2.tar
         uses: actions/upload-artifact@v4
         with:
           name: GnuCOBOL_msys2-${{ matrix.sys }}-${{ matrix.target }}.tar


Reviews:
user: login: GitMensch
body: This looks quite reasonable for me. The non-ci parts should go to 3.x though first and be merged later on (=soon); for configure+diuff I'm not sure about the plain use of AC_ARG_VAR, yet.
state: CHANGES_REQUESTED
author_association: COLLABORATOR
submitted_at: 2025-04-28T10:08:11Z
user: login: ddeclerck
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-01T21:26:52Z
user: login: GitMensch
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-05-02T05:47:53Z
user: login: GitMensch
body: LGTM. The use of SOURCE_DATE_EPOCH in the testsuite should be done in 3.x (likely allows a much easier sed script for processing where it is still necessary and possibly allows us to drop it) then to be merged over to 4.x.
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-05-16T11:54:23Z

Review comments:
diff_hunk: @@ -58,6 +58,11 @@ GREP=@GREP@
 SED=@SED@
 export AWK GREP SED
 
+diff() {
path: tests/atlocal.in
user: login: GitMensch
body: this definitely needs a comment :-)
created_at: 2025-04-28T10:03:53Z
author_association: COLLABORATOR
diff_hunk: @@ -652,6 +652,13 @@ AX_PROG_BISON
 dnl AC_PATH_PROG([BISON],[bison])
 dnl AX_PROG_BISON_VERSION([3.0.2],[],[ ... ])
 
+AC_ARG_VAR(DIFF, diff command)
path: configure.ac
user: login: GitMensch
body: This sets the variable as precious, which is good; but shouldn't the program itself be configured with a "generic program" macro, especially `AC_PATH_PROGS_FEATURE_CHECK` (which also uses programs "later in PATH")?
https://www.gnu.org/software/autoconf/manual/autoconf-2.70/html_node/Generic-Programs.html
created_at: 2025-04-28T10:04:52Z
author_association: COLLABORATOR
diff_hunk: @@ -652,6 +652,13 @@ AX_PROG_BISON
 dnl AC_PATH_PROG([BISON],[bison])
 dnl AX_PROG_BISON_VERSION([3.0.2],[],[ ... ])
 
+AC_ARG_VAR(DIFF, diff command)
path: configure.ac
user: login: ddeclerck
body: Wouldn't `AC_PATH_PROG` be sufficient (as for `bison` above) ?
created_at: 2025-05-01T21:26:52Z
author_association: COLLABORATOR
diff_hunk: @@ -652,6 +652,13 @@ AX_PROG_BISON
 dnl AC_PATH_PROG([BISON],[bison])
 dnl AX_PROG_BISON_VERSION([3.0.2],[],[ ... ])
 
+AC_ARG_VAR(DIFF, diff command)
path: configure.ac
user: login: GitMensch
body: It would suffice for infrastructure and the option to override on the command line - but it wouldn't have any checks on that and always default to the first one.
Using `AC_PATH_PROGS_FEATURE_CHECK` would allow to additionally check for the exact thing we want to have working and would test programs "later in PATH" (like the one you've manually used for the override) for that - so a manual override won't be necessary any more.
created_at: 2025-05-02T05:47:53Z
author_association: COLLABORATOR

PR comments:
user: login: ddeclerck
created_at: 2025-04-17T14:01:00Z
body: This takes over the discussion about the CI from PR #147.

Mind the change to `codegen.c` to avoid the warning about extra parenthesis (adding a cast to int was the simplest thing to do, otherwise we would need to determine when to add parenthesis).
author_association: COLLABORATOR
user: login: GitMensch
created_at: 2025-04-17T16:23:15Z
body: LGTM
author_association: COLLABORATOR
user: login: ddeclerck
created_at: 2025-04-17T17:11:32Z
body: As for the minimal change to `codegen.c` : should I make a dedicated SVN commit to trunk, or can I "sneak" it with the current merge bunch ?
author_association: COLLABORATOR
user: login: GitMensch
created_at: 2025-04-17T18:53:10Z
body: 

No sneaking needed, just add an entry in the Changelog and your commit message as "additional: ..."
OCP David Declerck ***@***.***> schrieb am Donnerstag, 17. April 2025 um 19:11:

> ddeclerck left a comment (OCamlPro/gnucobol#225)
> 

> As for the minimal change to `codegen.c` : should I make a dedicated SVN commit to trunk, or can I "sneak" it with the current merge bunch ?
> 

> —
> Reply to this email directly, view it on GitHub, or unsubscribe.
> You are receiving this because your review was requested.
author_association: COLLABORATOR
user: login: GitMensch
created_at: 2025-04-19T08:38:38Z
body: No idea why the diff fails on MSYS2 but that seems good to get in (similar for 3.x).
author_association: COLLABORATOR
user: login: ddeclerck
created_at: 2025-04-19T09:43:50Z
body: > No idea why the diff fails on MSYS2 but that seems good to get in (similar for 3.x).

Yeah, I'm investigating this. Not sure if it's related, but the diff version was updated recently in MSYS2 packages...
author_association: COLLABORATOR
user: login: ddeclerck
created_at: 2025-04-22T12:06:30Z
body: > > No idea why the diff fails on MSYS2 but that seems good to get in (similar for 3.x).
> 
> Yeah, I'm investigating this. Not sure if it's related, but the diff version was updated recently in MSYS2 packages...

Well, I'm still clueless.

I made some experiments in another branch, and interrestingly, the diff command works in the "prepare" step, but not in the subsequent steps... Calling `ldd` on `diff` show that it loads `msys-iconv-2.dll` in the prepare step, but this dependency does not appear in the other steps (though the file is present). It's as if it was a different diff command... Interrestingly, it (only) works with `mingw32`...
author_association: COLLABORATOR
user: login: GitMensch
created_at: 2025-04-22T17:30:26Z
body: Maybe you can execute the diff with a full path, possibly setting DIFF to that during configure is enough?
author_association: COLLABORATOR
user: login: ddeclerck
created_at: 2025-04-23T09:05:57Z
body: > Maybe you can execute the diff with a full path, possibly setting DIFF to that during configure is enough?

So, after more experiments: using the full path to diff doesn't change anything. I had to resort to a somewhat dirty trick: using the diff command provided with "Git for Windows" ; and to make that even more dirty, I had to go through a function - because the makefiles do not use the DIFF variable.

author_association: COLLABORATOR
user: login: codecov-commenter
created_at: 2025-04-23T09:07:13Z
body: :warning: Please install the !['codecov app svg image'](https://github.com/codecov/engineering-team/assets/152432831/e90313f4-9d3a-4b63-8b54-cfe14e7ec20d) to ensure uploads and comments are reliably processed by Codecov.

## [Codecov](https://app.codecov.io/gh/OCamlPro/gnucobol/pull/225?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=OCamlPro) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 65.96%. Comparing base [(`14e2140`)](https://app.codecov.io/gh/OCamlPro/gnucobol/commit/14e21403b1623a81cb8cd4436f8f7b2daf6eb81a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=OCamlPro) to head [(`8970e7b`)](https://app.codecov.io/gh/OCamlPro/gnucobol/commit/8970e7b870646bd57c5a9da7ca3e899297e7f9db?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=OCamlPro).
> Report is 6 commits behind head on gc4.

:exclamation: Your organization needs to install the [Codecov GitHub app](https://github.com/apps/codecov/installations/select_target) to enable full functionality.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##              gc4     #225      +/-   ##
==========================================
- Coverage   66.20%   65.96%   -0.25%     
==========================================
  Files          39       40       +1     
  Lines       69061    69448     +387     
  Branches    19164    19243      +79     
==========================================
+ Hits        45723    45812      +89     
- Misses      16147    16432     +285     
- Partials     7191     7204      +13     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/OCamlPro/gnucobol/pull/225?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=OCamlPro).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=OCamlPro).

<details><summary> :rocket: New features to boost your workflow: </summary>

- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
author_association: NONE
user: login: GitMensch
created_at: 2025-04-23T09:59:24Z
body: Then the makefiles should be adjusted to use DIFF. I've thought we always used DIFF and DIFF_FLAGS or similar.
author_association: COLLABORATOR
user: login: ddeclerck
created_at: 2025-04-23T16:33:43Z
body: Made all the necessary changes, now the tests fail on MSYS2 for another unknow reason... Interrestingly they did not fail on my previous hackish attempt with a diff function.
I really exhausted all my ideas here.
author_association: COLLABORATOR
user: login: ddeclerck
created_at: 2025-04-24T12:58:44Z
body: Finally got it sorted.

In fact, since autotest also uses diff, it was still necessary to define a function with the name "diff" so that it would pick up the "custom" diff command (see `atlocal.in`).
author_association: COLLABORATOR
user: login: ddeclerck
created_at: 2025-05-15T08:03:12Z
body: Note: I'd need to merge the 3.x commit (5508) about diff to trunk first and rebase this PR.
Should I add it to the 3/4 merge PR, or should I merge it separately ?
author_association: COLLABORATOR
user: login: GitMensch
created_at: 2025-05-15T09:27:31Z
body: I've forgot about the last bunch and will try to give this more thought next week.

Therefore I suggest to merge the DIFF (and possibly some other changes) into 4 by renaming the current merge branch on your repo, creating it new from the current OCamlPro one, then getting in those merges and push to the merge PR (if you spot anything iconv or configure/make related this may go in as well).

In the 4.x TODO file, you can also add the question of how we want to proceed with gcdiff. If we keep it, we will probably want to remove the DIFF check from configure.ac later and set the atlocal definition of DIFF to gcdiff. In any case, we need to consider how to handle cross-compilation (and create a test environment for this), where cobc runs on one architecture and generates executables for another(gcdiff may need two binaries as it would be needed to run the tests and, if installed, should be installed for the target architecture - I am not yet sure about the question of whether it is reasonable to install it).

Later on you can rebase the branch with your current merge of Chucks work and push that to the 3x-merge-PR again (or, if you find it to be self-contained enough, possibly even keep that for a "one-feature separate merge-PR", going on with other merges in the current PR).
author_association: COLLABORATOR
user: login: ddeclerck
created_at: 2025-05-15T15:19:13Z
body: > I've forgot about the last bunch and will try to give this more thought next week.
> 
> Therefore I suggest to merge the DIFF (and possibly some other changes) into 4 by renaming the current merge branch on your repo, creating it new from the current OCamlPro one, then getting in those merges and push to the merge PR (if you spot anything iconv or configure/make related this may go in as well).

I've updated the merge PR accordingly ; we can continue that discussion in the PR itself.

> In the 4.x TODO file, you can also add the question of how we want to proceed with gcdiff. If we keep it, we will probably want to remove the DIFF check from configure.ac later and set the atlocal definition of DIFF to gcdiff. In any case, we need to consider how to handle cross-compilation (and create a test environment for this), where cobc runs on one architecture and generates executables for another(gcdiff may need two binaries as it would be needed to run the tests and, if installed, should be installed for the target architecture - I am not yet sure about the question of whether it is reasonable to install it).

There's already a mention of gcdiff in the TODO file. I believe there were improvements in GC3 to help comparing outputs with plain diff - it might be worth trying to check if we can easily get rid of gcdiff. In fact, checking right now, replacing those with a plain diff works for almost all tests. For the few remaining ones (less than 10), adding the `--ignore-trailing-space` options does the trick in most cases (for those we could either add that option or adjust the expected output), and for the very few last failing (dumps and listings), this is due to the date/time... Interrestingly one test uses COB_CURRENT_DATE to set a fixed date so that its output does not change - but this is only for the date/time functions: how about we use that date "everywhere" in cobc/libcob so that the output becomes predictable ? (or maybe we could just use faketime...)

> Later on you can rebase the branch with your current merge of Chucks work and push that to the 3x-merge-PR again (or, if you find it to be self-contained enough, possibly even keep that for a "one-feature separate merge-PR", going on with other merges in the current PR).

Yeah, that's the idea.


author_association: COLLABORATOR
user: login: GitMensch
created_at: 2025-05-15T20:48:09Z
body: > how about we use that date "everywhere" in cobc/libcob so that the output becomes predictable ? (or maybe we could just use faketime...)

`SOURCE_DATE_EPOCH` _should_ be the right answer to any time stamps in cobc
author_association: COLLABORATOR