Bug 1288662

Summary: openat() && write() broken on i386 with _FILE_OFFSET_BITS 64
Product: [Fedora] Fedora Reporter: Pavel Raiskup <praiskup>
Component: glibcAssignee: Florian Weimer <fweimer>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: arjun.is, codonell, fweimer, jakub, law, mfabian, pfrankli, siddhesh
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Unspecified   
Whiteboard:
Fixed In Version: glibc-2.22-6.fc23 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-06 19:18:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Reproducer (srpm) none

Description Pavel Raiskup 2015-12-04 22:27:20 UTC
This issue breaks GNU tar for big files.  See:
https://copr.fedoraproject.org/coprs/praiskup/tar/monitor/

Reproducer (always fails with 'write: File too large'):

#define _FILE_OFFSET_BITS 64

#include <sys/types.h>
#include <unistd.h>

#include <fcntl.h>
#include <stdio.h>

int main()
{
  char buf[512];
#if 1
  /* this makes the following write() fail */
  int fd = openat (AT_FDCWD, "sparsefile", O_WRONLY | O_CREAT, 420);
#else
  /* this is OK */
  int fd = open ("sparsefile", O_WRONLY | O_CREAT, 420);
#endif
  if ((off_t)-1 == lseek (fd, 8589935104, SEEK_SET)) {
    perror ("lseek");
    return 1;
  }

  if ((ssize_t)-1 == write(fd, buf, 512)) {
    perror ("write");
    return 1;
  }

  return 0;
}

Comment 1 Pavel Raiskup 2015-12-04 22:32:06 UTC
Created attachment 1102452 [details]
Reproducer (srpm)

Build fail in copr:
https://copr-be.cloud.fedoraproject.org/results/praiskup/tar/fedora-23-i386/00144932-tar-git-vanilla/

Koji build fail with attached reproducer:
http://koji.fedoraproject.org/koji/taskinfo?taskID=12058344

Comment 2 Pavel Raiskup 2015-12-04 23:33:30 UTC
# rpm -q glibc
glibc-2.22-5.fc23.i686

Comment 3 Florian Weimer 2015-12-05 12:21:40 UTC
glibc-2.22-5.fc23.i686 confirmed as affected, but glibc-2.21-5.fc22.i686 is not.

Comment 4 Fedora Update System 2015-12-05 16:47:53 UTC
glibc-2.22-6.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-7174c4d68d

Comment 5 Fedora Update System 2015-12-06 17:20:41 UTC
glibc-2.22-6.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update glibc'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-7174c4d68d

Comment 6 Fedora Update System 2015-12-06 19:18:21 UTC
glibc-2.22-6.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.