osutils.splitpath lose info about root directory

Bug #164814 reported by Alexander Belchenko
2
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Wishlist
Unassigned

Bug Description

osutils.splitpath has serious defect: it throw away information about root directory. So consequent joinpath operation will produce is not exactly the same path as was passed to splitpath.

Examples:

In [15]: osutils.splitpath('/root/path')
Out[15]: ['root', 'path']

In [16]: osutils.joinpath(_15)
Out[16]: 'root/path'

In [17]: osutils.splitpath('C:/root/path')
Out[17]: ['C:', 'root', 'path']

In [18]: osutils.joinpath(_17)
Out[18]: 'C:root/path'

Standard os.path.split does the job right:

In [19]: os.path.split('/root')
Out[19]: ('/', 'root')

In [20]: os.path.split('C:/root')
Out[20]: ('C:/', 'root')

Revision history for this message
John A Meinel (jameinel) wrote :

I'm not sure what the specific uses for splitpath are, as I've always used osutils.pathsplit().

However, I think they are all meant to be used only on relative paths, which should therefore not *have* a root.

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 164814] Re: osutils.splitpath lose info about root directory

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John A Meinel пишет:
> I'm not sure what the specific uses for splitpath are, as I've always
> used osutils.pathsplit().
>
> However, I think they are all meant to be used only on relative paths,
> which should therefore not *have* a root.

So we have real zoo in osutils:

splitpath and pathsplit
joinpath and pathjoin

Can we eliminate this mirror twisted pairs?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHTIQXzYr338mxwCURAhUAAKCSAqmu3Gr8ummmG0VThUJcn1lhJACfXVkJ
Q20jkDsHkgmwSmha1X8szZY=
=LXtY
-----END PGP SIGNATURE-----

Revision history for this message
Vincent Ladeuil (vila) wrote :

As of today, we don't have an osutils.pathsplit anymore, even if we still use pathjoin :-/

cleanup needed.

Changed in bzr:
importance: Undecided → Wishlist
status: New → Triaged
Martin Pool (mbp)
Changed in bzr:
status: Triaged → Confirmed
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.