Skip to content

pkg/ioutils: remove crypto/sha256, crypto/sha512 imports#49281

Merged
AkihiroSuda merged 1 commit intomoby:masterfrom
thaJeztah:remove_crypto
Jan 15, 2025
Merged

pkg/ioutils: remove crypto/sha256, crypto/sha512 imports#49281
AkihiroSuda merged 1 commit intomoby:masterfrom
thaJeztah:remove_crypto

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

relates to:

commit 572498b moved the ioutils.HashData utility to the libnetwork resolvconf package.

After removing, we saw some tests in the reference pacakge failing;

=== Failed
=== FAIL: reference TestLoad (0.00s)
    store_test.go:53: failed to parse reference: unsupported digest algorithm

=== FAIL: reference TestSave (0.00s)
    store_test.go:82: failed to parse reference: unsupported digest algorithm

=== FAIL: reference TestAddDeleteGet (0.00s)
    store_test.go:174: could not parse reference: unsupported digest algorithm

=== FAIL: reference TestInvalidTags (0.00s)
    store_test.go:355: assertion failed: error is not nil: unsupported digest algorithm

Those failures were because those tests depended on a side-effect of the ioutils package being imported, which (before removal of HashData) imported crypto/sha256, registering that algorithms, which on its turn was used by github.com/opencontainers/go-digest to determnin if a given algorithm must be accepted (see go-digest#64).

As a workaround, these imports were added. pkg/ioutils is now imported in less places, and should not be depended on for this purpose.

Let's remove this workaround; if needed, these imports can be added in a more relevant location.

This reverts commit 98caf09.

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

commit 572498b moved the ioutils.HashData
utility to the libnetwork resolvconf package.

After removing, we saw some tests  in the reference  pacakge failing;

    === Failed
    === FAIL: reference TestLoad (0.00s)
        store_test.go:53: failed to parse reference: unsupported digest algorithm

    === FAIL: reference TestSave (0.00s)
        store_test.go:82: failed to parse reference: unsupported digest algorithm

    === FAIL: reference TestAddDeleteGet (0.00s)
        store_test.go:174: could not parse reference: unsupported digest algorithm

    === FAIL: reference TestInvalidTags (0.00s)
        store_test.go:355: assertion failed: error is not nil: unsupported digest algorithm

Those failures were because those tests depended on a side-effect of the
ioutils package being imported, which (before removal of HashData) imported
crypto/sha256, registering that algorithms, which on its turn was used by
github.com/opencontainers/go-digest to determnin if a given algorithm must
be accepted (see [go-digest#64]).

As a workaround, these imports were added. pkg/ioutils is now imported
in less places, and should not be depended on for this purpose.

Let's remove this workaround; if needed, these imports can be added in
a more relevant location.

This reverts commit 98caf09.

[go-digest#64]: opencontainers/go-digest#64

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah added status/2-code-review kind/refactor PR's that refactor, or clean-up code labels Jan 14, 2025
@thaJeztah thaJeztah added this to the 28.0.0 milestone Jan 14, 2025
@thaJeztah thaJeztah self-assigned this Jan 14, 2025
@AkihiroSuda AkihiroSuda merged commit 264801e into moby:master Jan 15, 2025
@thaJeztah thaJeztah deleted the remove_crypto branch January 15, 2025 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor PR's that refactor, or clean-up code status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants