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

Update safe properties in .status.el (whitelist approach) #2238

Merged
merged 5 commits into from
Sep 7, 2015

Conversation

npostavs
Copy link
Collaborator

@npostavs npostavs commented Sep 2, 2015

Fixes #1817.

This extends the whitelist with a 2nd update whitelist, with special cases for :builtin (safe if we haven't "crossed" the Emac version) and :url (safe for some recipe types).

I'm actually considering switching to a blacklist approach instead. Consider that removing (or adding) properties like :provide that are unknown to el-get is obviously perfectly safe. Essentially, properties that are not used by a type's update method are safe to change.

The downside of blacklists is it's more dangerous if we get the list wrong of course. But, leaving a stale recipe is also bad if we want to use it (eg a solution for #2232 might want to do that).

Thoughts?

@dimitri
Copy link
Owner

dimitri commented Sep 2, 2015

Not sure about the backlist idea here... the current tradeoff is towards making it as easy as possible to author recipes, at the expenses of loose control and sometimes harder to debug situations... that said, I'm not doing enough debugging here to have a horse in this race, so I'll trust you to make the right choice!

Previously, the recipe in .status.el was only updated on init, since
only some properties are safe for change on init the unsafe ones were
never updated.  Therefore, we classify addtional properties as safe fo
change on update, and update .status.el after el-get-update too.

* el-get-core.el (el-get-as-string): Handle number argument.
* el-get-status.el (el-get-status-init-whitelist): Rename from
  el-get-status-recipe-update-whitelist.
(el-get-status-update-whitelist): New constant.
(el-get-classify-new-properties): Add OPERATION argument to choose white
whitelist to use.  The :builtin property is safe to change if it doesn't
change the :type.
(el-get-diagnosis-properties, el-get-merge-properties-into-status): Add
OPERATION argument.
* el-get.el (el-get-do-init): Call el-get-merge-properties-into-status
  with OPERATION 'init.
(el-get-post-update-build): Call el-get-merge-properties-into-status
  with OPERATION 'update.
* el-get-status.el (el-get-classify-new-properties): Consider :url
  changes update safe for :type http*, builtin.  Consider :builtin
  changes safe if not crossing current Emacs version.
Make it say exactly which operation(s) are required to update the
recipe.

* el-get-status.el (el-get-classify-new-properties): Return a partition
  of updates for each operation instead of (dis)allowed lists for a
  given operation.
(el-get-diagnosis-properties): Return the required operation(s) instead
of update-p.
(el-get-merge-properties-into-status): Make the warning only suggest to
update if that would actually succeed given the properties needing
updating.
@npostavs
Copy link
Collaborator Author

npostavs commented Sep 7, 2015

the current tradeoff is towards making it as easy as possible to author recipes, at the expenses of loose control and sometimes harder to debug situations

Changing to a blacklist shouldn't affect recipe authoring at all. The difficulty would be in writing the blacklist itself, which has to be different per el-get :type. I think ultimately blacklisting is correct because changing unknown properties is safe, but since it's going to need more work I will go with this whitelist approach for now.

Or maybe it's better to just add a manual override to el-get-merge-properties-into-status, I've just noticed

Warning (el-get): Must reinstall `undo-tree' to modify its cached recipe
  adding:   (:url "http://www.dr-qubit.org/git/undo-tree.git/")
  removing: (:url "http://www.dr-qubit.org/git/undo-tree.git")

To realize that is safe would require some url parsing, which really seems like overkill...

@npostavs
Copy link
Collaborator Author

npostavs commented Sep 7, 2015

Another thing to consider is updating only some of the properties, currently it's all-or-nothing so some property changes deemed "unsafe" can hold the rest "hostage". I just hit this now after updating magit, the :load-path wasn't updated (because of some other property changes) causing a Cannot open load file: no such file or directory, with-editor error. Only current way to fix is el-get-reinstall.

npostavs referenced this pull request Sep 7, 2015
with-editor is registered as an individual package on MELPA but it is
provided by magit.  The version from MELPA complains because the el-get
version of dash is installed instead of the MELPA version.  By having
magit provide with-editor we avoid the issues of having MELPA's version
installed.
@npostavs npostavs merged commit 5be0271 into dimitri:master Sep 7, 2015
@npostavs npostavs deleted the update-safe-props-v2 branch April 3, 2016 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants