diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-05-21 19:05:08 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-21 19:05:08 (GMT) |
commit | aea49b18752880e5d0260f16ca7ff2c6dce78515 (patch) | |
tree | 9567dc9c0bc6ea7bcf05dd23837e0dadcb1320f4 /Lib/test/test_pathlib.py | |
parent | 390d88e49c55c15fac7cdf60b649a4b9b15d189b (diff) | |
download | cpython-aea49b18752880e5d0260f16ca7ff2c6dce78515.zip cpython-aea49b18752880e5d0260f16ca7ff2c6dce78515.tar.gz cpython-aea49b18752880e5d0260f16ca7ff2c6dce78515.tar.bz2 |
[3.7] bpo-36035: fix Path.rglob for broken links (GH-11988) (GH-13469)
Links creating an infinite symlink loop would raise an exception.
(cherry picked from commit d5c120f7eb6f2a9cdab282a5d588afed307a23df)
Co-authored-by: Jörg Stucke <joerg.stucke@fkie.fraunhofer.de>
https://bugs.python.org/issue36035
Diffstat (limited to 'Lib/test/test_pathlib.py')
-rw-r--r-- | Lib/test/test_pathlib.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 056507e..f7ed1d1 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -1218,7 +1218,8 @@ class _BasePathTest(object): # |-- dirE # No permissions # |-- fileA # |-- linkA -> fileA - # `-- linkB -> dirB + # |-- linkB -> dirB + # `-- brokenLinkLoop -> brokenLinkLoop # def setUp(self): @@ -1249,6 +1250,8 @@ class _BasePathTest(object): self.dirlink(os.path.join('..', 'dirB'), join('dirA', 'linkC')) # This one goes upwards, creating a loop self.dirlink(os.path.join('..', 'dirB'), join('dirB', 'linkD')) + # Broken symlink (pointing to itself). + os.symlink('brokenLinkLoop', join('brokenLinkLoop')) if os.name == 'nt': # Workaround for http://bugs.python.org/issue13772 @@ -1379,7 +1382,7 @@ class _BasePathTest(object): paths = set(it) expected = ['dirA', 'dirB', 'dirC', 'dirE', 'fileA'] if support.can_symlink(): - expected += ['linkA', 'linkB', 'brokenLink'] + expected += ['linkA', 'linkB', 'brokenLink', 'brokenLinkLoop'] self.assertEqual(paths, { P(BASE, q) for q in expected }) @support.skip_unless_symlink @@ -1460,6 +1463,7 @@ class _BasePathTest(object): 'fileA', 'linkA', 'linkB', + 'brokenLinkLoop', } self.assertEqual(given, {p / x for x in expect}) |