[Patches] [ python-Patches-658599 ] Fix for bug 494589

SourceForge.net noreply@sourceforge.net
Thu, 30 Jan 2003 03:30:32 -0800


Patches item #658599, was opened at 2002-12-26 09:49
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=658599&group_id=5470

Category: Library (Lib)
Group: Python 2.2.x
Status: Open
Resolution: None
Priority: 5
Submitted By: Miki Tebeka (tebeka)
Assigned to: Mark Hammond (mhammond)
Summary: Fix for bug 494589

Initial Comment:
This is a fix for bug 494589 (os.path.expandvars)
I suggest using the same code in ntpath and posixpath.
(Maybe have a commonpath.py and let both import it?)

Python version 2.2.2
OS: NT4 SP6 (checked on NT and cygwin)

Miki

----------------------------------------------------------------------

>Comment By: Miki Tebeka (tebeka)
Date: 2003-01-30 13:30

Message:
Logged In: YES 
user_id=358087

Hopefully this should do the trick (if I'll remember to
attache the file :-)
All I did was to allow a $ only right after the first one.

Miki

----------------------------------------------------------------------

Comment By: Mark Hammond (mhammond)
Date: 2003-01-30 01:11

Message:
Logged In: YES 
user_id=14198

Yes, I was too eager there.

So back to the original patch - it looks good, except it
seems to fail in one case I can see:
$FOO$FOO

is not correctly expanded.  Put a space between the vars, or
enclose them in braces, and it works correctly.

This isn't really a regression though - the old code doesn't
handle that case correctly either.  posixpath does.

See the new patch I uploaded - it contains the original
code, plus a patch to test_ntpath.py to test the semantics.
 Is it possible to fix the patch to handle this case?  I
haven't time to dig out my regex book <wink>

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2003-01-17 03:24

Message:
Logged In: YES 
user_id=31435

Did you look at bug 494589?  As I noted there, there are 
semantic diffferences between the ntpath and posixpath 
versions of .expandvars() (like ntpath mapping $$ to $, 
and not expanding within single quotes).

I personally have no use for the differences, but can't say 
whether anyone else does.  The author of the ntpath version 
took time to write comments about its pecularities, so they 
weren't accidents at the time.  Incompatible changes are 
usually PEP material.

----------------------------------------------------------------------

Comment By: Mark Hammond (mhammond)
Date: 2003-01-16 07:24

Message:
Logged In: YES 
user_id=14198

It was late last night - the idea of ripping out all
duplicated code wont work.  A consolidation may be possible,
but I haven't time.  I'm deleting that patch, but still
believe that

from posixpath import expandvars

is reasonable.  Comments?

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2003-01-15 21:14

Message:
Logged In: YES 
user_id=31435

Sounds like an excellent idea to me, Mark!  The glory is all 
yours, if you're man enough to accept it <wink>.

----------------------------------------------------------------------

Comment By: Mark Hammond (mhammond)
Date: 2003-01-15 14:38

Message:
Logged In: YES 
user_id=14198

In fact, why not go the whole-hog, and remove all code in
ntpath.py that is identical to posixpath.py

Example patch attached <wink>

----------------------------------------------------------------------

Comment By: Mark Hammond (mhammond)
Date: 2003-01-15 05:44

Message:
Logged In: YES 
user_id=14198

Is there any reason why:

from posixpath import expandvars

is not a better patch?  From what I can see, posixpath's
version works fine for Windows (windows os.environ is case
insensitive)

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2003-01-13 19:59

Message:
Logged In: YES 
user_id=31435

Mark, can you make time to look at this?  I can't.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-01-04 05:31

Message:
Logged In: YES 
user_id=33168

The patch didn't apply for me, so I created a new one and
attached it.  I can't test this.  Maybe Tim is interested.

----------------------------------------------------------------------

Comment By: Miki Tebeka (tebeka)
Date: 2002-12-29 09:28

Message:
Logged In: YES 
user_id=358087

This time the checkbox is checked. :-)

Miki

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-12-26 20:07

Message:
Logged In: YES 
user_id=33168

There's no uploaded file!  You have to check the
checkbox labeled "Check to Upload & Attach File"
when you upload a file.

Please try again.

(This is a SourceForge annoyance that we can do
nothing about. :-( )

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=658599&group_id=5470