Skip to content

Conversation

edwbuck
Copy link
Contributor

@edwbuck edwbuck commented Apr 19, 2023

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included?
  • Documentation updated?

Affected functionality
checksum file generation approach, output should be identical.

Description of change
Directly write the output of the hashing command into the checksum files.

This avoids the cut and pasting that we do to take the hash from the hashing algorithm and format it with the file from the trimmed full-file path. It does so by opening a sub-shell, changing directory to the parent of the file to be hashed, generating the hash on the file name only (relative to the current working directory), and then writing the output to the checksum file.

This avoids the need to cut the hashing output to get the hash so we can then reconstruct the hash line with a file name lacking parent directories. This will greatly improve the ability of the --check command to work, as now we don't alter the format of the sha256sum line.

Which issue this PR fixes
Fixes #4095

…les.

This avoids the cut and pasting that we do to take the hash from the hashing
algorithm and format it with the file from the trimmed full-file path.  It does
so by opening a sub-shell, changing directory to the parent of the file to be
hashed, generating the hash on the file name only (relative to the current
working directory), and then writing the output to the checksum file.

This avoids the need to cut the hashing output to get the hash so we can then
reconstruct the hash line with a file name lacking parent directories.  This
will greatly improve the ability of the --check command to work, as now we don't
alter the format of the sha256sum line.

Signed-off-by: Edwin Buck <[email protected]>
@rturner3 rturner3 self-assigned this Apr 19, 2023
@amartinezfayo amartinezfayo added this to the 1.6.4 milestone Apr 20, 2023
@amartinezfayo amartinezfayo merged commit 5ada1e2 into spiffe:main Apr 21, 2023
d-goro pushed a commit to d-goro/spire that referenced this pull request May 18, 2023
…les. (spiffe#4096)

This avoids the cut and pasting that we do to take the hash from the hashing
algorithm and format it with the file from the trimmed full-file path.  It does
so by opening a sub-shell, changing directory to the parent of the file to be
hashed, generating the hash on the file name only (relative to the current
working directory), and then writing the output to the checksum file.

This avoids the need to cut the hashing output to get the hash so we can then
reconstruct the hash line with a file name lacking parent directories.  This
will greatly improve the ability of the --check command to work, as now we don't
alter the format of the sha256sum line.

Signed-off-by: Edwin Buck <[email protected]>
Signed-off-by: Dmitry Gorochovsky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't parse and then reformat shasum hash lines
3 participants