~andir/nixpkgs-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] fetch-yarn-deps: improve diagnostic messages

Details
Message ID
<20240724215934.18467-2-adam@westernsemico.com>
DKIM signature
pass
Download raw message
Patch: +1 -1
When the hash of an url being fetched does not match the expected value, this
commit will cause fetch-yarn-deps to include the url in the error message to
assist debugging.
---
 pkgs/build-support/node/fetch-yarn-deps/index.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkgs/build-support/node/fetch-yarn-deps/index.js b/pkgs/build-support/node/fetch-yarn-deps/index.js
index e60fdeb54330..91e3d1014661 100755
--- a/pkgs/build-support/node/fetch-yarn-deps/index.js
+++ b/pkgs/build-support/node/fetch-yarn-deps/index.js
@@ -39,7 +39,7 @@ const downloadFileHttps = (fileName, url, expectedHash, hashType = 'sha1') => {
				const h = hash.read()
				if (expectedHash === undefined){
					console.log(`Warning: lockfile url ${url} doesn't end in "#<hash>" to validate against. Downloaded file had hash ${h}.`);
				} else if (h != expectedHash) return reject(new Error(`hash mismatch, expected ${expectedHash}, got ${h}`))
				} else if (h != expectedHash) return reject(new Error(`hash mismatch, expected ${expectedHash}, got ${h} for ${url}`))
				resolve()
			})
                        res.on('error', e => reject(e))
-- 
2.44.0
Details
Message ID
<uavzlzrpxrtbu4d74qdvnctyxvf364ds43iv572ckn6i77guck@62rvhlbfgd7h>
In-Reply-To
<20240724215934.18467-2-adam@westernsemico.com> (view parent)
DKIM signature
pass
Download raw message
https://github.com/NixOS/nixpkgs/pull/329863

On Wed, Jul 24, 2024 at 02:59:35PM GMT, Adam Joseph wrote:
>When the hash of an url being fetched does not match the expected value, this
>commit will cause fetch-yarn-deps to include the url in the error message to
>assist debugging.
>---
> pkgs/build-support/node/fetch-yarn-deps/index.js | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/pkgs/build-support/node/fetch-yarn-deps/index.js b/pkgs/build-support/node/fetch-yarn-deps/index.js
>index e60fdeb54330..91e3d1014661 100755
>--- a/pkgs/build-support/node/fetch-yarn-deps/index.js
>+++ b/pkgs/build-support/node/fetch-yarn-deps/index.js
>@@ -39,7 +39,7 @@ const downloadFileHttps = (fileName, url, expectedHash, hashType = 'sha1') => {
> 				const h = hash.read()
> 				if (expectedHash === undefined){
> 					console.log(`Warning: lockfile url ${url} doesn't end in "#<hash>" to validate against. Downloaded file had hash ${h}.`);
>-				} else if (h != expectedHash) return reject(new Error(`hash mismatch, expected ${expectedHash}, got ${h}`))
>+				} else if (h != expectedHash) return reject(new Error(`hash mismatch, expected ${expectedHash}, got ${h} for ${url}`))
> 				resolve()
> 			})
>                         res.on('error', e => reject(e))
>-- 
>2.44.0
>

-- 
Florian Klink
Reply to thread Export thread (mbox)