Skip to content

fix: ghc-zip-archive - remove flagged files - #18624

Open
Andrew Phelps (anphel31) wants to merge 1 commit into
4.0from
anphel/fix-ghc-zip-archive-flagged-files
Open

fix: ghc-zip-archive - remove flagged files#18624
Andrew Phelps (anphel31) wants to merge 1 commit into
4.0from
anphel/fix-ghc-zip-archive-flagged-files

Conversation

@anphel31

Copy link
Copy Markdown
Member

Remove a password-protected (encrypted) test fixture from ghc-zip-archive and drop the three test cases that read it.

The zip-archive test suite ships tests/zip_with_password.zip, a password-protected (encrypted) fixture. The package-signing scan can't inspect encrypted archives and rejects the .src.rpm, blocking signing. The file is test-only and not shipped in any binary RPM.

  • An azldev archive overlay (file-remove) removes the file and repacks the tarball; the post-overlay hash is pinned via a source-files entry (origin = { type = "overlay" }).
  • Two file-search-replace overlays drop only the three cases that read it (testExtractFilesFailOnEncrypted, testPasswordProtectedRead, testIncorrectPasswordRead), keeping %bcond tests 1 and the rest of the Cabal suite running.

azldev comp render --check-only reports no drift.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes an encrypted test fixture from ghc-zip-archive to unblock package signing while retaining the remaining test suite.

Changes:

  • Adds overlays removing the fixture and three dependent tests.
  • Pins the repacked archive and refreshes generated state.
  • Moves the customized component to a dedicated definition.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
base/comps/ghc-zip-archive/ghc-zip-archive.comp.toml Defines archive and test-removal overlays.
base/comps/components.toml Removes the former inline component entry.
locks/ghc-zip-archive.lock Refreshes the component fingerprint.
specs/g/ghc-zip-archive/ghc-zip-archive.spec Updates generated release and changelog.
specs/g/ghc-zip-archive/sources Pins the repacked archive hash.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

description = "Remove password-protected test fixture zip_with_password.zip"
type = "file-remove"
archive = "zip-archive-0.4.3.2.tar.gz"
file = "tests/zip_with_password.zip"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Added a loose-file file-search-replace overlay that removes tests/zip_with_password.zip from the Cabal Extra-Source-Files list in the rendered zip-archive-0.4.3.2.cabal. That is the Source1 the build actually uses — %prep runs dos2unix -k -n %{SOURCE1} %{pkg_name}.cabal, overwriting the tarball's zip-archive.cabal with this one, so the archive's own copy is discarded before any cabal step. The manifest and the shipped fixtures are now consistent; re-rendered and azldev comp render --check-only is clean (the loose overlay only touches the sidecar, so the tarball hash is unchanged).

# The archive is extracted, the matched file dropped, and the tarball
# deterministically repacked; the resulting hash is pinned via the source-files
# entry below.
[[components.ghc-zip-archive.overlays]]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified via azldev comp prepare-sources (I inspected the repacked archive: zip_with_password.zip is gone, the other fixtures and the .cabal are intact) and azldev comp render --check-only (no drift). The change only removes a test-only fixture that is not shipped in any binary RPM, plus the three test cases that read it, keeping the rest of the suite under %bcond tests 1 — so the library build is unaffected. A full azldev comp build in a GHC/Haskell mock chroot isn't runnable in my environment; the full mock build runs in CI.

Copilot AI review requested due to automatic review settings August 26, 2026 06:37
@anphel31
Andrew Phelps (anphel31) force-pushed the anphel/fix-ghc-zip-archive-flagged-files branch from e7045df to 88c5bd5 Compare August 26, 2026 06:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

base/comps/ghc-zip-archive/ghc-zip-archive.comp.toml:11

  • This changes the repacked Source0 and removes executable test cases, but the PR records only azldev comp render --check-only. Repository policy requires output-affecting component changes to be built and the resulting RPMs smoke-tested in a mock chroot; please run and document those checks before merging.
[[components.ghc-zip-archive.overlays]]
description = "Remove password-protected test fixture zip_with_password.zip"
type = "file-remove"
archive = "zip-archive-0.4.3.2.tar.gz"
file = "tests/zip_with_password.zip"

description = "Drop removed test zip from the Cabal Extra-Source-Files manifest"
type = "file-search-replace"
file = "zip-archive-0.4.3.2.cabal"
regex = '\n +tests/zip_with_password\.zip'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. The manifest regex is now CRLF-aware ((?m)^ +tests/zip_with_password\.zip\r?\n) so it consumes the whole line including the trailing carriage return, leaving a clean single CRLF on the preceding entry.

