[issue21039] pathlib strips trailing slash
Antoine Pitrou added the comment: Therefore, I'm finally closing this as won't fix :) -- resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
Antoine Pitrou added the comment: I beg to disagree :) Pathlib tries to find a compromise between user-friendliness and power, but it's definitely more on the user-friendliness side than, say, the os module APIs. In other words, I don't think it's a problem if not all details of OS semantics can be encoded in Path objects. In practice, the situations where it's useful to make a difference between a slash-ending path and a non-slash-ending path are few and far between. There are all kinds of small API decisions which have to be revisited if we allow trailing slashes to be significant. For example, what should be the last component of the path? The component just before the ending slash, or the empty string? What if slice off the last part? What is the name, stem, suffix? etc. A path, conceptually, is just that: a sequence of names designating the nodes in the filesystem tree that you walk to get to the terminal node. If you start making trailing slash significants then this simple, intuitive abstraction breaks and things become much more awkward to understand. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
A.M. Kuchling added the comment: The general mood on python-dev seemed to be that the trailing slash shouldn't be normalized. Can this still be fixed, or is it too late since pathlib was shipped in 3.4? The python-dev discussion was at https://mail.python.org/pipermail/python-dev/2014-August/135670.html -- nosy: +akuchling ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
Changes by Ian Cordasco graffatcolmin...@gmail.com: -- nosy: +icordasc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
Antoine Pitrou added the comment: Isaac, thanks for the reference. I'm reopening the issue for discussion (although I'm still not convinced this would be actually a good thing). May I ask you to post on the python-dev mailing-list for further feedback? -- status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +serhiy.storchaka resolution: rejected - type: - behavior versions: +Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
Isaac Schwabacher added the comment: This may be only syntactic sugar, but it is POSIX-specified syntactic sugar: according to http://pubs.opengroup.org/onlinepubs/9699919799/. trailing slashes in pathnames are semantically meaningful in pathname resolution. Tilde escapes are not mentioned. 4.12 Pathname Resolution [...] A pathname that contains at least one non- slash character and that ends with one or more trailing slash characters shall not be resolved successfully unless the last pathname component before the trailing slash characters names an existing directory or a directory entry that is to be created for a directory immediately after the pathname is resolved. Interfaces using pathname resolution may specify additional constraints[1] when a pathname that does not name an existing directory contains at least one non- slash character and contains one or more trailing slash characters. If a symbolic link is encountered during pathname resolution, the behavior shall depend on whether the pathname component is at the end of the pathname and on the function being performed. If all of the following are true, then pathname resolution is complete: 1. This is the last pathname component of the pathname. 2. The pathname has no trailing slash. 3. The function is required to act on the symbolic link itself, or certain arguments direct that the function act on the symbolic link itself. In all other cases, the system shall prefix the remaining pathname, if any, with the contents of the symbolic link. [...] -- nosy: +ischwabacher ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
New submission from Hristo Venev: Some programs' behavior is different depending on whether the path has a trailing slash or not. Examples include ls, cp, mv, ln, rm and rsync. URL paths may also behave differently. For example http://xkcd.com/1 redirects to http://xkcd.com/1/ Boost.Filesystem's path class also supports trailing slashes in paths. C++'s filesystem library proposal is also based on Boost.Filesystem. -- components: Library (Lib) files: pathlib.patch keywords: patch messages: 214581 nosy: h.venev priority: normal severity: normal status: open title: pathlib strips trailing slash versions: Python 3.4 Added file: http://bugs.python.org/file34586/pathlib.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
Antoine Pitrou added the comment: Yes, this is by design. The occasional difference between slash-ended and non-slash-ended paths is unexpected and potentially confusing. Moreover, it's not a property of the OS itself - it's just some syntactic sugar to enable an option such as resolving symlinks. pathlib paths represent filesystem paths, not arbitrary shell arguments. Similarly, pathlib doesn't have special processing for ~someuser parts. (as for URL paths, they are not part of the design space of pathlib) -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
Antoine Pitrou added the comment: Closing as rejected, sorry. -- resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
Hristo Venev added the comment: What about OpenVMS? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
Antoine Pitrou added the comment: Can you elaborate? Python hasn't supported VMS for quite some time... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
Hristo Venev added the comment: AFAIK paths on OpenVMS are represented in a strange way. [dir.subdir]filename is a path for a file and [dir.subdir.anothersubdir] is a path for a directory. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
Antoine Pitrou added the comment: Then I'm afraid the current Path classes won't do a good job of representing them :-) But as I said, Python probably doesn't run on VMS anymore, so this is a rather theoretical problem. Maybe if some day Python supports VMS again, someone can contribute a VMSPath implementation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
Hristo Venev added the comment: Or maybe URLPath? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
Antoine Pitrou added the comment: Or maybe URLPath? I'm skeptical about that. I think someone should first prototype a PureURLPath and maybe publish it on PyPI. (as for the non-pure variant, URLPath, it doesn't seem to make sense) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21039] pathlib strips trailing slash
Mark Lawrence added the comment: PEP11 states that VMS was unsupported in 3.3. Code was removed from 3.4 via #16136. -- nosy: +BreamoreBoy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com