Date: Sat, 9 Jul 2005 11:09:51 -0400 From: Martin Cracauer <cracauer@cons.org> To: freebsd-stable@freebsd.org Subject: 5.x test request (FWD: Repairing ext2fs stat(2), fts(3) in 6.0-current, please test on 5.x) Message-ID: <20050709110951.B69588@cons.org>
next in thread | raw e-mail | index | archive | help
--i0/AhcQY5QxfSsSZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Can somebody running FreeBSD 5-stable please test whether this patch is needed in 5.x? I can provide a small file with an ext2fs in it so that you can try in a vnode mount. Martin --i0/AhcQY5QxfSsSZ Content-Type: message/rfc822 Content-Disposition: inline Date: Fri, 8 Jul 2005 18:15:27 -0400 From: Martin Cracauer <cracauer@cons.org> To: freebsd-current@freebsd.org Subject: Repairing ext2fs stat(2), fts(3) in 6.0-current, please test on 5.x Message-ID: <20050708181514.A54677@cons.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Yylu36WmvOXNoKYn" Content-Disposition: inline User-Agent: Mutt/1.2.5i --Yylu36WmvOXNoKYn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline ext2fs fails to set the device in the stat(2) system call. Subsequently, that makes fts(3) fail, which goes as far as make ls(1) fail (which uses fts). The appended diff fixes it for me and looks correct to me. Unless somebody objects I will submit it to re@ for commit approval. %% I don't have a 5.x system anywhere, can somebody please test whether the problem exists in 5.x? Here is how: - compile appended test program - mount an ext2fs to -say- /mnt/tmp - `./stattests /mnt/tmp` ==> must return identical device ids Quicker test: - mount ext2fs to /mnt/tmp - `ls -F /mnt/tmp` ==> will fail with file not found errors. Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer/ No warranty. This email is probably produced by one of my cats stepping on the keys. No, I don't have an infinite number of cats. --Yylu36WmvOXNoKYn Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="diff.ext2fs" Index: ext2_vnops.c =================================================================== RCS file: /lhome/CVS-FreeBSD/src/sys/gnu/fs/ext2fs/ext2_vnops.c,v retrieving revision 1.102 diff -u -r1.102 ext2_vnops.c --- ext2_vnops.c 15 Jun 2005 02:36:11 -0000 1.102 +++ ext2_vnops.c 8 Jul 2005 22:07:16 -0000 @@ -346,6 +346,7 @@ /* * Copy from inode table */ + vap->va_fsid = dev2udev(ip->i_devvp->v_rdev); vap->va_fileid = ip->i_number; vap->va_mode = ip->i_mode & ~IFMT; vap->va_nlink = ip->i_nlink; --Yylu36WmvOXNoKYn Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="stattests.c" #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <dirent.h> static void print(const char *const msg, const struct stat *const s) { fprintf(stderr, "dev %s: %X (%d/%d)\n", msg, s->st_dev , major(s->st_dev) , minor(s->st_dev)); } int main(int argc, char *argv[]) { struct stat s; struct stat s_direct; int fd; char *filename1 = NULL; if (argc < 2) { fprintf(stderr, "Usage: filename\n"); exit(1); } filename1 = argv[1]; if (stat(filename1, &s_direct) == -1) { perror("stat"); exit(2); } print("just stat", &s_direct); fd = open(filename1, O_RDONLY); if (fd == -1) { perror("open"); exit(2); } if (fstat(fd, &s) == -1) { perror("fstat"); exit(2); } print("using fstat", &s); #if 0 DIR *dir; dir = opendir(filename1); if (dir == NULL) { perror("opendir"); exit(2); } if (fstat(dirfd(dir), &s) == -1) { perror("fstat"); exit(2); } fprintf(stderr, "dev: %d\n", s.st_dev); if (stat("/mnt/tmp/X11", &s) == -1) { perror("stat"); exit(2); } fprintf(stderr, "dev: %d\n", s.st_dev); #endif return 0; } --Yylu36WmvOXNoKYn-- --i0/AhcQY5QxfSsSZ--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050709110951.B69588>