Issue2292

classification
Title: os.readlink(non_symlink) should raise OSError
Type: Severity: normal
Components: Library Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: Arfrever, stefan.richthofer, zyasoft
Priority: high Keywords:

Created on 2015-03-16.13:47:22 by Arfrever, last changed 2015-03-24.03:44:14 by zyasoft.

Messages
msg9660 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2015-03-16.13:47:21
os.readlink(non_existent_file) should raise OSError instead of returning None.

$ python2.7 -c 'import os; print(os.readlink("/non_existent_file"))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
OSError: [Errno 2] No such file or directory: '/non_existent_file'
$ jython2.7 -c 'import os; print(os.readlink("/non_existent_file"))'
None
msg9663 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2015-03-16.14:18:17
OSError should be raised for any non-symlink (e.g. directory or regular file):

$ python2.7 -c 'import os; print(os.readlink("/"))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
OSError: [Errno 22] Invalid argument: '/'
$ python2.7 -c 'import os; print(os.readlink("/bin"))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
OSError: [Errno 22] Invalid argument: '/bin'
$ python2.7 -c 'import os; print(os.readlink("/bin/ls"))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
OSError: [Errno 22] Invalid argument: '/bin/ls'
$ jython2.7 -c 'import os; print(os.readlink("/"))'
None
$ jython2.7 -c 'import os; print(os.readlink("/bin"))'
None
$ jython2.7 -c 'import os; print(os.readlink("/bin/ls"))'
None
msg9669 (view) Author: Jim Baker (zyasoft) Date: 2015-03-17.20:59:41
Fixed as of https://hg.python.org/jython/rev/dedc704b8678, which mistakenly states that #2288 is fixed
History
Date User Action Args
2015-03-24 03:44:14zyasoftsetstatus: pending -> closed
2015-03-17 20:59:55zyasoftsetstatus: open -> pending
priority: high
resolution: fixed
assignee: zyasoft
2015-03-17 20:59:41zyasoftsetmessages: + msg9669
2015-03-16 14:18:17Arfreversetmessages: + msg9663
title: os.readlink(non_existent_file) should raise OSError -> os.readlink(non_symlink) should raise OSError
2015-03-16 13:47:22Arfrevercreate