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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace `/`'s for cache version dir name #258

Merged
merged 5 commits into from Jun 18, 2019

Conversation

Projects
None yet
3 participants
@codedmart
Copy link
Contributor

commented Jun 10, 2019

Description of the change

TODO

Checklist:

  • Added the change to the "Unreleased" section of the changelog
  • Added some example of the new feature to the README
  • Added a test for the contribution (if applicable)

P.S.: the above checks are not compulsory to get a change merged, so you may skip them. However, taking care of them will result in less work for the maintainers and will be much appreciated 馃槉

Show resolved Hide resolved test/SpagoSpec.hs Outdated
@f-f

f-f approved these changes Jun 10, 2019

Copy link
Member

left a comment

Just one small suggestion, but otherwise looks great! 馃憦

Show resolved Hide resolved test/SpagoSpec.hs Outdated
Show resolved Hide resolved src/Spago/FetchPackage.hs Outdated

@codedmart codedmart force-pushed the codedmart:codedmart/257 branch from 6e73c43 to 75ff39c Jun 10, 2019

@codedmart codedmart force-pushed the codedmart:codedmart/257 branch from 75ff39c to 240cf65 Jun 10, 2019

@codedmart

This comment has been minimized.

Copy link
Contributor Author

commented Jun 10, 2019

@f-f OK updated now. As per @hdgarrood's suggestion also escaping a few other characters that could be in branch names as well.

@hdgarrood

This comment has been minimized.

Copy link
Contributor

commented Jun 10, 2019

I think we should include % in the list of characters to be escaped as currently I think 鈥%2F鈥 and 鈥/鈥 will both map to 鈥%2F鈥.

Also I鈥檝e just remembered that case insensitive file systems are a thing...

@f-f

This comment has been minimized.

Copy link
Member

commented Jun 10, 2019

@hdgarrood agreed, this is currently still not injective but if we add % to the list it will.

And yes, e.g. my mac is case insensitive, so two branches with different cases would still clash. I think though we can just add a TODO about this and hope no one tries to fetch two branches differing only by case 馃槃

Btw @codedmart if you want to have some fun you could setup Quickcheck with a property that requires that getCacheVersionDir cannot map two different names to the same output (I'll merge this PR in any case, so if you want to do this feel free to open another PR. Though it's probably more interesting if you write the test before fixing the implementation, so you can marvel at Quickcheck proving things)

@codedmart

This comment has been minimized.

Copy link
Contributor Author

commented Jun 10, 2019

Yup forgot % and the case sensitivity. Will fix. I will look at the test as well. Thanks!

@f-f f-f referenced this pull request Jun 11, 2019

Merged

0.8.3 鈫 0.8.4 #259

@hdgarrood

This comment has been minimized.

Copy link
Contributor

commented Jun 11, 2019

I suppose one option is to say that any uppercase character needs escaping too; in my experience branch names rarely contain uppercase characters (so this scheme will probably give you nice readable branch names more often than not).

@hdgarrood

This comment has been minimized.

Copy link
Contributor

commented Jun 11, 2019

Also if you want to write a QuickCheck property for this, I think you'd need to be a bit careful if you want to end up with one that's actually useful; if you just write

quickCheck \x y -> (x /= y) ==> (getVersionCacheDir x /= getVersionCacheDir y)

then the chance of a collision is so astronomically tiny that that test is only really slowing down your test suite. I'd recommend writing your own generator which uses a much smaller set of characters to sample from, in particular including the ones we know to be problematic. Then, instead of running lots of individual tests, we should just run a single test where we generate a large set of potential branch names, apply the getVersionCacheDir function to all of them, assemble the results into another set, and check that the result set is the same size as the input set. I think this is the only way you'll get the test to fail reliably if the function is not actually injective.

f-f added some commits Jun 12, 2019

@f-f

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

@codedmart this got a bit out of sync after all the ZuriHac's contributions, so I'll merge it now so we can ship it in the upcoming release later today. Thank you! 馃檪

@f-f f-f merged commit 2d30786 into spacchetti:master Jun 18, 2019

0 of 2 checks passed

Travis CI - Pull Request Build Failed
Details
continuous-integration/appveyor/pr AppVeyor build failed
Details

elliotdavies pushed a commit to elliotdavies/spago that referenced this pull request Jul 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.