Summary
file-exists? does return #f on large files
Metadata
- Id: edc504b737618f54010e16c3671e46b56c395701
- Trac id: 706
- Type: defect
- Reporter: ckeen
- Owner:
- Cc:
- Status: closed
- Component: core libraries
- Estimated difficulty:
- Resolution: fixed
- Priority: critical
- Milestone: 4.9.0
- Version: 4.7.x
- Changetime: 2012-09-24 21:47:48 UTC
- Created: 2011-09-28 15:09:47 UTC
- Keywords: file-exists? 2GB large files
Description
Reported by Sven Hartrumpf > I have just lost some files (fortunately, they can be restored somehow) > because file-exists? returned #f for large files (> 2 GB).
Confirmed by Moritz for 32 bit chickens (on a 32 bit machine)
It does do the right thing on 64bit chickens
Changes and comments
[2011-09-28 15:20:14 UTC] ckeen wrote:
(define (file-exists? name)
(##sys#check-string name 'file-exists?)
(##sys#pathname-resolution
name
(lambda (name)
(and (##sys#file-info (##sys#platform-fixup-pathname name)) name) )
#:exists?) )
(define (##sys#pathname-resolution name thunk . _)
(thunk (##sys#expand-home-path name)) )
What's that keyword for anyway? Also wouldn't a call to fstat alone suffice without even filling the stat structure?
[2011-09-28 16:43:38 UTC] ckeen wrote:
On a 32 bit chicken fstat fails with (gdb) p perror() file-exists: Value too large for defined data type
[2011-09-28 16:47:10 UTC] ckeen wrote:
Which results from
EOVERFLOW
(stat()) path refers to a file whose size cannot be represented in the type off_t. This can occur when an application com‐
piled on a 32-bit platform without -D_FILE_OFFSET_BITS=64 calls stat() on a file whose size exceeds (2<<31)-1 bits.
of course
[2011-10-06 09:52:20 UTC] felix changed status from new to closed
[2011-10-06 09:52:20 UTC] felix set resolution to fixed
[2011-10-06 09:52:20 UTC] felix wrote:
This should work now . In the current `master`version, `file-exists?` will signal an error on any other error condition but `ENOENT`.
[2012-09-24 21:47:48 UTC] felix changed milestone from 4.8.0 to 4.9.0
[2012-09-24 21:47:48 UTC] felix wrote:
Milestone 4.8.0 deleted