cache_fn_url() changed in 4.3.x #4248

Closed
ilanschnell opened this Issue Jan 10, 2017 · 3 comments

Projects

None yet

3 participants

@ilanschnell
Member

In conda < 4.3 the function was simply:

def cache_fn_url(url):
    md5 = hashlib.md5(url.encode('utf-8')).hexdigest()
    return '%s.json' % (md5[:8],)

however, in 4.3, an additional url = url.rstrip('/') has been added. Therefore the resulting filename is different.

This means that updating to conda 4.3.2 will automatically invalidate all existing caches of repodata from any channel. I'm not sure if this is going to be a big problem, but I assume that people who operate in offline mode are going to suddenly not be able to do operations which involve rely on having a local cache of repodata. I'm thinking about air-gapped environments. The easiest solution would be to restore the old functionality.

@mcg1969
Contributor
mcg1969 commented Jan 11, 2017

Issues like this crop up in the code often: should there or should there not be a trailing slash?

The problem with the original code is that it made no assertion either way, which means that cache_fn_url would actually produce a different result whether or not the slash was present.

So I am not necessarily in support of restoring the old behavior. However, if we can establish that the trailing slash was present most of the time, then I would support doing this instead:

url = url.rstrip('/') + '/'
@kalefranz
Member
@ilanschnell
Member

The function (although it was slightly changed) works for me in 4.3.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment