msg260016 - (view) |
Author: Fred Rolland (Fred Rolland) |
Date: 2016-02-10 14:58 |
Hi, os.path.normpath("//") returns '//' I would expect to be '/' >>> os.path.normpath("//") '//' >>> os.path.normpath("///") '/' >>> os.path.normpath("////") '/' |
|
|
msg260024 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-02-10 16:01 |
This is a duplicate of . This is intended behavior. It was introduced in changeset 01d5b80a3c03. From the POSIX Specification [1]: """ A pathname consisting of a single shall resolve to the root directory of the process. A null pathname shall not be successfully resolved. If a pathname begins with two successive characters, the first component following the leading characters may be interpreted in an implementation-defined manner, although more than two leading characters shall be treated as a single character. """ See also Stack Overflow and Stack Exchange questions: [2], [3], [4]. May be we should add an explanation and a link to the specification in the documentation and comments. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_12 [2] http://stackoverflow.com/questions/7816818/why-doesnt-os-normapath-collapse-a-leading-double-slash [3] http://unix.stackexchange.com/questions/12283/unix-difference-between-path-starting-with-and [4] http://unix.stackexchange.com/questions/1910/how-does-linux-handle-multiple-consecutive-path-separators-home-username |
|
|
msg265837 - (view) |
Author: Camilla Montonen (Winterflower) |
Date: 2016-05-18 20:41 |
Should the comment with the link to specification be added to Lib/posixpath.py? or Lib/os.py? |
|
|
msg267400 - (view) |
Author: Arno-Can Uestuensoez (acue) |
Date: 2016-06-05 07:59 |
I propose to add at least a statement like e.g. "In conformance to IEEE Std 1003.1™, 2013 Edition; 4.12 Pathname Resolution". Because I had the same thought of a bug at first view, this because I did not find any hint in e.g. docs for 2.7.11. The reason to handle this thoroughly in my projects is the application of a path-matching library for generic unit tests, e.g. for bash scripts which require intensive PATH resolution. This has to be applied by the users of the library. See "https://pypi.python.org/pypi/pyfilesysobjects", and "https://pypi.python.org/pypi/epyunit" which requires intensive pattern matching of application provided pathnames, e.g. when it comes to automatic split of actual used PYTHONPATH items for a specific function/method, module, or package. E.g. the user provides an 'intentional casual' pathname for drop-in unit tests(see epyunit), "os.sep + context.sys.path[x] + os.sep + 'rel-module-path'", due to mixed relative and absolute paths resulting in leading "os.sep + os.sep". The pattern match than fails, but it is not immediately clear for which reason. |
|
|
msg267411 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-06-05 12:09 |
Could you provide a patch Arno-Can? According to the comment in the configure script of GNU coreutils, the only POSIX platforms known for coreutils developers that have two distinct roots / and // are Cygwin, z/OS and dead Apollo DomainOS. Yet few exotic platforms are mentioned in the topic at http://comments.gmane.org/gmane.comp.standards.posix.austin.general/11947 . |
|
|
msg267471 - (view) |
Author: Arno-Can Uestuensoez (acue) |
Date: 2016-06-05 20:25 |
Hi Serhiy, I am currently still investigating it for my own project. https://stackoverflow.com/questions/37646103/posix-path-1003-1-examples-and-behaviour-for-foo-bar Currently I do not have the build environment, so I can provide the text, but because I am a bit under pressure with finishing a larger pack of OpenSource projects currently I cannot manage to setup the environment. So can do this eventually in 2-3Weeks. |
|
|
msg267478 - (view) |
Author: Jack McCracken (Jack.McCracken) * |
Date: 2016-06-05 21:44 |
Hey all - I would love to write a patch :) Working on it! |
|
|
msg267481 - (view) |
Author: Jack McCracken (Jack.McCracken) * |
Date: 2016-06-05 22:23 |
Here's the patch I made. |
|
|
msg343661 - (view) |
Author: Joannah Nanjekye (nanjekyejoannah) *  |
Date: 2019-05-27 17:01 |
@ Jack McCracken do you want to open a pull request for this? |
|
|
msg369084 - (view) |
Author: Furkan Onder (furkanonder) * |
Date: 2020-05-16 23:33 |
PR has been sent! |
|
|
msg397304 - (view) |
Author: Joannah Nanjekye (nanjekyejoannah) *  |
Date: 2021-07-12 12:48 |
New changeset 66c5853406bbcccecf35372795078c0641a5f385 by Furkan Onder in branch 'main': bpo-26329: update os.path.normpath documentation (GH-20138) https://github.com/python/cpython/commit/66c5853406bbcccecf35372795078c0641a5f385 |
|
|
msg397321 - (view) |
Author: Łukasz Langa (lukasz.langa) *  |
Date: 2021-07-12 15:08 |
New changeset 443db64f496d3988d20cfda2c3c2ceb6702df36f by Miss Islington (bot) in branch '3.10': bpo-26329: update os.path.normpath documentation (GH-20138) (GH-27094) https://github.com/python/cpython/commit/443db64f496d3988d20cfda2c3c2ceb6702df36f |
|
|
msg397328 - (view) |
Author: Łukasz Langa (lukasz.langa) *  |
Date: 2021-07-12 15:22 |
New changeset 47abf240365ddd54a91c6ac167900d4bf6806c4f by Miss Islington (bot) in branch '3.9': bpo-26329: update os.path.normpath documentation (GH-20138) (#27095) https://github.com/python/cpython/commit/47abf240365ddd54a91c6ac167900d4bf6806c4f |
|
|