Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urllib2.urlopen().read().splitlines() opening a directory in a FTP server randomly returns incorrect result #66570

Closed
alanoe mannequin opened this issue Sep 9, 2014 · 4 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@alanoe
Copy link
Mannequin

alanoe mannequin commented Sep 9, 2014

BPO 22376
Nosy @terryjreedy, @iritkatriel

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2020-12-01.10:41:25.849>
created_at = <Date 2014-09-09.21:53:40.093>
labels = ['type-bug', 'library']
title = 'urllib2.urlopen().read().splitlines() opening a directory in a FTP server randomly returns incorrect result'
updated_at = <Date 2020-12-01.10:41:25.849>
user = 'https://bugs.python.org/alanoe'

bugs.python.org fields:

activity = <Date 2020-12-01.10:41:25.849>
actor = 'iritkatriel'
assignee = 'none'
closed = True
closed_date = <Date 2020-12-01.10:41:25.849>
closer = 'iritkatriel'
components = ['Library (Lib)']
creation = <Date 2014-09-09.21:53:40.093>
creator = 'alanoe'
dependencies = []
files = []
hgrepos = []
issue_num = 22376
keywords = []
message_count = 4.0
messages = ['226664', '226689', '226848', '382230']
nosy_count = 3.0
nosy_names = ['terry.reedy', 'alanoe', 'iritkatriel']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue22376'
versions = ['Python 2.7']

@alanoe
Copy link
Mannequin Author

alanoe mannequin commented Sep 9, 2014

Examples in Python command line:

Try 1
-----

>>> import urllib2
urllib2.urlopen('ftp://<user>:<password>@<server>/packages/repodata').read().splitlines()

Output:
<list of files>

Try 2
-----

>>> import urllib2
urllib2.urlopen('ftp://<user>:<password>@<server>/packages/repodata').read().splitlines()

Output:
[]

If I split urllib2.urlopen().read().splitlines() statement in 2 statements (urllib2.urlopen() and read().splitlines()), I always get correct results.

import urllib2
a = urllib2.urlopen('ftp://<user>:<password>@<server>/packages/repodata')
>>> a.read().splitlines()

Output:
<file_list>

Verified in Python 2.6.6 in RHEL 6.4, Python 2.7.x in RHEL 7 and Python 2.7.3 in Ubuntu 14.04

@alanoe alanoe mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Sep 9, 2014
@alanoe
Copy link
Mannequin Author

alanoe mannequin commented Sep 10, 2014

duplicate of bpo-22375. I closed that one because I wanted to edit the original bug description and I could not, preferred to create a new bug.

R. David Murray's comment in bpo-22375: "I think this was already fixed in bpo-15002"

@terryjreedy
Copy link
Member

You should have just added a new message to bpo-22375 with the revision.

bpo-15002 ends with "This is fixed in 3.4 and 3.5. I will backport to 2.7 ( I think, it is worth it)." Please check whether the backport has been done or whether current you still have a problem with the latest 2.7.8. If so, did the 3.4 patch, included in 3.4.1, fix the issue (ie, install 3.4.1 and test). If you code works on 3.4.1 and not on 2.7.8, you could add a request for a backport to bpo-15002.

@iritkatriel
Copy link
Member

2.7 backport is no longer possible.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants