Menu

#478 ar -M cannot open large archives

2.0
new
nobody
None
2015-01-13
2015-01-11
lantw44
No

When I use ar -M to open a large archive, it fails with the following message:

ar: warning: 'OPEN' failed: Invalid argument

ktrace shows the following message:

CALL  mmap(0,0x191464cec,0x1<PROT_READ>,0x1<MAP_SHARED>,0x4,0)
RET   mmap 34376515584/0x801000000
CALL  write(0x3,0x801000000,0x191464cec)
RET   write -1 errno 22 Invalid argument

0x191464cec is the size of the archive (6.3 GiB). It may be too large for the write system call on FreeBSD.

Discussion

  • Ed Maste

    Ed Maste - 2015-01-12

    Indeed. From write(2):

    write(int fd, const void *buf, size_t nbytes);
    ...
    
    [EINVAL]           The value nbytes is greater than INT_MAX.
    
     
  • Ed Maste

    Ed Maste - 2015-01-13

    What version of FreeBSD are you using?

     
  • lantw44

    lantw44 - 2015-01-13

    FreeBSD 10.1-RELEASE

     
  • Ed Maste

    Ed Maste - 2015-01-13

    Thanks for reporting - see FreeBSD PR https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196666

    You may be able to work around this with a sysctl setting:

    # sysctl debug.iosize_max_clamp=0
    

    but I believe a code change ought to be made so that this works "out of the box," perhaps by calling write() in a loop with a limited amount of data sent at a time

     

    Last edit: Ed Maste 2015-01-13

Log in to post a comment.