[issue19717] resolve() fails when the path doesn't exist

2017-06-06 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2017-06-06 Thread Philip Ridout

Changes by Philip Ridout :


--
nosy: +Philip Ridout

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2017-05-28 Thread Marcel Plch

Changes by Marcel Plch :


--
pull_requests: +1930

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2017-03-31 Thread Donald Stufft

Changes by Donald Stufft :


--
pull_requests: +830

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2016-11-14 Thread Steve Dower

Changes by Steve Dower :


--
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2016-11-14 Thread Steve Dower

Changes by Steve Dower :


--
stage: commit review -> resolved

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2016-11-09 Thread Guido van Rossum

Guido van Rossum added the comment:

Thanks!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2016-11-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 03bbee2b0d28 by Steve Dower in branch '3.6':
Issue #19717: Makes Path.resolve() succeed on paths that do not exist (patch by 
Vajrasky Kok)
https://hg.python.org/cpython/rev/03bbee2b0d28

New changeset 445415e402be by Steve Dower in branch 'default':
Issue #19717: Makes Path.resolve() succeed on paths that do not exist (patch by 
Vajrasky Kok)
https://hg.python.org/cpython/rev/445415e402be

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2016-11-09 Thread Steve Dower

Steve Dower added the comment:

Applied. I changed the default for the parameter and updated the docs, but the 
rest is as in the patch.

--
assignee:  -> steve.dower
resolution:  -> fixed
stage:  -> commit review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2016-11-09 Thread Guido van Rossum

Guido van Rossum added the comment:

I'd be very happy if that landed in 3.6 with the default strict=False.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2016-11-09 Thread Steve Dower

Steve Dower added the comment:

Anyone have any major concerns with add_non_strict_resolve_pathlib_v4.patch?

I'd be quite happy without adding the extra parameter to Path.resolve(), but 
I'm not strongly offended.

>From Guido's email we should default to strict=False (i.e. don't throw if the 
>file doesn't exist) rather than True.

--
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2016-11-08 Thread Guido van Rossum

Guido van Rossum added the comment:

Please make sure this lands in beta 4!

--Guido (mobile)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2016-11-08 Thread Martin Wagner

Martin Wagner added the comment:

i have a use-case that requires a behavior that is referenced above as 
--canonicalize-missing. essentially i need to get rid of relative parts in a 
path representation regardless the actual filesystem.

my conclusion was that PurePath could provide that with a 'normpath' method, 
reflecting os.path.normpath's functionality.

(that's from a user perspective, i haven't looked at any implementation details 
of the pathlib module.)

--
nosy: +mwagner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2016-09-08 Thread Steve Dower

Changes by Steve Dower :


--
nosy: +steve.dower

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2016-09-08 Thread Brett Cannon

Changes by Brett Cannon :


--
priority: normal -> deferred blocker

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2016-09-08 Thread Brett Cannon

Brett Cannon added the comment:

Guido has kept his opinion that it should resolve until the path no longer 
exists and then just stop: 
https://mail.python.org/pipermail/python-ideas/2016-September/042203.html

--
nosy: +brett.cannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2016-05-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I have written a patch that implements all three mode for posixpath.realpath() 
(issue27002). Having the implementation we can test and research it. After 
discussion this solution can be adopted for Path.resolve().

--
versions: +Python 3.6 -Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2016-05-08 Thread Davide Rizzo

Changes by Davide Rizzo :


--
nosy: +davide.rizzo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2014-09-25 Thread July Tikhonov

Changes by July Tikhonov july.t...@gmail.com:


--
nosy: +july

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Well, given the diversity of possible behaviours, it starts to seem like it 
should maybe be discussed on python-dev.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-17 Thread Vajrasky Kok

Vajrasky Kok added the comment:

I based my implementation on this statement:

Guido pointed out that it may more useful to resolve the path components until 
one doesn't exist

until one doesn't exist in this case means P(BASE, 'foo', 'in', 'spam') 
resolves until BASE / 'foo'.

If different spec is better, I'll change the implementation.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I believe Guido meant one of standard strategies. Current posixpath.realpath() 
implementation conforms --canonicalize-missing.
It is not clear which two strategies (from three) should be used in 
Path.resolve().

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-16 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Updated patch to tip. Later, I refactor Windows code to make sure it does not 
loop forever.

--
Added file: 
http://bugs.python.org/file33171/add_non_strict_resolve_pathlib_v4.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Vajrasky's patch implements fourth strategy, which is not conform neither 
--canonicalize nor --canonicalize-missing. Path(BASE, 'foo', 'in', 'spam') is 
resolved to Path(BASE, 'foo'). I doubt that this is most expected behavior.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-11 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Here is the patch with Windows support. I notice there is difference regarding 
resolving symbolic link with parent dir (linkA/..) between Posix and Windows.

On Windows, if linkY points to dirB, 'dirA\linkY\..' resolves to 'dirA' without 
resolving linkY first. It means, Windows resolves parent dir first before 
symbolic link.

