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

os.stat fails on mapped network drive #54388

Closed
pitrou opened this issue Oct 23, 2010 · 11 comments
Closed

os.stat fails on mapped network drive #54388

pitrou opened this issue Oct 23, 2010 · 11 comments
Labels
extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@pitrou
Copy link
Member

pitrou commented Oct 23, 2010

BPO 10179
Nosy @loewis, @pitrou, @tjguk, @briancurtin
Files
  • osstat.patch
  • 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 2013-10-24.10:24:37.928>
    created_at = <Date 2010-10-23.14:52:03.166>
    labels = ['extension-modules', 'type-bug']
    title = 'os.stat fails on mapped network drive'
    updated_at = <Date 2013-10-24.10:24:37.927>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2013-10-24.10:24:37.927>
    actor = 'tim.golden'
    assignee = 'none'
    closed = True
    closed_date = <Date 2013-10-24.10:24:37.928>
    closer = 'tim.golden'
    components = ['Extension Modules']
    creation = <Date 2010-10-23.14:52:03.166>
    creator = 'pitrou'
    dependencies = []
    files = ['19342']
    hgrepos = []
    issue_num = 10179
    keywords = ['patch']
    message_count = 11.0
    messages = ['119430', '119431', '119432', '119437', '119438', '119439', '119455', '119458', '119461', '201109', '201110']
    nosy_count = 5.0
    nosy_names = ['loewis', 'pitrou', 'ocean-city', 'tim.golden', 'brian.curtin']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue10179'
    versions = ['Python 3.2', 'Python 3.3', 'Python 3.4']

    @pitrou
    Copy link
    Member Author

    pitrou commented Oct 23, 2010

    This network drive is actually mapped through the VirtualBox guest additions. Under Python 2.7 (official 64-bit MSI installer), this works fine:

    >>> s = 'Z:\\__svn__\\Lib\\test\\keycert.pem'
    >>> os.stat(s)
    nt.stat_result(st_mode=33206, st_ino=0L, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=1783L, st_atime=1287771307L, st_mtime=1286578916L, st_ctime=1286578916L)

    Under a freshly compiled 32-bit py3k, though, it fails with a rather strange error message:

    >>> s = 'Z:\\__svn__\\Lib\\test\\keycert.pem'
    >>> os.stat(s)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    WindowsError: [Error 1] Incorrect function: 'Z:\\__svn__\\Lib\\test\\keycert.pem'
    >>> errno.errorcode[1]
    'EPERM'

    While a local directory works fine:

    >>> os.stat('c:\\Windows')
    nt.stat_result(st_mode=16895, st_ino=0, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=16384, st_atime=1287843075, st_mtime=1287843075, st_ctime=1247541608)

    @pitrou pitrou added extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Oct 23, 2010
    @pitrou
    Copy link
    Member Author

    pitrou commented Oct 23, 2010

    And 3.1 works fine.

    @pitrou
    Copy link
    Member Author

    pitrou commented Oct 23, 2010

    Hmm, it looks like this is actually VirtualBox-specific.
    It works with another network drive mapped on Y:

    >>> os.stat(r"y:")
    nt.stat_result(st_mode=16895, st_ino=0, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=0, st_atime=1287784175, st_mtime=1281439296, st_ctime=1281439296)
    >>> os.stat(r"z:")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    WindowsError: [Error 1] Incorrect function: 'z:'

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Oct 23, 2010

    Let me guess: It's GetFinalPathNameByHandle that is failing. Put some debug output right after the call to verify.

    Why is this critical? Not being able to stat VirtualBox folders doesn't sound that critical to me.

    @pitrou
    Copy link
    Member Author

    pitrou commented Oct 23, 2010

    Yes, indeed. It was critical before I found out that it's VirtualBox-specific.

    @pitrou
    Copy link
    Member Author

    pitrou commented Oct 23, 2010

    This patch seems to do the trick, although I'm not sure it warrants including in Python.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Oct 23, 2010

    I think something like this is worth adding. I'd like to see two changes implemented:

    • GetLastError should be checked for the "not implemented or some such" error that you got, and the fallback only performed if its this error
    • a comment explaining the motivation for this fallback should be added.

    @ocean-city
    Copy link
    Mannequin

    ocean-city mannequin commented Oct 23, 2010

    Can you try my patch in bpo-10027? Does this also fail?

    @pitrou
    Copy link
    Member Author

    pitrou commented Oct 23, 2010

    Can you try my patch in bpo-10027? Does this also fail?

    No, your patch seems to fix the issue.

    @tjguk
    Copy link
    Member

    tjguk commented Oct 24, 2013

    Just housekeeping some Windows calls: Antoine, your last comment suggests that this is no longer an issue. I don't have a VirtualBox install to test, so can you confirm whether this can be closed?

    @pitrou
    Copy link
    Member Author

    pitrou commented Oct 24, 2013

    I don't know, I have stopped using VirtualBox here. Suggest closing.

    @tjguk tjguk closed this as completed Oct 24, 2013
    @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
    extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants