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

Individualize NameHashSet Hashing & Revisit #709 #740

Merged
merged 5 commits into from Jul 10, 2018
Merged

Individualize NameHashSet Hashing & Revisit #709 #740

merged 5 commits into from Jul 10, 2018

Conversation

Headline
Copy link
Member

@Headline Headline commented Dec 23, 2017

On #709, we forgot to convert the NameHashSet<CPlugin *>'s lookups to be lowercase. This will fix some casing issues people were experiencing trying to unload their (case-edited) plugins.

EDIT (12/27/17):
Upon asherkin’s message below, I reverted the first commit of this PR & the #709 commit. The new solution to this entire problem, including the one #709 tried to solve, is to change the way NameHashSet hashes the key by forcing policies to also implement a hash method which will be used instead of the blanket implementation of hash that existed before.

Edit (6/17/2018):
Fixes #831

@asherkin
Copy link
Member

I wonder if we should just change the hash strategy for the NameHashSet, and revisit the original change.

@Headline
Copy link
Member Author

That’s probably a cleaner way of accomplishing this. I’ll submit a patch in the near future

Basically, in order to implement our own (actual) hash policy in
`PluginSys.h`, we needed to remove the blanket implementation of `hash`
that was used before. Now, each policy must implement `hash` along with
`matches` in order to be used with `NameHashSet`. While this does force
us to change every implementation of policies across the entirety of
sourcemod, it allows core to use flexible implementations of `hash`.
@Headline Headline changed the title Make mac/win lookups lowercase'd Individualize NameHashSet Hashing & Revisit #709 Dec 27, 2017
@Headline
Copy link
Member Author

@asherkin can you add this to your list for a review?

duck says he's cool to take this into 1.10 and if all is well after a while it's cool to cherrypick into 1.9

Copy link
Member

@asherkin asherkin left a comment

Choose a reason for hiding this comment

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

I'm perfectly happy with this change - the only thing I was waiting on was having a shot at using SFINAE to avoid implement hash everywhere, but lets ship this.

(I can't merge things sanely atm, which also applies to your other PRs I have r+'d but not merged myself.)

@psychonic psychonic merged commit aaac0b9 into alliedmodders:master Jul 10, 2018
@Headline Headline deleted the fix-wind-unload-issue branch July 18, 2018 12:10
Headline added a commit that referenced this pull request Jul 28, 2018
* Make mac/win lookups lowercase'd

* Revert #709 & 81042cc

* Adjust HashPolicy implementation across sourcemod

Basically, in order to implement our own (actual) hash policy in
`PluginSys.h`, we needed to remove the blanket implementation of `hash`
that was used before. Now, each policy must implement `hash` along with
`matches` in order to be used with `NameHashSet`. While this does force
us to change every implementation of policies across the entirety of
sourcemod, it allows core to use flexible implementations of `hash`.

* Remove logic duplication

* Improve lowercase checks
Headline added a commit that referenced this pull request Jul 28, 2018
@Headline Headline restored the fix-wind-unload-issue branch August 4, 2018 01:34
asherkin pushed a commit that referenced this pull request Aug 11, 2018
This is a clone of #740, but without the amtl ke::AString lowercase which was implemented in a new version of amtl that 1.9-dev isn't pinned to. Updating this pin and moving fixes is beyond what should go in 1.9, and this fixes a annoying and user-impactful bug with reload/unloading plugins on windows.

Currently in 1.9, once a plugin is loaded into the pluginsys, they must be used with lowercase characters *only*, since pr #709 ignorantly modified their names. 

```
// test.smx exists in /plugins/
sm plugins load TEST.smx // successful
sm plugins unload TEST.smx // TEST.smx not found, it's actually test.smx
```

This pr fixes that error by converting *all* lookups, not just loads.
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.

Path file case detection
3 participants