[Python-bugs-list] [ python-Bugs-781891 ] file.write() incorrectly tests remaining space
SourceForge.net
noreply@sourceforge.net
Sat, 02 Aug 2003 13:26:18 -0700
Bugs item #781891, was opened at 2003-08-02 08:51
Message generated for change (Settings changed) made by uselpa
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=781891&group_id=5470
Category: Python Library
Group: Not a Bug
>Status: Open
Resolution: Invalid
Priority: 5
Submitted By: Patrick Useldinger (uselpa)
Assigned to: Nobody/Anonymous (nobody)
Summary: file.write() incorrectly tests remaining space
Initial Comment:
It seems as if before writing each block, a check was
done in order to verifiy that there is enough space
left for the whole* file, not for the *remaining* data
to be written.
It happens both under 2.3 and 2.2.3.
===== Python 2.3 ======
I:\My Programs\dfc>b2
start dfc.py [v.0.19.final (July 31st, 2003)] @
2003-08-01 00:21:48
Python 2.3.final running on win32
reading configuration file dfcCfgBackupCd
instantiating processor(s) .
paths & includes/excludes taken from configuration file
creating initial reference point
i:\dfc\ref\dfcRefBackupCd.dfc
..copying i:\dfc\arc\dfcArchive cheetah
20030731-234648 F.zip to
f:\dfcArchive cheetah 20030731-234648 F.zip
Traceback (most recent call last):
File "I:\My Programs\dfc\dfc.py", line 199, in ?
dfc.doProcess(cfgFile.DFCProcTags)
File "I:\My Programs\dfc\dfc.py", line 144, in doProcess
newStat=self.newStat.get(fileName,None)) == None:
File "I:\My Programs\dfc\dfc.py", line 129, in process
return
self.pubSub.publishMessage(self.pubSubProcess,kwargs,checkRet=True)
File "I:\My Programs\dfc\PubSub.py", line 170, in
publishMessage
retVal.append(subscriber(**dict(args)))
File "I:\My Programs\dfc\dfcProcCopy.py", line 20, in
process
shutil.copyfile(fileName,toFile)
File "C:\Python23\lib\shutil.py", line 39, in copyfile
copyfileobj(fsrc, fdst)
File "C:\Python23\lib\shutil.py", line 24, in copyfileobj
fdst.write(buf)
IOError: [Errno 28] No space left on device
I:\My Programs\dfc>dir f:
Volume in drive F is Backup 01
Volume Serial Number is E2CB-1650
Directory of F:\
18/05/2002 15:39 <DIR> .
18/05/2002 15:39 <DIR> ..
01/08/2003 00:25 299.630.592 dfcArchive cheetah
20030731-234648 F.zip
1 File(s) 299.630.592 bytes
2 Dir(s) 299.636.736 bytes free
===== Python 2.2.3 =======
I:\My Programs\dfc>i:\py222\python.exe dfc.py
dfcCfgBackupCd
start dfc.py [v.0.19.final (July 31st, 2003)] @
2003-08-01 00:29:08
Python 2.2.3.final running on win32
reading configuration file dfcCfgBackupCd
instantiating processor(s) .
paths & includes/excludes taken from configuration file
creating initial reference point
i:\dfc\ref\dfcRefBackupCd.dfc
..copying i:\dfc\arc\dfcArchive cheetah
20030731-234648 F.zip to
f:\dfcArchive cheetah 20030731-234648 F.zip
Traceback (most recent call last):
File "dfc.py", line 199, in ?
dfc.doProcess(cfgFile.DFCProcTags)
File "dfc.py", line 144, in doProcess
newStat=self.newStat.get(fileName,None)) == None:
File "dfc.py", line 129, in process
return
self.pubSub.publishMessage(self.pubSubProcess,kwargs,checkRet=True)
File "PubSub.py", line 170, in publishMessage
retVal.append(subscriber(**dict(args)))
File "dfcProcCopy.py", line 20, in process
shutil.copyfile(fileName,toFile)
File "i:\py222\lib\shutil.py", line 30, in copyfile
copyfileobj(fsrc, fdst)
File "i:\py222\lib\shutil.py", line 20, in copyfileobj
fdst.write(buf)
IOError: [Errno 28] No space left on device
========================================================================
----------------------------------------------------------------------
Comment By: Patrick Useldinger (uselpa)
Date: 2003-08-02 20:22
Message:
Logged In: YES
user_id=835987
As already explained on c.l.python, a manual copy via
Explorer *does* work. I've just repeated the same with a
copy /b, and again that's OK.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2003-08-02 12:32
Message:
Logged In: YES
user_id=31435
Python has no idea how much space you have left. Write the
code in raw C, and the same thing will happen (Python raises
an exception because C's I/O returned an error code).
It looks like you in fact don't have enough disk space to
complete the write. That's why C is complaining. As
someone already explained on comp.lang.python, filesystems
have hidden overheads, and hoping you can fill it to the last
byte with usable data is futile.
Experiment: since you're on Windows, try making a copy of
the file from a DOS box with "copy /b". That should fail too.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=781891&group_id=5470