cmd/meta4-check/main.go | 35 ++++++++++++++++++++++++++--------- common.go | 2 +- diff --git a/cmd/meta4-check/main.go b/cmd/meta4-check/main.go index 04c7c6597da15361f08bee48863528351afdfe769b32a07ca6155bf9f9a0d8b6..c7118255dec7634c66809c22de024ae2ac980f6d97009ecae86100a74ab0bcc9 100644 --- a/cmd/meta4-check/main.go +++ b/cmd/meta4-check/main.go @@ -90,6 +90,27 @@ fmt.Println("Error:", f.Name, "can not save signature:", err) bad = true } } + + fullPath := toCheck[f.Name] + if !(len(toCheck) == 0 || fullPath != "") { + continue + } + if fullPath == "" { + fullPath = f.Name + } + s, err := os.Stat(fullPath) + if err != nil { + fmt.Println(err) + bad = true + continue + } + if uint64(s.Size()) != f.Size { + fmt.Println("size mismatch", + f.Name, "our:", s.Size(), "their:", f.Size) + bad = true + continue + } + hasher := meta4ra.NewHasher(*hashes) var hashTheir string var hashName string @@ -106,15 +127,11 @@ goto HashFound } } } - log.Fatalln("no common hashes found for:", f.Name) + fmt.Println("no common hashes found for:", f.Name) + bad = true + continue + HashFound: - fullPath := toCheck[f.Name] - if !(len(toCheck) == 0 || fullPath != "") { - continue - } - if fullPath == "" { - fullPath = f.Name - } fd, err := os.Open(fullPath) if err != nil { fmt.Println("Error:", f.Name, err) @@ -135,7 +152,7 @@ if hashOur == hashTheir { fmt.Println(f.Name, hashName, "good") } else { fmt.Println( - "Hash does not match:", f.Name, hashName, + "hash mismatch:", f.Name, hashName, "our:", hashOur, "their:", hashTheir, ) diff --git a/common.go b/common.go index e26fa3ea8ab8b0ba1f492138a2547a70939df1f38311d53a12370e4f72486db9..ddf70481610467a589f8ef56408629cd60d3c522f65d5a95dd70c2b17d231390 100644 --- a/common.go +++ b/common.go @@ -17,7 +17,7 @@ // Metalink 4.0 utilities package meta4ra const ( - Generator = "meta4ra/0.5.0" + Generator = "meta4ra/0.6.0" SigMediaTypePGP = "application/pgp-signature" SigMediaTypeSSH = "application/ssh-signature" )