The zip-archive test suite ships tests/zip_with_password.zip, a password-protected (encrypted) fixture that fails the package-signing scan and blocks signing. Remove it with an azldev archive overlay (file-remove) that deterministically repacks the source tarball, and drop the three test cases that read it (testExtractFilesFailOnEncrypted, testPasswordProtectedRead, testIncorrectPasswordRead) via file-search-replace overlays so the rest of the Cabal suite (%bcond tests 1) keeps running. Test-only, not shipped in any binary RPM.
Copilot AI review requested due to automatic review settings August 26, 2026 06:55
@anphel31
Andrew Phelps (anphel31) force-pushed the anphel/fix-ghc-zip-archive-flagged-files branch from 88c5bd5 to adab356 Compare August 26, 2026 06:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.

@github-actions

Copy link
Copy Markdown

📄❌ Rendered specs are out of date

FIX: — run this and commit the result:

azldev component render ghc-zip-archive

Or download the fix patch and apply it:

gh run download 32940300449 -R microsoft/azurelinux -n rendered-specs-patch
git apply rendered-specs.patch
Category Count
Content diffs 1
Extra files (untracked) 0
Missing files (deleted) 0

Content diffs

`specs/g/ghc-zip-archive/zip-archive-0.4.3.2.cabal`
--- committed/specs/g/ghc-zip-archive/zip-archive-0.4.3.2.cabal
+++ rendered/specs/g/ghc-zip-archive/zip-archive-0.4.3.2.cabal
@@ -1,105 +1,105 @@
-Name:                zip-archive
-Version:             0.4.3.2
-x-revision: 1
-Cabal-Version:       2.0
-Build-type:          Simple
-Synopsis:            Library for creating and modifying zip archives.
-Description:
-   The zip-archive library provides functions for creating, modifying, and
-   extracting files from zip archives. The zip archive format is
-   documented in <http://www.pkware.com/documents/casestudies/APPNOTE.TXT>.
-   .
-   Certain simplifying assumptions are made about the zip archives: in
-   particular, there is no support for strong encryption, zip files that
-   span multiple disks, ZIP64, OS-specific file attributes, or compression
-   methods other than Deflate. However, the library should be able to read
-   the most common zip archives, and the archives it produces should be
-   readable by all standard unzip programs.
-   .
-   Archives are built and extracted in memory, so manipulating large zip
-   files will consume a lot of memory. If you work with large zip files or
-   need features not supported by this library, a better choice may be
-   <http://hackage.haskell.org/package/zip zip>, which uses a
-   memory-efficient streaming approach. However, zip can only read and
-   write archives inside instances of MonadIO, so zip-archive is a better
-   choice if you want to manipulate zip archives in "pure" contexts.
-   .
-   As an example of the use of the library, a standalone zip archiver and
-   extracter is provided in the source distribution.
-Category:            Codec
-Tested-with:         GHC == 8.6.5, GHC == 8.8.1, GHC == 8.10.4, GHC == 9.0.1,
-                     GHC == 8.8.3, GHC == 9.2.1
-License:             BSD3
-License-file:        LICENSE
-Homepage:            http://github.com/jgm/zip-archive
-Author:              John MacFarlane
-Maintainer:          jgm@berkeley.edu
-Extra-Source-Files:  changelog
-                     README.markdown
-                     tests/test4.zip
-                     tests/test4/a.txt
-                     tests/test4/b.bin
-                     "tests/test4/c/with spaces.txt"
-                     tests/zip_with_symlinks.zip
-                     tests/zip_with_evil_path.zip
-
-Source-repository    head
-  type:              git
-  location:          git://github.com/jgm/zip-archive.git
-
-flag executable
-  Description:       Build the Zip executable.
-  Default:           False
-
-Library
-  Build-depends:     base >= 4.11 && < 5,
-                     pretty,
-                     containers,
-                     binary >= 0.7.2,
-                     zlib,
-                     filepath,
-                     bytestring >= 0.10.0,
-                     array,
-                     mtl,
-                     text >= 0.11,
-                     digest >= 0.0.0.1,
-                     directory >= 1.2.0,
-                     time
-  Exposed-modules:   Codec.Archive.Zip
-  Default-Language:  Haskell98
-  Hs-Source-Dirs:    src
-  Ghc-Options:       -Wall
-  if os(windows)
-    cpp-options:     -D_WINDOWS
-  else
-    Build-depends:   unix
-
-Executable zip-archive
-  if flag(executable)
-    Buildable:       True
-  else
-    Buildable:       False
-  Main-is:           Main.hs
-  Hs-Source-Dirs:    .
-  Build-Depends:     base >= 4.5 && < 5,
-                     directory >= 1.1,
-                     bytestring >= 0.9.0,
-                     zip-archive
-  Other-Modules:     Paths_zip_archive
-  Autogen-Modules:   Paths_zip_archive
-  Ghc-Options:       -Wall
-  Default-Language:  Haskell98
-
-Test-Suite test-zip-archive
-  Type:           exitcode-stdio-1.0
-  Main-Is:        test-zip-archive.hs
-  Hs-Source-Dirs: tests
-  Build-Depends:  base >= 4.11 && < 5,
-                  directory >= 1.3, bytestring >= 0.9.0, process, time,
-                  HUnit, zip-archive, temporary, filepath
-  Default-Language:  Haskell98
-  Ghc-Options:    -Wall
-  if os(windows)
-    cpp-options:     -D_WINDOWS
-  else
-    Build-depends:   unix
+Name:                zip-archive
+Version:             0.4.3.2
+x-revision: 1
+Cabal-Version:       2.0
+Build-type:          Simple
+Synopsis:            Library for creating and modifying zip archives.
+Description:
+   The zip-archive library provides functions for creating, modifying, and
+   extracting files from zip archives. The zip archive format is
+   documented in <http://www.pkware.com/documents/casestudies/APPNOTE.TXT>.
+   .
+   Certain simplifying assumptions are made about the zip archives: in
+   particular, there is no support for strong encryption, zip files that
+   span multiple disks, ZIP64, OS-specific file attributes, or compression
+   methods other than Deflate. However, the library should be able to read
+   the most common zip archives, and the archives it produces should be
+   readable by all standard unzip programs.
+   .
+   Archives are built and extracted in memory, so manipulating large zip
+   files will consume a lot of memory. If you work with large zip files or
+   need features not supported by this library, a better choice may be
+   <http://hackage.haskell.org/package/zip zip>, which uses a
+   memory-efficient streaming approach. However, zip can only read and
+   write archives inside instances of MonadIO, so zip-archive is a better
+   choice if you want to manipulate zip archives in "pure" contexts.
+   .
+   As an example of the use of the library, a standalone zip archiver and
+   extracter is provided in the source distribution.
+Category:            Codec
+Tested-with:         GHC == 8.6.5, GHC == 8.8.1, GHC == 8.10.4, GHC == 9.0.1,
+                     GHC == 8.8.3, GHC == 9.2.1
+License:             BSD3
+License-file:        LICENSE
+Homepage:            http://github.com/jgm/zip-archive
+Author:              John MacFarlane
+Maintainer:          jgm@berkeley.edu
+Extra-Source-Files:  changelog
+                     README.markdown
+                     tests/test4.zip
+                     tests/test4/a.txt
+                     tests/test4/b.bin
+                     "tests/test4/c/with spaces.txt"
+                     tests/zip_with_symlinks.zip
+                     tests/zip_with_evil_path.zip
+
+Source-repository    head
+  type:              git
+  location:          git://github.com/jgm/zip-archive.git
+
+flag executable
+  Description:       Build the Zip executable.
+  Default:           False
+
+Library
+  Build-depends:     base >= 4.11 && < 5,
+                     pretty,
+                     containers,
+                     binary >= 0.7.2,
+                     zlib,
+                     filepath,
+                     bytestring >= 0.10.0,
+                     array,
+                     mtl,
+                     text >= 0.11,
+                     digest >= 0.0.0.1,
+                     directory >= 1.2.0,
+                     time
+  Exposed-modules:   Codec.Archive.Zip
+  Default-Language:  Haskell98
+  Hs-Source-Dirs:    src
+  Ghc-Options:       -Wall
+  if os(windows)
+    cpp-options:     -D_WINDOWS
+  else
+    Build-depends:   unix
+
+Executable zip-archive
+  if flag(executable)
+    Buildable:       True
+  else
+    Buildable:       False
+  Main-is:           Main.hs
+  Hs-Source-Dirs:    .
+  Build-Depends:     base >= 4.5 && < 5,
+                     directory >= 1.1,
+                     bytestring >= 0.9.0,
+                     zip-archive
+  Other-Modules:     Paths_zip_archive
+  Autogen-Modules:   Paths_zip_archive
+  Ghc-Options:       -Wall
+  Default-Language:  Haskell98
+
+Test-Suite test-zip-archive
+  Type:           exitcode-stdio-1.0
+  Main-Is:        test-zip-archive.hs
+  Hs-Source-Dirs: tests
+  Build-Depends:  base >= 4.11 && < 5,
+                  directory >= 1.3, bytestring >= 0.9.0, process, time,
+                  HUnit, zip-archive, temporary, filepath
+  Default-Language:  Haskell98
+  Ghc-Options:    -Wall
+  if os(windows)
+    cpp-options:     -D_WINDOWS
+  else
+    Build-depends:   unix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants