From owner-freebsd-stable@FreeBSD.ORG Sat Jul 9 15:09:53 2005 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7264416A41C for ; Sat, 9 Jul 2005 15:09:53 +0000 (GMT) (envelope-from cracauer@schlepper.zs64.net) Received: from schlepper.zs64.net (schlepper.zs64.net [212.12.50.230]) by mx1.FreeBSD.org (Postfix) with ESMTP id E87F043D45 for ; Sat, 9 Jul 2005 15:09:52 +0000 (GMT) (envelope-from cracauer@schlepper.zs64.net) Received: from schlepper.zs64.net (schlepper [212.12.50.230]) by schlepper.zs64.net (8.13.1/8.12.9) with ESMTP id j69F9qtQ069647 for ; Sat, 9 Jul 2005 17:09:52 +0200 (CEST) (envelope-from cracauer@schlepper.zs64.net) Received: (from cracauer@localhost) by schlepper.zs64.net (8.13.1/8.12.9/Submit) id j69F9qLX069646 for freebsd-stable@freebsd.org; Sat, 9 Jul 2005 11:09:52 -0400 (EDT) (envelope-from cracauer) Date: Sat, 9 Jul 2005 11:09:51 -0400 From: Martin Cracauer To: freebsd-stable@freebsd.org Message-ID: <20050709110951.B69588@cons.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="i0/AhcQY5QxfSsSZ" Content-Disposition: inline User-Agent: Mutt/1.2.5i Subject: 5.x test request (FWD: Repairing ext2fs stat(2), fts(3) in 6.0-current, please test on 5.x) X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jul 2005 15:09:53 -0000 --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 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 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 #include #include #include #include #include #include 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--