-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contents should include checksum and filename in standard format #127
Comments
I am also looking to use
Looking at the ArtifactsMojo class, line 128 and OneHashPerFileTarget line 145, the GNU format seems to be already supported. To switch this on, add Example usage: <plugin>
<groupId>net.nicoulaj.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<version>1.11</version>
<executions>
<execution>
<id>calculate-checksums</id>
<goals>
<goal>files</goal>
</goals>
<!-- execute prior to maven-gpg-plugin:sign due to https://github.com/nicoulaj/checksum-maven-plugin/issues/112 -->
<phase>post-integration-test</phase>
<configuration>
<appendFilename>true</appendFilename> <!-- ADD THIS LINE TO THE CONFIGURATION -->
<algorithms>
<algorithm>SHA-256</algorithm>
<algorithm>SHA-512</algorithm>
</algorithms>
<!-- https://maven.apache.org/apache-resource-bundles/#source-release-assembly-descriptor -->
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<includes>
<include>${myproject}-${project.version}-src.zip</include>
<include>${myproject}-${project.version}-src.tar.gz</include>
<include>${myproject}-${project.version}-bin.zip</include>
<include>${myproject}-${project.version}-bin.tar.gz</include>
</includes>
</fileSet>
</fileSets>
<csvSummary>false</csvSummary>
</configuration>
</execution> |
As far as I remember, OpenSSL produces BSD-style as well. |
I think best would be to drop this
|
Also, keep in mind GNU has two formats, one for text mode input ( |
I am either completely stupid, but I really don't understand the purpose the text mode at all. All of those message digest operate on bytes. What do I miss? |
The intention of text mode was that the checksum would normalize line endings for text files. |
Here are the relevant algo to name mappings for BSD format: https://github.com/freebsd/freebsd-src/blob/78beb051a2661b873342162b1ec0ad55b4e27261/sbin/md5/md5.c#L122-L156 |
I think this is something we really want to have for all Maven-based ASF releases. |
As ugly as this is I was able to work around this problem with
|
This plugin should support writing files in a standard format, for easier verification. Standard tools have a convenient
-c
option to verify a checksum file, but this doesn't work with the checksums created by this plugin, because they are not in a standard format.There are two standard file formats for use with checksum files:
man sha512sum
). This outputs in the format<checksum><space><spaceInTextModeOrAsteriskInBinaryMode><filename><newline>
, repeated for each file whose checksum is contained in the file (in this case, there would only be one file's checksum).--tag
option (seeman sha512sum
). This outputs in the format<ALGNAME><space><lparen><filename><rparen><space><equal><space><checksum><newline>
for each checksum.Both of these standard formats are also supported by the
shasum
executable backed by the commonly usedDigest::SHA
perl module.Here's some examples (using
tee
to output the content of the checksum file as it is written):I didn't show an example with the
-b
binary flag for the GNU format examples, but I strongly recommend using BSD format anyway, which always uses binary mode when generating and verifying checksums.For me, using this plugin is a downgrade because the file formats it emits are not easily verified with standard tools. If it output in a standard format (preferably the BSD format, because it shows the algorithm used explicitly, which will be important as SHA3 becomes more common, and always uses binary mode), this plugin would be far more useful.
The text was updated successfully, but these errors were encountered: