Subject: bug#64994: closed (Re: [bug#64994] [PATCH] gnu: john-the-ripper-jumbo: Fix compilation with GCC 11+.)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 02 Aug 2023 13:02:02 +0000

Your bug report

#64994: [PATCH] gnu: john-the-ripper-jumbo: Fix compilation with GCC 11+.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
64994: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64994
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#64994] [PATCH] gnu: john-the-ripper-jumbo: Fix compilation with GCC 11+.
From: Guillaume Le Vaillant <[email-masked]>
To: Jakob Kirsch <[email-masked]>
Cc: [email-masked]
Date: Wed, 02 Aug 2023 12:55:07 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi.
It looks like your e-mail client mangled your patch by cutting some
lines. If you can't set it not to do that, you could also sent a patch
as an attached file to the e-mail.
I was able to recover the main change of your patch, and I also added
the registration of the new patch file to 'local.mk'.
Applied as 6ccfa48d83b9c513b40835ae0c5896102b4dd915.
Thanks.

Subject: [PATCH] gnu: john-the-ripper-jumbo: Fix compilation with GCC 11+.
From: Jakob Kirsch <[email-masked]>
To: [email-masked]
Date: Tue, 1 Aug 2023 17:24:38 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/packages/password-utils.scm (john-the-ripper-jumbo): Add patch to
   fix compilation with GCC 11 and higher.
---
  gnu/packages/password-utils.scm               | 198 ++++++++++--------
  ...11-struct-allignment-incompatibility.patch |  50 +++++
  2 files changed, 163 insertions(+), 85 deletions(-)
  create mode 100644 
gnu/packages/patches/john-the-ripper-jumbo-fix-gcc-11-struct-allignment-incompatibility.patch

