-
Notifications
You must be signed in to change notification settings - Fork 95
Fix I/O error when creating empty file #157
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
Conversation
We can't merge this until we figure out why you're the only one experiencing this problem. Yes, it's possible to create an empty file. Any filesystem would have to support this. The only alternative is forcing you to pass data. |
I sort of assumed that. I'm no expert, so thanks for clearing this up.
No idea why. The only thing that's abnormal for me is that I'm running this on ARM. Everything else is stock Arch Linux. Is there any specific information you'd like to know? I could get you the traceback, for instance. |
I have three immediate impressions:
|
I have a fairly good idea of what the issue looks like now. When Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/gdrivefs/gdfs/gdfuse.py", line 358, in create
mime_type)
File "/usr/lib/python2.7/site-packages/gdrivefs/gdfs/opened_file.py", line 224, in __init__
self.__load_base_from_remote()
File "/usr/lib/python2.7/site-packages/gdrivefs/gdfs/opened_file.py", line 311, in __load_base_from_remote
self.mime_type)
File "/usr/lib/python2.7/site-packages/gdrivefs/gdtool/drive.py", line 55, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/gdrivefs/gdtool/drive.py", line 461, in download_to_local
p = status.progress()
File "/usr/lib/python2.7/site-packages/googleapiclient/http.py", line 153, in progress
return float(self.resumable_progress) / float(self.total_size)
ZeroDivisionError: float division by zero We create the
I tried to reproduce this on a Debian system which has largely nothing to do with my Arch System (sorry, I only have
At this point I should note that the I/O error does not actually prevent the file from being created, and the file is later updated by the change detector:
(Please pay no attention to the dates and times, these were produced out of order over multiple tests) On the Debian system, the I/O error doesn't seem to be forwarded, and because the operation actually took place, everything appears to work correctly from the perspective of the user. On the Arch system, the I/O error is forwarded and causes the program that requested the operation to think it has failed. |
httplib 0.9.2 raises an exception when determining the progress of a zero-length transaction
I had the same problem. status.progress() fails if the downloaded size is 0. It always happens for new target files or if googledrive target file has size 0. This commit has resolved it. BTW Why does gdrivefs try to download anyway, the target files are usually opened with O_TRUNC. So what is the point in downloading?
See gdfs_log.txt file for complete log. |
@dsoprea any thoughts on this? |
@dsoprea am I correct in reading that you've fixed the issue yourself? |
Yes. On Sun, Jun 26, 2016 at 8:42 PM, PythonNut [email protected] wrote:
|
This skips the check entirely, since the result isn't used anyway when thehttplib 0.9.2
raises an exception when determining the progress of a zero-length transaction, which causes an I/O error.total_size
is zero.I don't know how many people are affected by this, but obviously most files are empty when created. (Is it possible to create a nonempty file in one operation?)
Anyway, with this patch
GDriveFS
seems quite usable!