file-directory? & friends not 64-bit safe

Bug #295833 reported by Andreas Rottmann
2
Affects Status Importance Assigned to Milestone
Ikarus Scheme
Fix Committed
Low
Abdulaziz Ghuloum

Bug Description

You can reproduce the bug like this (on a 32-bit system):

% dd if=/dev/zero of=$HOME/big-file count=1 bs=1 seek=5G # make sure $HOME is big enough
% cat test.sps
(import (ikarus))

(display (file-directory? (cadr (command-line))))
(newline)
% ikarus --r6rs-script test.sps ~/big-file
Unhandled exception:
 Condition components:
   1. &error
   2. &who: file-directory?
   3. &message: "EOVERFLOW: Value too large for defined data type"
   4. &i/o-filename: "/home/rotty/big-file"

Related branches

Revision history for this message
Andreas Rottmann (rotty) wrote :
Revision history for this message
Derick Eddington (derick-eddington) wrote : Re: [Bug 295833] [NEW] file-directory? & friends not 64-bit safe

>From http://www.suse.de/~aj/linux_lfs.html :
[Note the part about using getconf for portability.]

In a nutshell for using LFS you can choose either of the following:

      * Compile your programs with "gcc -D_FILE_OFFSET_BITS=64". This
        forces all file access calls to use the 64 bit variants. Several
        types change also, e.g. off_t becomes off64_t. It's therefore
        important to always use the correct types and to not use e.g.
        int instead of off_t. For portability with other platforms you
        should use getconf LFS_CFLAGS which will return
        -D_FILE_OFFSET_BITS=64 on Linux platforms but might return
        something else on e.g. Solaris. For linking, you should use the
        link flags that are reported via getconf LFS_LDFLAGS. On Linux
        systems, you do not need special link flags.
      * Define _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE. With these
        defines you can use the LFS functions like open64 directly.
      * Use the O_LARGEFILE flag with open to operate on large files.

A complete documentation of the feature test macros like
_FILE_OFFSET_BITS and _LARGEFILE_SOURCE is in the glibc manual (run e.g.
"info libc 'Feature Test Macros'").

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

On Nov 8, 2008, at 11:19 PM, Derick Eddington wrote:

> In a nutshell for using LFS you can choose either of the following:

Thanks Derick for the info. I still need to investigate how this
would work under darwin, cygwin, the bsds, and other non-linux OSes.
There must be an autoconf macro for doing this already.

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Fixed in revision 1664. The fix required only adding AC_SYS_LARGEFILE to configure.ac.

Changed in ikarus:
assignee: nobody → aghuloum
importance: Undecided → Low
status: New → Fix Committed
Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

On Nov 8, 2008, at 11:19 PM, Derick Eddington wrote:

>> From http://www.suse.de/~aj/linux_lfs.html :

BTW, more info (than you ever wanted to know) is in:
   http://www.unix.org/version2/whatsnew/lfs20mar.html

Changed in ikarus:
milestone: none → 0.0.4
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.