Patchwork [4,of,4,STABLE] check-code: check os.path.join(*, '') not working correctly with Python 2.7.9

login
register
mail settings
Submitter Katsunori FUJIWARA
Date April 22, 2015, 2:43 p.m.
Message ID <9d8c1df552f6c7d97c35.1429713839@juju>
Download mbox | patch
Permalink /patch/8762/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - April 22, 2015, 2:43 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1429713535 -32400
#      Wed Apr 22 23:38:55 2015 +0900
# Branch stable
# Node ID 9d8c1df552f6c7d97c35fdbfae40b8b2c7cf5795
# Parent  f0d4d87183cb8ce88a29863086cc77af52cc81d9
check-code: check os.path.join(*, '') not working correctly with Python 2.7.9

Since Python 2.7.9, "os.path.join(path, '')" doesn't append "os.sep"
for UNC path (see issue4557 for detail).
Matt Mackall - April 22, 2015, 4:01 p.m.
On Wed, 2015-04-22 at 23:43 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1429713535 -32400
> #      Wed Apr 22 23:38:55 2015 +0900
> # Branch stable
> # Node ID 9d8c1df552f6c7d97c35fdbfae40b8b2c7cf5795
> # Parent  f0d4d87183cb8ce88a29863086cc77af52cc81d9
> check-code: check os.path.join(*, '') not working correctly with Python 2.7.9

These are queued for stable, thanks.

Patch

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -301,6 +301,8 @@  pypats = [
      "missing _() in ui message (use () to hide false-positives)"),
     (r'release\(.*wlock, .*lock\)', "wrong lock release order"),
     (r'\b__bool__\b', "__bool__ should be __nonzero__ in Python 2"),
+    (r'os\.path\.join\(.*, *(""|\'\')\)',
+     "use pathutil.normasprefix(path) instead of os.path.join(path, '')"),
   ],
   # warnings
   [