Skip to content
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

fix: sign.sh incorrectly uses relative path of nuget package instead of absolute path for signing operations #1478

Merged
merged 3 commits into from
Oct 13, 2023

Conversation

colifran
Copy link
Contributor

@colifran colifran commented Oct 12, 2023

sign.sh was incorrectly using the relative nuget package path rather than the absolute nuget package path for signing operations. This was causing the signing process to exit with status 12. This PR corrects this mistake by getting the absolute nuget package path via the following code:

nuget_package=$(cd $(dirname ${nuget_package_path}) && echo $PWD)/$(basename ${nuget_package_path})

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@rix0rrr rix0rrr marked this pull request as draft October 13, 2023 06:56
Copy link
Contributor

@rix0rrr rix0rrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved but maybe document what and why you're doing a bit more precisely.

And update the title: you need the absolute path because you are cding in a subshell, so a relative path name would change meaning when you do that.

@@ -21,12 +21,13 @@ fi
found=false
for nuget_package_path in $(find dotnet -name *.nupkg -not -iname *.symbols.nupkg); do
found=true
echo "🔑 Applying authenticode signatures to assemblies in ${nuget_package_path}"
for file in $(unzip -Z1 ${nuget_package_path} '*.dll'); do
nuget_package=$(cd $(dirname ${nuget_package_path}) && echo $PWD)/$(basename ${nuget_package_path})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like what you're trying to do is make this path absolute.

Most Linuxes will have the tool realpath to do this (won't exist on Mac by default though), and according to StackOverflow you can use readlink -f <file> as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted - thanks for explaining that and showing me an alternative!

@colifran colifran marked this pull request as ready for review October 13, 2023 14:39
@colifran colifran marked this pull request as draft October 13, 2023 14:41
@colifran colifran changed the title fix: sign.sh incorrectly uses nuget package path instead of nuget package for signing operations fix: sign.sh incorrectly uses relative path of nuget package instead of absolute path for signing operations Oct 13, 2023
@colifran colifran marked this pull request as ready for review October 13, 2023 18:16
@mergify mergify bot merged commit cf309b4 into main Oct 13, 2023
12 checks passed
@mergify mergify bot deleted the colifran/nuget-package-path branch October 13, 2023 18:17
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.

2 participants