apache - `md5sum -c` 获得 't work with Apache' s MD5 文件格式

标签 apache md5sum

让我带你去旅行..

我正在尝试在新的 Debian (Jessie) 计算机上通过 MD5 下载并验证 Apache Spark ( http://www.apache.org/dist/spark/spark-1.6.0/spark-1.6.0-bin-hadoop2.6.tgz )。

md5sum 脚本已存在于该计算机上,无需我执行任何操作。

因此,我继续将 MD5 校验和 ( http://www.apache.org/dist/spark/spark-1.6.0/spark-1.6.0-bin-hadoop2.6.tgz.md5 ) 下载到与下载的 Spark 相同的目录,然后执行:

md5sum -c spark-1.6.0-bin-hadoop2.6.tgz.md5

此操作失败:

md5sum: spark-1.6.0-bin-hadoop2.6.tgz.md5: no properly formatted MD5 checksum lines found

因此我通过 cat spark-1.6.0-bin-hadoop2.6.tgz.md5 检查内容:

spark-1.6.0-bin-hadoop2.6.tgz: 62 4B 16 1F 67 70 A6 E0  E0 0E 57 16 AF D0 EA 0B

这就是整个文件。对我来说看起来不错 - 也许 Spark 下载实际上很糟糕?在采取这一假设之前,我首先通过 md5sum Spark-1.6.0-bin-hadoop2.6.tgz 了解 MD5 现在是什么:

624b161f6770a6e0e00e5716afd0ea0b  spark-1.6.0-bin-hadoop2.6.tgz

嗯,这是一种完全不同的格式 - 但如果您仔细观察,您会发现数字和字母实际上是相同的(除了小写且没有空格)。看起来 Debian 附带的 md5sum 遵循不同的标准。

也许我可以通过另一种方式运行这个命令?让我们尝试一下md5sum --help:

Usage: md5sum [OPTION]... [FILE]...
Print or check MD5 (128-bit) checksums.
With no FILE, or when FILE is -, read standard input.

  -b, --binary         read in binary mode
  -c, --check          read MD5 sums from the FILEs and check them
      --tag            create a BSD-style checksum
  -t, --text           read in text mode (default)

The following four options are useful only when verifying checksums:
      --quiet          don't print OK for each successfully verified file
      --status         don't output anything, status code shows success
      --strict         exit non-zero for improperly formatted checksum lines
  -w, --warn           warn about improperly formatted checksum lines

      --help     display this help and exit
      --version  output version information and exit

The sums are computed as described in RFC 1321.  When checking, the input
should be a former output of this program.  The default mode is to print
a line with checksum, a character indicating input mode ('*' for binary,
space for text), and name for each FILE.

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Report md5sum translation bugs to <http://translationproject.org/team/>
Full documentation at: <http://www.gnu.org/software/coreutils/md5sum>
or available locally via: info '(coreutils) md5sum invocation'

好吧,--tag 似乎改变了格式。让我们尝试一下md5sum --tag spark-1.6.0-bin-hadoop2.6.tgz:

MD5 (spark-1.6.0-bin-hadoop2.6.tgz) = 624b161f6770a6e0e00e5716afd0ea0b

确实,这是一种不同的格式,但仍然不正确。所以我查看 Apache Download Mirrors 上的说明。页面并找到以下文本:

Alternatively, you can verify the MD5 hash on the file. A unix program called md5 or md5sum is included in many unix distributions. It is also available as part of GNU Textutils...

所以我点击该链接,发现 Textutils 已于 2003 年合并到 Coreutils - 所以我实际上想要 Coreutils 中的 md5sum 。不过,您可以在 md5sum --help 转储的底部看到它已经来自 Coreutils。

这可能意味着我的 Coreutils 已经过时了。所以我会apt-get update && apt-get update coreutils,但后来我发现:

Calculating upgrade... coreutils is already the newest version.

那是一个死胡同..但是等一下,他们说“md5md5sum”!让我们检查一下该线索。

md5 脚本尚不存在,所以我将尝试 apt-get install md5:

E: Unable to locate package md5

现在我迷路了,所以先向 Google 求助,然后向 StackOverflow 寻求帮助。现在我来了。

那么这两种不同的 MD5 文件格式是怎么回事?我该如何处理这个问题(并最终验证我的 Apache Spark)?

最佳答案

我相信 gpg --print-md md5 spark-1.6.0-bin-hadoop2.6.tgz 应该与 .md5 文件的内容匹配。

md5/sha 文件的格式存在问题,因为构建 Spark 版本的脚本使用 gpg --print-md md5 来创建签名文件。请参阅:https://issues.apache.org/jira/browse/SPARK-5308

关于apache - `md5sum -c` 获得 't work with Apache' s MD5 文件格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35250007/

相关文章:

php - 如何禁用尾部斜杠附加?

JavaScript MD5 与 Python/Bash md5sum 不同

c# - 使用 md5 哈希或文件长度进行文件比较?

php - 无法在 cent os 6.4 中启用 SOAP(最终版)

java - Tomcat 在启动时不会从 eclipse 启动 : Several ports (8005, 8080) 本地主机上的 Tomcat 服务器所需的已在使用中

hash - 需要更快的 Linux 指纹/哈希比较的建议

java - 文件更改后 MD5 哈希值未更改

md5sum - Unix md5sum 与 Powershell Get-hash

php - 服务器发送的事件 Apache 配置

eclipse - "Ignoring InnerClasses attribute"警告正在终止 Eclipse