[英]How to verify checksums between Windows and Linux
I have Jenkins build that reads a file from an Azure DevOps repository and runs a .NET dll that verifies the SHA256 of that file against the SHA256 provided in a manifest file.我有一个 Jenkins 构建,它从 Azure DevOps 存储库读取文件并运行一个 .NET dll,该 dll 会根据清单文件中提供的 SHA256 验证该文件的 SHA256。 Unfortunately, Jenkins runs on Linux and does a phantom update to the line endings before processing the file with the piece of .NET code that causes the checksums to mismatch because the checksum in the manifest is calculated in Windows.
不幸的是,Jenkins 在 Linux 上运行并在使用 .NET 代码处理文件之前对行尾进行幻影更新,这会导致校验和不匹配,因为清单中的校验和是在 Windows 中计算的。 I have even tried updating manually updating the line endings from \\r\\n to \\n in notepad++ and updating the manifest with the resulting checksum but it is still failing.
我什至尝试在记事本++中手动更新行结尾从 \\r\\n 到 \\n 并使用结果校验和更新清单,但它仍然失败。 Does anyone here have a suggestion of how to avoid this discrepancy?
这里有人对如何避免这种差异有建议吗?
Manually updating the file might not be a good idea, but you could try to apply a line break normalization function.手动更新文件可能不是一个好主意,但您可以尝试应用换行规范化功能。 Depending on the technology you are using, there will be most likely a normalization function included.
根据您使用的技术,很可能会包含归一化功能。 If it's a line break / compatibility problem, this should usually fix it.
如果是换行符/兼容性问题,这通常应该可以解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.