diff --git a/gnu/packages/password-utils.scm 
b/gnu/packages/password-utils.scm
index f4f172d159..d16af605d7 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -1173,95 +1173,123 @@ (define-public john-the-ripper-jumbo
      (package
        (name "john-the-ripper-jumbo")
        (version (string-append official-version "-" jumbo-version))
-      (source
-       (origin
-         (method url-fetch)
-         (uri (string-append "http://www.openwall.com/john/j/john-"
-                             official-version "-jumbo-" jumbo-version 
".tar.xz"))
-         (sha256
-          (base32
- "0fvz3v41hnaiv1ggpxanfykyfjq79cwp9qcqqn63vic357w27lgm"))))
+      (source (origin
+                (method url-fetch)
+                (uri (string-append "http://www.openwall.com/john/j/john-"
+                                    official-version "-jumbo-" 
jumbo-version
+                                    ".tar.xz"))
+                (sha256
+                 (base32
+ "0fvz3v41hnaiv1ggpxanfykyfjq79cwp9qcqqn63vic357w27lgm"))
+                (patches (search-patches
+ 
"john-the-ripper-jumbo-fix-gcc-11-struct-allignment-incompatibility.patch"))))
        (build-system gnu-build-system)
-      (native-inputs
-       (list perl))
-      (inputs
-       (list gmp
-             libpcap
-             nss
-             openssl
-             python-wrapper
-             ruby                       ; For genincstats.rb
-             zlib))
+      (native-inputs (list perl))
+      (inputs (list gmp
+                    libpcap
+                    nss
+                    openssl
+                    python-wrapper
+                    ruby ;For genincstats.rb
+                    zlib))
        (arguments
-       `(#:configure-flags
-         (list "--with-systemwide"
-               ;; Do not test for instruction set in configure, and do not
-               ;; pass '-march=native' to gcc:
-               "--disable-native-tests"
-               "--disable-native-march"
-               ,(string-append
-                 "--enable-simd="
-                 (let ((system (or (%current-target-system)
-                                   (%current-system))))
-                   (cond
-                    ((or (string-prefix? "x86_64" system)
-                         (string-prefix? "i686" system)) "sse2")
-                    ((string-prefix? "aarch" system) "neon")
-                    (else "no")))))
-         #:phases
-         (modify-phases %standard-phases
-           (add-before 'configure 'chdir-src
-             (lambda _ (chdir "src") #t))
-           (replace 'install
-             (lambda _
-               (let ((bindir (string-append %output "/bin"))
-                     (docdir (string-append %output "/share/doc/john"))
-                     (execdir (string-append %output "/libexec/john"))
-                     (datadir (string-append %output "/share/john"))
-                     (install-file-to (lambda (dir)
-                                        (lambda (f) (install-file f dir))))
-                     (symlink? (lambda (_ s) (eq? (stat:type s) 
'symlink))))
-                 (with-directory-excursion "../run"
-                   (for-each (install-file-to bindir)
-                             (cons*
-                              "john" "makechr" "cprepair" "SIPdump" 
"tgtsnarf"
-                              "genmkvpwd" "mkvcalcproba" "calc_stat" 
"raw2dyna"
-                              (find-files "." "(to|2)?john(-[^.]*)?$")))
-                   (for-each (lambda (f) ; Install symlinked aliases
-                               (let ((tgt (string-append bindir "/" 
(basename f))))
-                                 ;; The use of install-file above 
dereferences
-                                 ;; symlinks.  We'd rather have the 
symlinks
-                                 ;; for clarity, so remove tgt before 
linking.
-                                 (when (file-exists? tgt) (delete-file 
tgt))
-                                 (symlink "john" tgt)))
-                             (find-files "." symlink?))
-                   (for-each (install-file-to execdir)
-                             (cons* "mailer" "benchmark-unify" "relbench"
-                                    (find-files "." ".*\\.js")))
-                   (for-each (lambda (f)
-                               (let* ((base (basename f))
-                                      (name (substring base 0 
(string-index base #\.)))
-                                      (link (string-append bindir "/" 
name)))
-                                 (install-file f execdir)
-                                 (when (and (executable-file? f)
-                                            (not (file-exists? link)))
-                                   (symlink (string-append execdir "/" 
base) link))))
-                             (find-files "." ".*\\.(pl|py|rb|lua)"))
-                   (for-each (install-file-to datadir)
-                             (append (find-files "." 
"(stats|dictionary.*)")
-                                     (find-files "." "(.*\\.chr|.*\\.lst)")
-                                     (find-files "." ".*\\.conf")))
-                   (copy-recursively "rules" (string-append datadir 
"/rules")))
-                 (copy-recursively "../doc" docdir))))
-           (delete 'check) ; Tests need installed .conf files; move 
after install
-           (add-after 'install 'check
-             (lambda args
-               (setenv "HOME" "/tmp")   ; Some tests need to write to 
~/.john
-               (setenv "OMP_NUM_THREADS" (number->string 
(parallel-job-count)))
-               (apply (assoc-ref %standard-phases 'check) args))))))
+       `(#:configure-flags (list "--with-systemwide"
+                                 ;; Do not test for instruction set in 
configure, and do not
+                                 ;; pass '-march=native' to gcc:
+                                 "--disable-native-tests"
+                                 "--disable-native-march"
+                                 ,(string-append "--enable-simd="
+                                                 (let ((system (or 
(%current-target-system)
+ (%current-system))))
+                                                   (cond
+                                                     ((or (string-prefix?
+                                                           "x86_64" system)
+ (string-prefix?
+                                                           "i686" system))
+                                                      "sse2")
+ ((string-prefix? "aarch"
+ system)
+                                                      "neon")
+                                                     (else "no")))))
+         #:phases (modify-phases %standard-phases
+                    (add-before 'configure 'chdir-src
+                      (lambda _
+                        (chdir "src") #t))
+                    (replace 'install
+                      (lambda _
+                        (let ((bindir (string-append %output "/bin"))
+                              (docdir (string-append %output 
"/share/doc/john"))
+                              (execdir (string-append %output 
"/libexec/john"))
+                              (datadir (string-append %output 
"/share/john"))
+                              (install-file-to (lambda (dir)
+                                                 (lambda (f)
+                                                   (install-file f dir))))
+                              (symlink? (lambda (_ s)
+                                          (eq? (stat:type s)
+                                               'symlink))))
+                          (with-directory-excursion "../run"
+                            (for-each (install-file-to bindir)
+                                      (cons* "john"
+                                             "makechr"
+                                             "cprepair"
+                                             "SIPdump"
+                                             "tgtsnarf"
+                                             "genmkvpwd"
+                                             "mkvcalcproba"
+                                             "calc_stat"
+                                             "raw2dyna"
+                                             (find-files "."
+ "(to|2)?john(-[^.]*)?$")))
+                            (for-each (lambda (f)
+                                         ;Install symlinked aliases
+                                        (let ((tgt (string-append 
bindir "/"
+ (basename f))))
+                                          ;; The use of install-file 
above dereferences
+                                          ;; symlinks.  We'd rather 
have the symlinks
+                                          ;; for clarity, so remove tgt 
before linking.
+                                          (when (file-exists? tgt)
+                                            (delete-file tgt))
+                                          (symlink "john" tgt)))
+                                      (find-files "." symlink?))
+                            (for-each (install-file-to execdir)
+                                      (cons* "mailer" "benchmark-unify"
+                                             "relbench"
+                                             (find-files "." ".*\\.js")))
+                            (for-each (lambda (f)
+                                        (let* ((base (basename f))
+                                               (name (substring base 0
+ (string-index
+ base #\.)))
+                                               (link (string-append 
bindir "/"
+ name)))
+                                          (install-file f execdir)
+                                          (when (and (executable-file? f)
+                                                     (not (file-exists? 
link)))
+                                            (symlink (string-append execdir
+ "/" base)
+                                                     link))))
+                                      (find-files "." 
".*\\.(pl|py|rb|lua)"))
+                            (for-each (install-file-to datadir)
+                                      (append (find-files "."
+ "(stats|dictionary.*)")
+                                              (find-files "."
+ "(.*\\.chr|.*\\.lst)")
+                                              (find-files "." 
".*\\.conf")))
+                            (copy-recursively "rules"
+                                              (string-append datadir 
"/rules")))
+                          (copy-recursively "../doc" docdir))))
+                    (delete 'check) ;Tests need installed .conf files; 
move after install
+                    (add-after 'install 'check
+                      (lambda args
+                        (setenv "HOME" "/tmp") ;Some tests need to 
write to ~/.john
+                        (setenv "OMP_NUM_THREADS"
+                                (number->string (parallel-job-count)))
+                        (apply (assoc-ref %standard-phases
+                                          'check) args))))))
        (home-page "http://www.openwall.com/john/")
        (synopsis "Password cracker")
-      (description "John the Ripper is a fast password cracker. Its primary
+      (description
+       "John the Ripper is a fast password cracker.  Its primary
  purpose is to detect weak Unix passwords.  Besides several @code{crypt}
  password hash types most commonly found on various Unix systems, 
supported out
  of the box are Windows LM hashes, plus lots of other hashes and 
ciphers.  This
diff --git 
a/gnu/packages/patches/john-the-ripper-jumbo-fix-gcc-11-struct-allignment-incompatibility.patch 
b/gnu/packages/patches/john-the-ripper-jumbo-fix-gcc-11-struct-allignment-incompatibility.patch
new file mode 100644
index 0000000000..58bff27d31
--- /dev/null
+++ 
b/gnu/packages/patches/john-the-ripper-jumbo-fix-gcc-11-struct-allignment-incompatibility.patch
@@ -0,0 +1,50 @@
+From 154ee1156d62dd207aff0052b04c61796a1fde3b Mon Sep 17 00:00:00 2001
+From: Ferry Huberts <[email-masked]>
+Date: Tue, 9 Mar 2021 22:04:46 +0100
+Subject: [PATCH] Fix alignment compile errors on GCC 11
+
+Signed-off-by: Ferry Huberts <[email-masked]>
+---
+ src/blake2.h | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/blake2.h b/src/blake2.h
+index b05208117e..b4398f9e13 100644
+--- a/src/blake2.h
++++ b/src/blake2.h
+@@ -57,7 +57,7 @@ extern "C" {
+     uint8_t  personal[BLAKE2S_PERSONALBYTES];  // 32
+   } blake2s_param;
+
+-  JTR_ALIGN( 64 ) typedef struct __blake2s_state
++  typedef struct JTR_ALIGN( 64 ) __blake2s_state
+   {
+     uint32_t h[8];
+     uint32_t t[2];
+@@ -82,7 +82,7 @@ extern "C" {
+     uint8_t  personal[BLAKE2B_PERSONALBYTES];  // 64
+   } blake2b_param;
+
+-  JTR_ALIGN( 64 ) typedef struct __blake2b_state
++  typedef struct JTR_ALIGN( 64 ) __blake2b_state
+   {
+     uint64_t h[8];
+     uint64_t t[2];
+@@ -94,7 +94,7 @@ extern "C" {
+ #if defined(JOHN_NO_SIMD) || (!defined(__SSE2__) && 
!defined(__SSE4_1__) && !defined(__XOP__))
+   typedef struct __blake2sp_state
+ #else
+-  JTR_ALIGN( 64 ) typedef struct __blake2sp_state
++  typedef struct JTR_ALIGN( 64 ) __blake2sp_state
+ #endif
+   {
+     blake2s_state S[8][1];
+@@ -106,7 +106,7 @@ extern "C" {
+ #if defined(JOHN_NO_SIMD) || (!defined(__SSE2__) && 
!defined(__SSE4_1__) && !defined(__XOP__))
+   typedef struct __blake2bp_state
+ #else
+-  JTR_ALIGN( 64 ) typedef struct __blake2bp_state
++  typedef struct JTR_ALIGN( 64 ) __blake2bp_state
+ #endif
+   {
+     blake2b_state S[4][1];

base-commit: 5a293d0830aa9369e388d37fe767d5bf98af01b7
-- 
2.41.0