Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 929364 Details for
Bug 1058526
tar keeps reporting "file changed as we read it" on random files
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
test case for triggering tar problem
openfstatclose.c (text/plain), 1.68 KB, created by
Dick Snippe
on 2014-08-21 21:37:22 UTC
(
hide
)
Description:
test case for triggering tar problem
Filename:
MIME Type:
Creator:
Dick Snippe
Created:
2014-08-21 21:37:22 UTC
Size:
1.68 KB
patch
obsolete
>#define _POSIX_C_SOURCE 200809L > >#include <stdio.h> >#include <stdlib.h> >#include <errno.h> > >#include <sys/types.h> >#include <sys/stat.h> >#include <fcntl.h> >#include <unistd.h> > >#define MAXF 4096 > >void create_and_stat_file(char *filename, struct stat *buf) >{ > int fd; > > if ((fd = open(filename, O_WRONLY|O_CREAT|O_EXCL, 0) ) == -1) > { perror(filename); exit(1); } > if (fstat(fd, buf) == -1) > { perror("fstat"); exit(1); } > if (close(fd) == -1) > { perror("close"); exit(1); } >} > >char *fname(char *base, int i, char *s, int len) >{ > snprintf(s, len, "%s.%03d", base, i); > return s; >} > >int compare_stat(char *filename, struct stat buf1) >{ > struct stat buf2; > > if (lstat(filename, &buf2) == -1) > { perror("lstat"); exit(1); } > > if (buf1.st_mtime != buf2.st_mtime || > buf1.st_mtim.tv_nsec != buf2.st_mtim.tv_nsec) > { > printf("%s: %ld.%09ld != %ld.%09ld\n", filename, > buf1.st_mtime, buf1.st_mtim.tv_nsec, > buf2.st_mtime, buf2.st_mtim.tv_nsec); > return 1; > } > return 0; >} > >int main(int argc, char *argv[]) >{ > char *base="testfile", f[MAXF]; > int i, nfiles=1000, mismatch=0; > struct stat *bufs; > > switch(argc) > { > case 1: break; > case 2: nfiles=atoi(argv[1]); break; > default: printf("Usage %s [n]\n", argv[0]); exit(1); > } > > if (!(bufs = (struct stat *) malloc(nfiles * sizeof(struct stat)))) > { perror("malloc"); exit(1); } > > for (i=0; i<nfiles; i++) > create_and_stat_file(fname(base, i, f, MAXF), &bufs[i]); > for (i=0; i<nfiles; i++) > mismatch+=compare_stat(fname(base, i, f, MAXF), bufs[i]); > for (i=0; i<nfiles; i++) > { > if (unlink(fname(base, i, f, MAXF)) == -1) > { perror("unlink"); exit(1); } > } > > printf("%d/%d (%6.2f%%) mismatches\n", mismatch, nfiles, > 100 * mismatch / (double) nfiles); > > return 0; >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1058526
: 929364