Bug report
>>> os.path.commonprefix(('root/blah', 'rawr/oaeu'))
'r'
>>> os.path.commonprefix(('/root/blah', '/rawr/oaeu'))
'/r'
>>>
This is clearly not a sane result.
To be clear, a sane result would look like
''
for the first example, and
'/'
for the second example.
This would then be consistent with how the module behaves for other examples:
os.path.commonprefix(('/root/blah', '/root/oaeu'))
'/root/'
This is also insane:
os.path.commonprefix(('/root/blah', '/root/baeu'))
'/root/b'
os.path.commonprefix(('/root/blah', '/root/baeu'))
'/root/b'
The returned example is not a "path". It is not a 'path prefix' in any meaningful sense. This is just a string match up to the point the string changes. It has nothing whatsoever to do with the notion of a 'path'.
CPython versions tested on:
3.12
Operating systems tested on:
Linux
Bug report
This is clearly not a sane result.
To be clear, a sane result would look like
''
for the first example, and
'/'
for the second example.
This would then be consistent with how the module behaves for other examples:
This is also insane:
The returned example is not a "path". It is not a 'path prefix' in any meaningful sense. This is just a string match up to the point the string changes. It has nothing whatsoever to do with the notion of a 'path'.
CPython versions tested on:
3.12
Operating systems tested on:
Linux