Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Signature comparison broken when PYTHONHASHSEED=random #392

@jamadden

Description

@jamadden

I discovered this when trying to port zc.recipe.cmmi to Python 3. I have the environmnet variable PYTHONHASHSEED=random set for the sake of Python 2 (because on Python 3, hash randomization is on by default) and was getting a test failure when the tests wanted to verify that re-installing an installed part did nothing:

Failed example:
    print(system('bin/buildout').strip())
Expected:
    Updating foo.
Got
    Uninstalling foo.
    Installing foo.
    foo: Downloading http://localhost/foo.tgz
    foo: Unpacking and configuring
    configuring foo --prefix=/sample_buildout/parts/foo -a -b c
    echo building foo
    building foo
    echo installing foo
    installing foo

Cranking up the verbosity of that command revealed this output:

Part foo, option __buildout_signature__ changed:
'zc.recipe.cmmi-c239cab0189d8edcfbbb196af19c987c setuptools-1b99ced40b029a77bcf7fde7d625fbd5 zc.buildout-1b99ced40b029a77bcf7fde7d625fbd5 packaging-1b99ced40b029a77bcf7fde7d625fbd5 appdirs-1b99ced40b029a77bcf7fde7d625fbd5 six-1b99ced40b029a77bcf7fde7d625fbd5 pyparsing-1b99ced40b029a77bcf7fde7d625fbd5' != 'zc.recipe.cmmi-1ae0794e23637cc24ee1587b1d972e9e setuptools-1b99ced40b029a77bcf7fde7d625fbd5 zc.buildout-1b99ced40b029a77bcf7fde7d625fbd5 appdirs-1b99ced40b029a77bcf7fde7d625fbd5 packaging-1b99ced40b029a77bcf7fde7d625fbd5 six-1b99ced40b029a77bcf7fde7d625fbd5 pyparsing-1b99ced40b029a77bcf7fde7d625fbd5'

Unsetting PYTHONHASHSEED solved the problem. Obviously the ordering is slightly different, but some of the hashes are different too.

I don't yet know if I'll run into the same problem on Python 3 or if something else changed that resolves it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions