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

cache.py not windows friendly #5

Open
accident12123 opened this issue Mar 28, 2012 · 8 comments
Open

cache.py not windows friendly #5

accident12123 opened this issue Mar 28, 2012 · 8 comments
Assignees

Comments

@accident12123
Copy link

we won't get into why I found this but fcntl is not available on windows so the import fcntl errors out.

@ghost ghost assigned wagnerrp Mar 29, 2012
@wagnerrp
Copy link
Owner

This might be fixed by 4663490, but the msvcrt locking mechanism is completely untested.

@accident12123
Copy link
Author

some problems...

the code should have been:

    LOCK_EX = msvcrt.LK_NBLCK
    LOCK_SH = msvcrt.LK_NBLCK

@accident12123
Copy link
Author

prepending /tmp/ to the start of a path isn't windows \tmp\ path friendly.. os.path.join should fix that up quick.

also there might be driveletter: or unc \ formatting for an absolute path

@accident12123
Copy link
Author

Now that I have it running, I'm getting permission errors:

\cache_file.py", line 60, in enter
msvcrt.locking(self.fileobj.fileno(), self.operation, self.size)
IOError: [Errno 13] Permission denied

@wagnerrp wagnerrp reopened this Mar 29, 2012
@wagnerrp
Copy link
Owner

Now that I'm thinking about it, those locks should probably be LK_LOCK, so it waits for dedicated access rather than outright fails.

The filename handling does need to be improved, as at current, only caches located in a user's home directory with a '~' would pass the logic. I assume Windows absolute paths would either start with ":" or "\server"?

@accident12123
Copy link
Author

I would think c:, \server and \path would all be valid.. but it's going to need a default also I think /tmp/ wouldn't work.

@wagnerrp
Copy link
Owner

263d868 adds an independent chunk of logic for Windows systems, based off the module import test. Variables are replaced into the path, and anything starting with lettered drives and ':', or a UNC server are passed through. Everything else gets the %TEMP% directory prepended. That still leaves the issue as to why locking itself is not working.

@accident12123
Copy link
Author

I'm still getting a bunch of permissions denied on the windows side.... didn't really have the time to look closer at it.

OverlordQ referenced this issue in CouchPotato/CouchPotatoServer Sep 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants