This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author benrg
Recipients benrg, paul.moore, steve.dower, tim.golden, zach.ware
Date 2022-02-24.03:41:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645674104.76.0.96131746117.issue46842@roundup.psfhosted.org>
In-reply-to
Content
`importlib._bootstrap_external` contains this comment:

    # We need an absolute path to the py file to avoid the possibility of
    # collisions within sys.pycache_prefix [...]
    # [...] the idea here is that if we get `Foo\Bar`, we first
    # make it absolute (`C:\Somewhere\Foo\Bar`), then make it root-relative
    # (`Somewhere\Foo\Bar`), so we end up placing the bytecode file in an
    # unambiguous `C:\Bytecode\Somewhere\Foo\Bar\`.

The code follows the comment, but doesn't achieve the goal: `C:\Somewhere\Foo\Bar` and `D:\Somewhere\Foo\Bar` collide. There is also no explicit handling of UNC paths, with the result that `\\Somewhere\Foo\Bar` maps to the same location.

I think that on Windows the code should use a mapping like

    C:\Somewhere\Foo\Bar  ==>  C:\Bytecode\C\Somewhere\Foo\Bar
    D:\Somewhere\Foo\Bar  ==>  C:\Bytecode\D\Somewhere\Foo\Bar
    \\Somewhere\Foo\Bar   ==>  C:\Bytecode\UNC\Somewhere\Foo\Bar

The lack of double-slash prefix handling also matters on Unixy platforms that give it a special meaning. Cygwin is probably affected by this. I don't know whether there are any others.
History
Date User Action Args
2022-02-24 03:41:44benrgsetrecipients: + benrg, paul.moore, tim.golden, zach.ware, steve.dower
2022-02-24 03:41:44benrgsetmessageid: <1645674104.76.0.96131746117.issue46842@roundup.psfhosted.org>
2022-02-24 03:41:44benrglinkissue46842 messages
2022-02-24 03:41:44benrgcreate