C:\Users\vajrasky\Code\playplay\pycodemkdir dirA

C:\Users\vajrasky\Code\playplay\pycodemkdir dirB

C:\Users\vajrasky\Code\playplay\pycodecd dirA

C:\Users\vajrasky\Code\playplay\pycode\dirAmklink /D linkC ..\dirB
symbolic link created for linkC === ..\dirB

C:\Users\vajrasky\Code\playplay\pycode\dirAcd ..\

C:\Users\vajrasky\Code\playplay\pycodecd dirA\linkC\..

C:\Users\vajrasky\Code\playplay\pycode\dirA

But on Posix, if linkY points to dirB, 'dirA\linkY\..' resolves to 'dirB\..' 
then to the parent dir of dirB. It means, Posix resolves symbolic link first 
before parent dir.

$ mkdir dirA
$ mkdir dirB
$ cd dirA
$ ln -s ../dirB linkC
$ cd ..
$ ls dirA/linkC/..
dirAdirB

--
Added file: 
http://bugs.python.org/file33089/add_non_strict_resolve_pathlib_v3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-11 Thread Vajrasky Kok

Changes by Vajrasky Kok sky@speaklikeaking.com:


Removed file: 
http://bugs.python.org/file33089/add_non_strict_resolve_pathlib_v3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-11 Thread Vajrasky Kok

Changes by Vajrasky Kok sky@speaklikeaking.com:


Added file: 
http://bugs.python.org/file33090/add_non_strict_resolve_pathlib_v3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think a patch in issue19887 first should be committed. It totally rewrites 
resolve().

--
dependencies: +Path.resolve() fails on complex symlinks

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-10 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Thanks for the review, Antoine! Here is the updated patch. I haven't tested it 
on Windows yet because I want to clarify one thing.

Let's say we have this valid directory:

/tmp/@test123 = directory

And this directory only has one valid file:

/tmp/@test123/cutecat = file

We agree that pathlib.Path('/tmp/@test123/foo').resolve(False) = 
'/tmp/@test123/foo'.

But what about this case: 
pathlib.Path('/tmp/@test123/cutecat/foo').resolve(False)?

It should be /tmp/@test123/cutecat or /tmp/@test123/cutecat/foo?

--
Added file: 
http://bugs.python.org/file33075/add_non_strict_resolve_pathlib_v2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The readlink utility has different modes for canonization:

   -f, --canonicalize
  canonicalize by following every symlink in every component of the 
given name recursively; all but the last component must exist

   -e, --canonicalize-existing
  canonicalize by following every symlink in every component of the 
given name recursively, all components must exist

   -m, --canonicalize-missing
  canonicalize by following every symlink in every component of the 
given name recursively, without requirements on components existence

I think every mode has use cases.

--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I think every mode has use cases.

Probably, but which ones are the most likely? A ternary flag leads to a
clumsier API than a simple binary flag.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

(note that POSIX realpath() fails with ENOENT if the file doesn't exist: 
http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html )

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-02 Thread Guido van Rossum

Guido van Rossum added the comment:

Hm, so we can choose to be more like POSIX realpath() or more like 
os.path.realpath().  I guess your original intuition was right.  Close with no 
action is fine.  If I need a partial real path I can always crawl up parents() 
until I find a path that does exist.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I think there's value in allowing the less strict behaviour with an optional 
arg, though. i.e.:

 Path('toto').resolve()
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/antoine/cpython/default/Lib/pathlib.py, line 1024, in resolve
s = self._flavour.resolve(self)
  File /home/antoine/cpython/default/Lib/pathlib.py, line 282, in resolve
target = accessor.readlink(cur)
  File /home/antoine/cpython/default/Lib/pathlib.py, line 372, in readlink
return os.readlink(path)
FileNotFoundError: [Errno 2] No such file or directory: 
'/home/antoine/cpython/default/toto'
 Path('toto').resolve(strict=False)
PosixPath('/home/antoine/cpython/default/toto')

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-02 Thread Guido van Rossum

Guido van Rossum added the comment:

Sure.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-12-02 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Here is the preliminary patch. Only tested on Linux. Later I'll test it on 
Windows.

--
keywords: +patch
nosy: +vajrasky
Added file: 
http://bugs.python.org/file32947/add_non_strict_resolve_pathlib.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19717] resolve() fails when the path doesn't exist

2013-11-22 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Currently Path.resolve() raises FileNotFoundError when the path does not exist. 
Guido pointed out that it may more useful to resolve the path components until 
one doesn't exist, and then return the rest unchanged.

e.g. if /home/ points to /var/home/, Path(/home/antoine/toto) should resolve 
to Path(/var/home/antoine/toto) even if toto doesn't actually exist.

However, this makes the function less safe. Perhaps with a strict flag?

--
components: Library (Lib)
messages: 203819
nosy: gvanrossum, neologix, pitrou
priority: normal
severity: normal
status: open
title: resolve() fails when the path doesn't exist
type: enhancement
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19717
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com