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

add auto-update for the d-keyring #457

Merged
merged 3 commits into from
Sep 2, 2020
Merged

Conversation

AntonOks
Copy link
Contributor

@wilzbach based on the dlang/dlang.org#2817 discussion

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @AntonOks! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

@AntonOks
Copy link
Contributor Author

@wilzbach @MartinNowak Hi there. Seems like all checks are ok finally. Is there anything else needed or desired or are you also ok with this?

thanks and regards

@AntonOks
Copy link
Contributor Author

3 weeks passed by... any feedback from anyone would be appreciated...

@thewilsonator thewilsonator added the auto-merge-squash Like auto-merge, but squash all the commits into one label Sep 2, 2020
@dlang-bot dlang-bot merged commit 41a1da1 into dlang:master Sep 2, 2020
@AntonOks AntonOks deleted the add_auto_update branch September 2, 2020 11:30
wilzbach added a commit that referenced this pull request Sep 3, 2020
@@ -5,6 +5,8 @@
# Authors: Martin Nowak
# Documentation: https://dlang.org/install.html

# set -x
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't have been committed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

forgot this after "debugging", but then again, it is commented out and shouldn't harm, that's why I finally decided to not delete it again. anyhow, feel free to remove it...

@@ -80,7 +82,7 @@ retry() {
for i in {0..4}; do
if "$@"; then
break
elif [ $i -lt 4 ]; then
elif [ "$i" -lt 4 ]; then
Copy link
Member

Choose a reason for hiding this comment

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

i is a number, not a string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct.
if I'm nor wrong, I had it like you suggest it now initially but "shellcheck" complained so I made it as it is... also here, feel free to change it to whatever fit's your standards / requirements...

# check if tools where installed already and update d-keyring.gpg if necessary
local tmp
tmp=$(mkdtemp)
if [ -f "$ROOT/d-keyring.gpg" ] && [ "$(command curl https://dlang.org/d-keyring.gpg -z "$ROOT/d-keyring.gpg" -o "$tmp/d-keyring.gpg" -s -L -w "%{http_code}")" == "200" ] ; then
Copy link
Member

@wilzbach wilzbach Sep 3, 2020

Choose a reason for hiding this comment

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

This is the real problem:

  1. This probably needs retry logic
  2. Probably needs the fallback mirrors
  3. Should verify the authenticity
  4. Shouldn't re-download the file(s) if they haven't changed
  5. Needs to update install.sh as well (the script changes a lot more often than the keyring)
  6. Needs to provide the user an option to opt-out
  7. Should probably use "Last-Modified", "ETag" or similar to avoid unnecessary downloads
  8. Auto-updates need to be documented in help page, documentation and changelog (there are serious security concerns with it)
  9. Should have a test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this all together is far beyond my bash foo and also the time I can / want spend on this topic, sorry...
nevertheless, some comments from here...

  1. => make's sense but I couldn't find a (smart & easy) way how to check if the file was changed without downloading it. actually I did read plenty of "curl way" post / blogs, i.e. https://blog.yjl.im/2012/03/downloading-only-when-modified-using.html and https://www.thegeekstuff.com/2012/04/curl-examples/ but at the end it seems like curl ALLWAYS downloads the file to be able to check for a change... and as it's downloaded anyhow, I decided to implement it as it is

  2. => well, if the script itself should also be updated, neither this change nor the "update" option of the script makes any sense... because in other words you ask to make the already existing"update" option an always applied defauld (from my point of view, I wouldn't like this kind of change... I want to know and control when and why a tool gets updated)

  3. => see my comments on topic nr4

dlang-bot pushed a commit that referenced this pull request Sep 3, 2020
@wilzbach
Copy link
Member

wilzbach commented Sep 3, 2020

Hi, I'm really sorry for not responding (things are rather busy), but this shouldn't have been merged without review. I triggered a revert, s.t. this change doesn't get accidentally deployed before we are ready to announce it. I am aware that this is a very frustrating experience and I will try to be a lot more active next time and if you understandably decide to not resubmit, I will try to find time to champion it. Sorry.

@AntonOks
Copy link
Contributor Author

AntonOks commented Sep 4, 2020

Hi, I'm really sorry for not responding (things are rather busy), but this shouldn't have been merged without review. I triggered a revert, s.t. this change doesn't get accidentally deployed before we are ready to announce it. I am aware that this is a very frustrating experience and I will try to be a lot more active next time and if you understandably decide to not resubmit, I will try to find time to champion it. Sorry.

Hey Seb, no prob and no need for apologias.
As people wrote so many time in the forum, Dlang is only community driven anyhow... and I know you and a little group of "key contributer's" improved Dlang and it's eco system A LOT... so big thanks for all your efforts!

@andre2007
Copy link

@AntonOks
What do you think about following interaction flow:
In case of an key ring error there is a prompt for updating the file.
In addition there is also a command line argument to force the key ring update (false by default).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-squash Like auto-merge, but squash all the commits into one
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants