xcopy.exe (v1.4a and earlier) can fail when the destination drive has more than 4gb free space.
Source file xcopy.c @ line 756 calculates free disk space with -
free_diskspace = (unsigned long) disktable.df_avail * disktable.df_sclus * disktable.df_bsec;
The free_diskspace unsigned long and cast overflows and wraps when it hits a 4 gigabyte boundary, e.g 4.1gb gets reported as 0.1gb. Will produce random "insufficient free space" errors even when a drive actually has enough free space.
There's several other code files that have the same flaw, probably worth auditing the code base for getdfree()/_dos_getdiskfree().
Cheers
This bug is still active on 2024-08-05! I just tried to copy bigger files (1,5 GB, should be no problem) on a 150 GB virtual HD where 141,541 MBytes are free!
The first 10 of 16 files were done.
There seems to be an uncompiled version 1.5 at: https://github.com/FDOS/xcopy
Last edit: fritz.mueller 2024-08-05
Thank you very much! Seems to be fixed now!
From my side the thread can be closed!
just an additional comment:
I added two different Linux iso files on an actual virtual FD machine
which a drive letter that has full 2TB FAT32 capacity (Bernds kernel) -
and ran xcopy to copy all files (ca. 3,9 GB and ca. 2 GB) on to this HD.
It worked fine. I noticed not problems, no crash, nothing.
So I think it was a good idea to close the bug.
Fritz
Am 2025-08-12 02:02, schrieb Jim Hall:
Links:
[1] https://sourceforge.net/p/freedos/bugs/346/
Related
Bugs:
#346Marking as closed-fixed since XCOPY was updated in a later release to fix stack and disk space issues, as Fritz mentioned.