簡體   English   中英

`md5sum -c`不適用於Apache的MD5文件格式

[英]`md5sum -c` won't work with Apache's MD5 file format

我帶你去旅行..

我正在嘗試通過MD5下載並驗證Apache Spark( http://www.apache.org/dist/spark/spark-1.6.0/spark-1.6.0-bin-hadoop2.6.tgz ) Debian(傑西)機器。

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下載鏡像頁面上的說明並找到以下文本:

或者,您可以驗證文件上的MD5哈希值。 許多unix發行版中都包含一個名為md5md5sum unix程序。 它也可以作為GNU Textutils的一部分...

所以我按照這個鏈接發現Textutils在2003年被合並到Coreutils - 所以我實際上想要Coreutils的md5sum 但是你可以在md5sum --help轉儲的底部看到它已經來自Coreutils了。

這可能意味着我的Coreutils已經過時了。 所以我將apt-get update && apt-get upgrade 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM