From: bokr@bokr.com
To: Simon Tournier <zimon.toutoune@gmail.com>
Cc: "Ludovic Courtès" <ludo@gnu.org>,
"Stephen Paul Weber" <singpolyma@singpolyma.net>,
guix-devel@gnu.org, 0@psycoti.ca
Subject: Re: git-fetch without a hash
Date: Sun, 5 Feb 2023 18:44:10 +0100 [thread overview]
Message-ID: <20230205174410.GA2570@LionPure> (raw)
In-Reply-To: <86zgap3x0u.fsf@gmail.com>
Hi,
On +2023-01-11 16:34:41 +0100, Simon Tournier wrote:
> Hi,
>
> On Mon, 09 Jan 2023 at 12:16, Ludovic Courtès <ludo@gnu.org> wrote:
> > Simon Tournier <zimon.toutoune@gmail.com> skribis:
> >
> >> Maybe my question is naive but what is the use case for this (sha256 #f)
> >> in the first place? Because maybe it could just error using some
> >> ’sanitize’ for the hash record field.
> >
> > There’s a couple of uses: Chromium, IceCat, and Linux-libre (IIRC).
> >
> > I don’t like that, but I’m not sure what it would take to change these
> > to <computed-file> or something like that.
>
> Well, from (gnu packages linux)
>
> --8<---------------cut here---------------start------------->8---
> (origin
> (method computed-origin-method)
> (file-name (string-append "linux-libre-" version "-guix.tar.xz"))
> (sha256 #f)
> --8<---------------cut here---------------end--------------->8---
>
> and from (gnu packages gnuzilla)
>
> --8<---------------cut here---------------start------------->8---
> (origin
> (method computed-origin-method)
> (file-name (string-append "icecat-" %icecat-version ".tar.xz"))
> (sha256 #f)
> --8<---------------cut here---------------end--------------->8---
>
> but not from Chromium, if I read correctly.
>
> From my understanding, we could have something like,
>
> (sha256 (no-hash))
>
> where ’no-hash’ would return a string, say
> "0000000000000000000000000000000000000000000000000000" or whatever else
> that would satisfy this hypothetical ’sha256’ sanitizer.
>
>
> Cheers,
> simon
>
For portability to any hash algorithm that returns a hex string,
how about letting them hash a zero-length string (which can never
represent a package tarball or other archive), and using the
resulting strings as no-hash flags?
These strings must be unique for whatever hash algorithm,
so a short table could be used to recognize them as
no-hash indicators.
--8<---------------cut here---------------start------------->8---
$ sha256sum /dev/null
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 /dev/null
$ sha256sum <(echo -n '')
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 /dev/fd/63
$ echo -n ''|sha256sum
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -
$ echo -n ""|sha256sum
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -
--8<---------------cut here---------------end--------------->8---
For other hash values on your system, probably the below will show most.
Translating from hex to various base32 and other-base alphabets
is then trivial, (and open, i.e. permitting new hash representation strings).
--8<---------------cut here---------------start------------->8---
$ ls -1d /usr/bin/*sum|while read hasher;do \
echo;echo "$hasher:"; "$hasher" /dev/null;done
--8<---------------cut here---------------end--------------->8---
WDYT?
--
Regards,
Bengt Richter
next prev parent reply other threads:[~2023-02-05 17:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-21 3:04 git-fetch without a hash Stephen Paul Weber
2022-12-21 22:49 ` Ludovic Courtès
2023-01-03 19:31 ` Stephen Paul Weber
2023-01-03 21:34 ` Ludovic Courtès
2023-01-05 10:06 ` Simon Tournier
2023-01-09 11:16 ` Ludovic Courtès
2023-01-11 15:34 ` Simon Tournier
2023-02-05 17:44 ` bokr [this message]
2023-02-06 17:01 ` Simon Tournier
2023-01-09 17:13 ` Ludovic Courtès
2023-01-09 17:35 ` Stephen Paul Weber
2023-01-17 16:01 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230205174410.GA2570@LionPure \
--to=bokr@bokr.com \
--cc=0@psycoti.ca \
--cc=guix-devel@gnu.org \
--cc=ludo@gnu.org \
--cc=singpolyma@singpolyma.net \
--cc=zimon.toutoune@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).