[Python-Dev] os.path.commonprefix breakage (original) (raw)

Tim Peters tim_one@email.msn.com
Thu, 17 Aug 2000 00:05:12 -0400


I agree this is Bad Damage, and should be fixed before 2.0b1 goes out. Can you enter a bug report?

-----Original Message----- From: python-dev-admin@python.org [mailto:python-dev-admin@python.org]On Behalf Of Mark Hammond Sent: Wednesday, August 16, 2000 11:32 PM To: python-dev@python.org Subject: [Python-Dev] os.path.commonprefix breakage

Hi, I believe that Skip recently made a patch to os.path.commonprefix to only return the portion of the common prefix that corresponds to a directory. I have just dicovered some code breakage from this change. On 1.5.2, the behaviour was: >>> os.path.commonprefix(["../foo/bar", "../foo/spam"]) '../foo/' While since the change we have: '../foo' Note that the trailing slash has been dropped. The code this broke did similar to: prefix = os.path.commonprefix(files) for file in files: tailportion = file[len(prefix):] In 1.6, the "tailportion" result looks like an absolute path "/bar" and "/spam", respectively. The intent was obviously to get absolute path names back ("bar" and "spam") The code that broke is not mine, so you can safely be horrified at how broken it is :-) The point, however, is that code like this does exist out there. I'm obviously going to change the code that broke, and don't have time to look into the posixpath.py code - but is this level of possible breakage acceptable? Thanks, Mark.