GNU bug report logs - #41637
[PATCH] gnu: Add hashcash.

Previous Next

Package: guix-patches;

Reported by: Jakub Kądziołka <kuba <at> kadziolka.net>

Date: Mon, 1 Jun 2020 00:41:02 UTC

Severity: normal

Tags: patch

Done: Jakub Kądziołka <kuba <at> kadziolka.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41637 in the body.
You can then email your comments to 41637 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#41637; Package guix-patches. (Mon, 01 Jun 2020 00:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jakub Kądziołka <kuba <at> kadziolka.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 01 Jun 2020 00:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: Add hashcash.
Date: Mon,  1 Jun 2020 02:40:15 +0200
* gnu/packages/networking.scm (hashcash): New variable.
---

Is the license field here alright? Here's what the LICENSE file has to
say:

> This software can be distributed and used under any of the following
> licenses:
> 
> 	CPL
> 	public domain
> 	BSD (3 clause -- no advertising clause)
> 	LGPL (2.1)
> 	GPL (2)
> 
> in rough order of author preference.
> 
> The CPL is probably unique to this package, and is described here:
> http://www.cypherspace.org/CPL/; if you can't be bothered to figure it
> out feel free to use one of the other licenses.  Earlier versions
> where distributed just under CPL.  CPL allows you to re-license under
> a license of your choice, I just include other specific licenses to
> save people having to read, understand and feel confident in the
> validity of the CPL.
> 
> NOTE: on systems without a POSIX getopt this package will be linked
> with the included getopt.c which is distributed under GPL 2.

 gnu/packages/networking.scm | 46 +++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index fd29370841..169aa4ed8e 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -38,6 +38,7 @@
 ;;; Copyright © 2019 Diego N. Barbato <dnbarbato <at> posteo.de>
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll <at> gmail.com>
 ;;; Copyright © 2020 Brice Waegeneire <brice <at> waegenei.re>
+;;; Copyright © 2020 Jakub Kądziołka <kuba <at> kadziolka.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3189,3 +3190,48 @@ CDP.  The goal of LLDP is to provide an inter-vendor compatible mechanism to
 deliver Link-Layer notifications to adjacent network devices.  @code{lldpd} is
 an implementation of LLDP.  It also supports some proprietary protocols.")
     (license license:isc)))
