diff mbox series

[bug#63092,v3,2/2] gnu: git-minimal: Check files exist before delete.

Message ID 20230426190346.3457310-3-code@greghogan.com
State New
Headers show
Series Update git [security fixes]. | expand

Commit Message

Greg Hogan April 26, 2023, 7:03 p.m. UTC
* gnu/packages/version-control.scm (git-minimal)
[arguments]<#:phases>(remove-unusable-perl-commands): Add file check
before deleting perl scripts so that this phase works for both new and
old, pinned versions.
---
 gnu/packages/version-control.scm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Ludovic Courtès May 11, 2023, 1:15 p.m. UTC | #1
Hi Greg,

Greg Hogan <code@greghogan.com> skribis:

> * gnu/packages/version-control.scm (git-minimal)
> [arguments]<#:phases>(remove-unusable-perl-commands): Add file check
> before deleting perl scripts so that this phase works for both new and
> old, pinned versions.

[...]

> +                             (if (file-exists? file)
> +                               (delete-file (string-append libexec
> +                                                           "/git-core/" file))))
> +                           ;; git-add--interactive was removed in Git 2.40 but
> +                           ;; this phase is inherited by older versions.

The ‘file-exists?’ and ‘delete-file’ calls are passed different file
names.  Also, this won’t prevent a rebuild of ‘git-minimal/pinned’.

So I went with a different approach to achieve that goal.  Applied now.

Thanks!

Ludo’.
diff mbox series

Patch

diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 5f6766f510..0467e9f4cb 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -634,8 +634,11 @@  (define-public git-minimal
                       (bin     (string-append out "/bin"))
                       (libexec (string-append out "/libexec")))
                  (for-each (lambda (file)
-                             (delete-file (string-append libexec
-                                                         "/git-core/" file)))
+                             (if (file-exists? file)
+                               (delete-file (string-append libexec
+                                                           "/git-core/" file))))
+                           ;; git-add--interactive was removed in Git 2.40 but
+                           ;; this phase is inherited by older versions.
                            '("git-svn" "git-cvsimport" "git-archimport"
                              "git-cvsserver" "git-request-pull"
                              "git-add--interactive" "git-cvsexportcommit"