+
+(define-public hashcash
+  (package
+    (name "hashcash")
+    (version "1.22")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://www.hashcash.org/source/hashcash-"
+                           version ".tgz"))
+       (sha256
+        (base32
+         "15kqaimwb2y8wvzpn73021bvay9mz1gqqfc40gk4hj6f84nz34h1"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags '("CC=gcc")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         ;; No tests available.
+         (delete 'check)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((outdir (assoc-ref outputs "out"))
+                    (bindir (string-append outdir "/bin"))
+                    (mandir (string-append outdir "/share/man/man1"))
+                    (docdir (string-append outdir "/share/doc/hashcash-" ,version)))
+               ;; make install assumes /usr and doesn't provide a way to override it
+               (install-file "hashcash" bindir)
+               (install-file "hashcash.1" mandir)
+               (install-file "README" docdir)
+               (install-file "LICENSE" docdir)
+               (install-file "CHANGELOG" docdir)
+               #t))))))
+    (home-page "https://www.hashcash.org/")
+    (synopsis "Denial-of-service countermeasure")
+    (description "Hashcash is a proof-of-work algorithm, which has been used
+as a denial-of-service countermeasure technique in a number of systems.
+
+A hashcash stamp constitutes a proof-of-work which takes a parametrizable
+amount of work to compute for the sender.  The recipient can verify received
+hashcash stamps efficiently.
+
+This package contains a command-line tool for computing and verifying hashcash
+stamps.")
+    (license license:public-domain)))
-- 
2.26.2





Information forwarded to guix-patches <at> gnu.org:
bug#41637; Package guix-patches. (Tue, 02 Jun 2020 12:13:02 GMT) Full text and rfc822 format available.

Message #8 received at 41637 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Jakub Kądziołka <kuba <at> kadziolka.net>
Cc: 41637 <at> debbugs.gnu.org
Subject: Re: [bug#41637] [PATCH] gnu: Add hashcash.
Date: Tue, 02 Jun 2020 14:12:05 +0200
Hello Jakub,

> +     `(#:make-flags '("CC=gcc")

It would be better to use "cc-for-target" here. You can check if
cross-compilation works by running something like:

--8<---------------cut here---------------start------------->8---
guix build --target=aarch64-linux-gnu hashcash
--8<---------------cut here---------------end--------------->8---

Thanks,

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#41637; Package guix-patches. (Tue, 02 Jun 2020 13:26:01 GMT) Full text and rfc822 format available.

Message #11 received at 41637 <at> debbugs.gnu.org (full text, mbox):

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 41637 <at> debbugs.gnu.org
Subject: Re: [bug#41637] [PATCH] gnu: Add hashcash.
Date: Tue, 2 Jun 2020 15:25:55 +0200
[Message part 1 (text/plain, inline)]
On Tue, Jun 02, 2020 at 02:12:05PM +0200, Mathieu Othacehe wrote:
> 
> Hello Jakub,
> 
> > +     `(#:make-flags '("CC=gcc")
> 
> It would be better to use "cc-for-target" here. You can check if
> cross-compilation works by running something like:
> 
> --8<---------------cut here---------------start------------->8---
> guix build --target=aarch64-linux-gnu hashcash
> --8<---------------cut here---------------end--------------->8---

Thanks! I had no idea this affects cross-compilation... I have changed
that line to be

     `(#:make-flags (list (string-append "CC=" ,(cc-for-target)))

instead. Does the rest of the patch look alright?

Regards,
Jakub Kądziołka
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#41637; Package guix-patches. (Wed, 03 Jun 2020 06:56:01 GMT) Full text and rfc822 format available.

Message #14 received at 41637 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Jakub Kądziołka <kuba <at> kadziolka.net>
Cc: 41637 <at> debbugs.gnu.org
Subject: Re: [bug#41637] [PATCH] gnu: Add hashcash.
Date: Wed, 03 Jun 2020 08:55:39 +0200
Hey Jakub,

Thanks for fixing the cross-compilation, a full review this time :)

> +             (let* ((outdir (assoc-ref outputs "out"))
> +                    (bindir (string-append outdir "/bin"))
> +                    (mandir (string-append outdir "/share/man/man1"))
> +                    (docdir (string-append outdir "/share/doc/hashcash-" ,version)))
> +               ;; make install assumes /usr and doesn't provide a way to override it
> +               (install-file "hashcash" bindir)
> +               (install-file "hashcash.1" mandir)
> +               (install-file "README" docdir)
> +               (install-file "LICENSE" docdir)
> +               (install-file "CHANGELOG" docdir)

I think you can set the variables INSTALL_PATH, MAN_INSTALL_PATH and
DOC_INSTALL_PATH instead.

> +               #t))))))
> +    (home-page "https://www.hashcash.org/")
> +    (synopsis "Denial-of-service countermeasure")
> +    (description "Hashcash is a proof-of-work algorithm, which has been used
> +as a denial-of-service countermeasure technique in a number of systems.

You can remove "in a number of systems".

> +A hashcash stamp constitutes a proof-of-work which takes a parametrizable
> +amount of work to compute for the sender.  The recipient can verify received
> +hashcash stamps efficiently.
> +
> +This package contains a command-line tool for computing and verifying hashcash
> +stamps.")
> +    (license license:public-domain)))

I'm also concerned by this line in the Makefile:

--8<---------------cut here---------------start------------->8---
# request static link of -lcrypto only
LIBCRYPTO=/usr/lib/libcrypto.a
--8<---------------cut here---------------end--------------->8---

We should maybe add "openssl" to the inputs and fix this variable
(that's what Nix does).

Thanks,

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#41637; Package guix-patches. (Wed, 03 Jun 2020 12:19:01 GMT) Full text and rfc822 format available.

Message #17 received at 41637 <at> debbugs.gnu.org (full text, mbox):

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 41637 <at> debbugs.gnu.org
Subject: Re: [bug#41637] [PATCH] gnu: Add hashcash.
Date: Wed, 3 Jun 2020 14:18:06 +0200
[Message part 1 (text/plain, inline)]
On Wed, Jun 03, 2020 at 08:55:39AM +0200, Mathieu Othacehe wrote:
> 
> Hey Jakub,
> 
> Thanks for fixing the cross-compilation, a full review this time :)
> 
> > +             (let* ((outdir (assoc-ref outputs "out"))
> > +                    (bindir (string-append outdir "/bin"))
> > +                    (mandir (string-append outdir "/share/man/man1"))
> > +                    (docdir (string-append outdir "/share/doc/hashcash-" ,version)))
> > +               ;; make install assumes /usr and doesn't provide a way to override it
> > +               (install-file "hashcash" bindir)
> > +               (install-file "hashcash.1" mandir)
> > +               (install-file "README" docdir)
> > +               (install-file "LICENSE" docdir)
> > +               (install-file "CHANGELOG" docdir)
> 
> I think you can set the variables INSTALL_PATH, MAN_INSTALL_PATH and
> DOC_INSTALL_PATH instead.

Unfortunately, the variables are defined with `=` instead of `?=`, so
the Makefile always overwrites them. We would also want to skip
installing the `sha1' tool like Debian does, since `sha1sum' is already
a thing.

> > +               #t))))))
> > +    (home-page "https://www.hashcash.org/")
> > +    (synopsis "Denial-of-service countermeasure")
> > +    (description "Hashcash is a proof-of-work algorithm, which has been used
> > +as a denial-of-service countermeasure technique in a number of systems.
> 
> You can remove "in a number of systems".
> 
> > +A hashcash stamp constitutes a proof-of-work which takes a parametrizable
> > +amount of work to compute for the sender.  The recipient can verify received
> > +hashcash stamps efficiently.
> > +
> > +This package contains a command-line tool for computing and verifying hashcash
> > +stamps.")
> > +    (license license:public-domain)))
> 
> I'm also concerned by this line in the Makefile:
> 
> --8<---------------cut here---------------start------------->8---
> # request static link of -lcrypto only
> LIBCRYPTO=/usr/lib/libcrypto.a
> --8<---------------cut here---------------end--------------->8---
> 
> We should maybe add "openssl" to the inputs and fix this variable
> (that's what Nix does).

From what I've read, openssl is not used by default, but only when a
target like `gnu-openssl' is used. I'll make a build with openssl and
benchmark which is faster...

Regards,
Jakub Kądziołka
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#41637; Package guix-patches. (Wed, 03 Jun 2020 12:31:01 GMT) Full text and rfc822 format available.

Message #20 received at 41637 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Jakub Kądziołka <kuba <at> kadziolka.net>
Cc: 41637 <at> debbugs.gnu.org
Subject: Re: [bug#41637] [PATCH] gnu: Add hashcash.
Date: Wed, 03 Jun 2020 14:30:46 +0200
>> I think you can set the variables INSTALL_PATH, MAN_INSTALL_PATH and
>> DOC_INSTALL_PATH instead.
>
> Unfortunately, the variables are defined with `=` instead of `?=`, so
> the Makefile always overwrites them. We would also want to skip
> installing the `sha1' tool like Debian does, since `sha1sum' is already
> a thing.

Not if they are passed on the command line, see:
https://www.gnu.org/software/make/manual/html_node/Overriding.html

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#41637; Package guix-patches. (Sat, 06 Jun 2020 14:40:01 GMT) Full text and rfc822 format available.

Message #23 received at 41637 <at> debbugs.gnu.org (full text, mbox):

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 41637 <at> debbugs.gnu.org
Subject: Re: [bug#41637] [PATCH] gnu: Add hashcash.
Date: Sat, 6 Jun 2020 16:39:28 +0200
[Message part 1 (text/plain, inline)]
On Wed, Jun 03, 2020 at 08:55:39AM +0200, Mathieu Othacehe wrote:
> 
> Hey Jakub,
> 
> Thanks for fixing the cross-compilation, a full review this time :)
> 
> > +             (let* ((outdir (assoc-ref outputs "out"))
> > +                    (bindir (string-append outdir "/bin"))
> > +                    (mandir (string-append outdir "/share/man/man1"))
> > +                    (docdir (string-append outdir "/share/doc/hashcash-" ,version)))
> > +               ;; make install assumes /usr and doesn't provide a way to override it
> > +               (install-file "hashcash" bindir)
> > +               (install-file "hashcash.1" mandir)
> > +               (install-file "README" docdir)
> > +               (install-file "LICENSE" docdir)
> > +               (install-file "CHANGELOG" docdir)
> 
> I think you can set the variables INSTALL_PATH, MAN_INSTALL_PATH and
> DOC_INSTALL_PATH instead.
> 
> > +               #t))))))
> > +    (home-page "https://www.hashcash.org/")
> > +    (synopsis "Denial-of-service countermeasure")
> > +    (description "Hashcash is a proof-of-work algorithm, which has been used
> > +as a denial-of-service countermeasure technique in a number of systems.
> 
> You can remove "in a number of systems".

Note that systems means things like e-mail or bitcoin, rather than Guix
or Debian.

> > +A hashcash stamp constitutes a proof-of-work which takes a parametrizable
> > +amount of work to compute for the sender.  The recipient can verify received
> > +hashcash stamps efficiently.
> > +
> > +This package contains a command-line tool for computing and verifying hashcash
> > +stamps.")
> > +    (license license:public-domain)))
> 
> I'm also concerned by this line in the Makefile:
> 
> --8<---------------cut here---------------start------------->8---
> # request static link of -lcrypto only
> LIBCRYPTO=/usr/lib/libcrypto.a
> --8<---------------cut here---------------end--------------->8---
> 
> We should maybe add "openssl" to the inputs and fix this variable
> (that's what Nix does).

Firstly, the benchmarking code seems to be broken in Hashcash 1.22.
Downgrading to 1.21 and running hashcash -sv, I found that OpenSSL
is slower than another minting backend, and is not used by default.
I believe it would be better to not include OpenSSL in the package.
That's what Debian does, anyway.

I therefore propose only the following changes:

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index b38e75eb7f..ecd72eee26 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -3217,7 +3217,7 @@ an implementation of LLDP.  It also supports some proprietary protocols.")
                     (bindir (string-append outdir "/bin"))
                     (mandir (string-append outdir "/share/man/man1"))
                     (docdir (string-append outdir "/share/doc/hashcash-" ,version)))
-               ;; make install assumes /usr and doesn't provide a way to override it
+               ;; Install manually, as we don't need the `sha1' binary
                (install-file "hashcash" bindir)
                (install-file "hashcash.1" mandir)
                (install-file "README" docdir)

Regards,
Jakub Kądziołka
[v2-0001-gnu-Add-hashcash.patch (text/plain, attachment)]
[signature.asc (application/pgp-signature, inline)]

Reply sent to Jakub Kądziołka <kuba <at> kadziolka.net>:
You have taken responsibility. (Sat, 20 Jun 2020 21:30:02 GMT) Full text and rfc822 format available.

Notification sent to Jakub Kądziołka <kuba <at> kadziolka.net>:
bug acknowledged by developer. (Sat, 20 Jun 2020 21:30:02 GMT) Full text and rfc822 format available.

Message #28 received at 41637-done <at> debbugs.gnu.org (full text, mbox):

From: Jakub Kądziołka <kuba <at> kadziolka.net>
To: 41637-done <at> debbugs.gnu.org
Subject: Done: [PATCH] gnu: Add hashcash.
Date: Sat, 20 Jun 2020 23:29:01 +0200
[Message part 1 (text/plain, inline)]
Pushed to master as commit ef6d3b643689953b71fe103e8c6f520b54996f11, closing.
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 19 Jul 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.