NetBSD Problem Report #15790
Received: (qmail 10862 invoked from network); 3 Mar 2002 09:21:54 -0000
Message-Id: <20020303092155.46CD111110@www.netbsd.org>
Date: Sun, 3 Mar 2002 01:21:55 -0800 (PST)
From: netbsd-current@dberg.net
Sender: nobody@netbsd.org
Reply-To: netbsd-current@dberg.net
To: gnats-bugs@gnats.netbsd.org
Subject: dump SEGV's if source FS missing from /etc/fstab
X-Send-Pr-Version: www-1.0
>Number: 15790
>Category: bin
>Synopsis: dump SEGV's if source FS missing from /etc/fstab
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bouyer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Mar 03 09:22:00 +0000 2002
>Closed-Date: Sun Apr 06 19:06:40 +0000 2003
>Last-Modified: Wed May 13 13:31:01 +0000 2015
>Originator: Dave Berger
>Release: 1.5.3_ALPHA / atari
>Organization:
>Environment:
NetBSD piano 1.5.3_ALPHA NetBSD 1.5.3_ALPHA (HADES_DLB) #0: Thu Feb 21 23:25:04 EST 2002 rootz@piano:/amd/piano/m/wrk/src/sys/arch/atari/compile/HADES_DLB atari
>Description:
The "dump" command aborts with a SIGSEGV if the filesystem from which the data is being dumped is not listed in /etc/fstab (or if the filesystem is manually mounted on an alternate point which doesn't match its fstab listing).
background:
I was doing hierarchy transfers via "dump -0f - <dir> | (cd <dest> ; restore -xf -)" and they were working--until I hit the failure mode.
I tried some test cases and started to think the problem was with 'amd' mountpoints because there was no trouble with any others.
Then, I tried shutting down amd, unmounting its FS's, and manually mounting one of them on /mnt instead of under /amd; a dump from this setup resulted in the same error.
Finally, I made a /mnt entry in fstab for the same FS and remounted it. This time the dump worked.
Note:
Under NetBSD 1.5.2 / i386, the symptom is a
DUMP: short read error from /mnt: [sector 8194]: count=1, got=0
instead of the
DUMP: SIGSEGV: ABORTING!
of the 1.5.3_ALPHA atari machine.
>How-To-Repeat:
Shortcut: rename /etc/fstab; run a dump.
Full: unmount an FS and remount it manually on an alternate mountpoint (one not listed in /etc/fstab).
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback
State-Changed-By: bouyer
State-Changed-When: Sun Mar 3 13:54:09 PST 2002
State-Changed-Why:
I just sent a patch
Responsible-Changed-From-To: bin-bug-people->bouyer
Responsible-Changed-By: bouyer
Responsible-Changed-When: Sun Mar 3 13:54:09 PST 2002
Responsible-Changed-Why:
I have a patch for this
From: Manuel Bouyer <bouyer@antioche.eu.org>
To: netbsd-current@dberg.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/15790: dump SEGV's if source FS missing from /etc/fstab
Date: Sun, 3 Mar 2002 22:53:52 +0100
--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Sun, Mar 03, 2002 at 01:21:55AM -0800, netbsd-current@dberg.net wrote:
> >Description:
> The "dump" command aborts with a SIGSEGV if the filesystem from which the data is being dumped is not listed in /etc/fstab (or if the filesystem is manually mounted on an alternate point which doesn't match its fstab listing).
>
> background:
>
> I was doing hierarchy transfers via "dump -0f - <dir> | (cd <dest> ; restore -xf -)" and they were working--until I hit the failure mode.
>
> I tried some test cases and started to think the problem was with 'amd' mountpoints because there was no trouble with any others.
>
> Then, I tried shutting down amd, unmounting its FS's, and manually mounting one of them on /mnt instead of under /amd; a dump from this setup resulted in the same error.
>
> Finally, I made a /mnt entry in fstab for the same FS and remounted it. This time the dump worked.
>
> Note:
>
> Under NetBSD 1.5.2 / i386, the symptom is a
>
> DUMP: short read error from /mnt: [sector 8194]: count=1, got=0
>
> instead of the
>
> DUMP: SIGSEGV: ABORTING!
>
> of the 1.5.3_ALPHA atari machine.
>
Hi,
can you please try the attached patch ?
--
Manuel Bouyer <bouyer@antioche.eu.org>
--
--X1bOJ3K7DJ5YkBrT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff-dump
? .depend
? dump
? dump.cat8
? dump.core
Index: dump.h
===================================================================
RCS file: /cvsroot/basesrc/sbin/dump/dump.h,v
retrieving revision 1.19.6.7
diff -u -r1.19.6.7 dump.h
--- dump.h 2002/01/17 10:15:19 1.19.6.7
+++ dump.h 2002/03/03 21:51:27
@@ -231,6 +231,7 @@
#define DIALUP "ttyd" /* prefix for dialups */
struct fstab *fstabsearch __P((char *key)); /* search fs_file and fs_spec */
+struct statfs *mntinfosearch __P((const char *key));
#ifndef NAME_MAX
#define NAME_MAX 255
Index: main.c
===================================================================
RCS file: /cvsroot/basesrc/sbin/dump/main.c,v
retrieving revision 1.25.6.7
diff -u -r1.25.6.7 main.c
--- main.c 2002/01/16 10:01:37 1.25.6.7
+++ main.c 2002/03/03 21:51:27
@@ -99,14 +99,15 @@
ino_t ino;
int dirty;
struct dinode *dp;
- struct fstab *dt;
+ struct fstab *dt;
+ struct statfs *mntinfo, fsbuf;
char *map;
int ch;
int i, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1;
ino_t maxino;
time_t tnow, date;
- int dirlist;
- char *toplevel;
+ int dirc;
+ char *mountpoint;
int just_estimate = 0;
char labelstr[LBLSIZE];
@@ -248,38 +249,47 @@
exit(X_ABORT);
}
+
/*
* determine if disk is a subdirectory, and setup appropriately
*/
- dirlist = 0;
- toplevel = NULL;
+ getfstab(); /* /etc/fstab snarfed */
+ disk = NULL;
+ mountpoint = NULL;
+ dirc = 0;
for (i = 0; i < argc; i++) {
struct stat sb;
- struct statfs fsbuf;
- if (lstat(argv[i], &sb) == -1) {
- msg("Cannot lstat %s: %s\n", argv[i], strerror(errno));
- exit(X_ABORT);
- }
- if (!S_ISDIR(sb.st_mode) && !S_ISREG(sb.st_mode))
+ if (lstat(argv[i], &sb) == -1)
+ quit("Cannot stat %s: %s\n", argv[i], strerror(errno));
+ if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) {
+ disk = argv[i];
+ multicheck:
+ if (dirc != 0)
+ quit(
+ "Can't dump a mountpoint and a filelist\n");
break;
- if (statfs(argv[i], &fsbuf) == -1) {
- msg("Cannot statfs %s: %s\n", argv[i], strerror(errno));
- exit(X_ABORT);
}
- if (strcmp(argv[i], fsbuf.f_mntonname) == 0) {
- if (dirlist != 0) {
- msg("Can't dump a mountpoint and a filelist\n");
+ if ((dt = fstabsearch(argv[i])) != NULL) {
+ disk = dt->fs_spec;
+ if ((mountpoint = strdup(dt->fs_file)) == NULL) {
+ msg("Cannot malloc mountpoint\n");
exit(X_ABORT);
}
- break; /* exit if sole mountpoint */
+ goto multicheck;
}
- if (!disk) {
- if ((toplevel = strdup(fsbuf.f_mntonname)) == NULL) {
- msg("Cannot malloc diskname\n");
+ if (statfs(argv[i], &fsbuf) == -1)
+ quit("Cannot statfs %s: %s\n", argv[i],
+ strerror(errno));
+ disk = fsbuf.f_mntfromname;
+ if (strcmp(argv[i], fsbuf.f_mntonname) == 0)
+ goto multicheck;
+ if (mountpoint == NULL) {
+ if ((mountpoint = strdup(fsbuf.f_mntonname)) == NULL) {
+ msg("Cannot malloc mountpoint\n");
exit(X_ABORT);
}
- disk = toplevel;
+ goto multicheck;
if (uflag) {
msg("Ignoring u flag for subdir dump\n");
uflag = 0;
@@ -288,18 +298,20 @@
msg("Subdir dump is done at level 0\n");
level = '0';
}
- msg("Dumping sub files/directories from %s\n", disk);
+ msg("Dumping sub files/directories from %s\n",
+ mountpoint);
} else {
- if (strcmp(disk, fsbuf.f_mntonname) != 0) {
- msg("%s is not on %s\n", argv[i], disk);
- exit(X_ABORT);
- }
+ if (strcmp(mountpoint, fsbuf.f_mntonname) != 0)
+ quit("%s is not on %s\n", argv[i], mountpoint);
}
msg("Dumping file/directory %s\n", argv[i]);
- dirlist++;
+ dirc++;
}
- if (dirlist == 0) {
- disk = *argv++;
+ if (mountpoint)
+ free(mountpoint);
+
+ if (dirc == 0) {
+ argv++;
if (argc != 1) {
(void)fprintf(stderr, "Excess arguments to dump:");
while (--argc)
@@ -365,28 +377,32 @@
signal(SIGINT, SIG_IGN);
set_operators(); /* /etc/group snarfed */
- getfstab(); /* /etc/fstab snarfed */
/*
- * disk can be either the full special file name,
- * the suffix of the special file name,
- * the special name missing the leading '/',
- * the file system name with or without the leading '/'.
+ * disk can be either the full special file name, or
+ * the file system name.
*/
- dt = fstabsearch(disk);
- if (dt != NULL) {
+ mountpoint = NULL;
+ if ((dt = fstabsearch(disk)) != NULL) {
disk = rawname(dt->fs_spec);
- (void)strncpy(spcl.c_dev, dt->fs_spec, NAMELEN);
- if (dirlist != 0)
+ mountpoint = dt->fs_file;
+ msg("Found %s on %s in %s\n", disk, mountpoint, _PATH_FSTAB);
+ } else if ((mntinfo = mntinfosearch(disk)) != NULL) {
+ disk = rawname(mntinfo->f_mntfromname);
+ mountpoint = mntinfo->f_mntonname;
+ msg("Found %s on %s in mount table\n", disk, mountpoint);
+ }
+ if (mountpoint != NULL) {
+ if (dirc != 0)
(void)snprintf(spcl.c_filesys, NAMELEN,
- "a subset of %s", dt->fs_file);
+ "a subset of %s", mountpoint);
else
- (void)strncpy(spcl.c_filesys, dt->fs_file, NAMELEN);
+ (void)strncpy(spcl.c_filesys, mountpoint, NAMELEN);
} else {
- (void)strncpy(spcl.c_dev, disk, NAMELEN);
(void)strncpy(spcl.c_filesys, "an unlisted file system",
NAMELEN);
}
+ (void)strncpy(spcl.c_dev, disk, NAMELEN);
(void)strncpy(spcl.c_label, labelstr, sizeof(spcl.c_label) - 1);
(void)gethostname(spcl.c_host, NAMELEN);
spcl.c_host[sizeof(spcl.c_host) - 1] = '\0';
@@ -413,7 +429,7 @@
msg("Date of last level %c dump: %s", lastlevel,
spcl.c_ddate == 0 ? "the epoch\n" : ctime(&date));
msg("Dumping ");
- if (dt != NULL && dirlist != 0)
+ if (dirc != 0)
msgtail("a subset of ");
msgtail("%s (%s) ", disk, spcl.c_filesys);
if (host)
@@ -444,8 +460,8 @@
(void)signal(SIGINFO, statussig);
msg("mapping (Pass I) [regular files]\n");
- anydirskipped = mapfiles(maxino, &tapesize, toplevel,
- (dirlist ? argv : NULL));
+ anydirskipped = mapfiles(maxino, &tapesize, mountpoint,
+ (dirc ? argv : NULL));
msg("mapping (Pass II) [directories]\n");
while (anydirskipped) {
Index: optr.c
===================================================================
RCS file: /cvsroot/basesrc/sbin/dump/optr.c,v
retrieving revision 1.13.10.3
diff -u -r1.13.10.3 optr.c
--- optr.c 2002/01/16 09:57:08 1.13.10.3
+++ optr.c 2002/03/03 21:51:27
@@ -46,6 +46,8 @@
#include <sys/queue.h>
#include <sys/wait.h>
#include <sys/time.h>
+#include <sys/ucred.h>
+#include <sys/mount.h>
#include <errno.h>
#include <fstab.h>
@@ -505,6 +507,39 @@
}
return (NULL);
}
+
+/*
+ * Search in the mounted file list for a file name.
+ * This file name can be either the special or the path file name.
+ *
+ * The entries in the list are the BLOCK special names, not the
+ * character special names.
+ * The caller of mntinfosearch assures that the character device
+ * is dumped (that is much faster)
+ */
+struct statfs *
+mntinfosearch(const char *key)
+{
+ int i, mntbufc;
+ struct statfs *mntbuf, *fs;
+ char *rn;
+
+ if ((mntbufc = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
+ quit("Can't get mount list: %s", strerror(errno));
+ for (fs = mntbuf, i = 0; i < mntbufc; i++, fs++) {
+ if (strcmp(fs->f_fstypename, "ufs") != 0 &&
+ strcmp(fs->f_fstypename, "ffs") != 0)
+ continue;
+ if (strcmp(fs->f_mntonname, key) == 0 ||
+ strcmp(fs->f_mntfromname, key) == 0)
+ return (fs);
+ rn = rawname(fs->f_mntfromname);
+ if (rn != NULL && strcmp(rn, key) == 0)
+ return (fs);
+ }
+ return (NULL);
+}
+
/*
* Tell the operator what to do
--X1bOJ3K7DJ5YkBrT--
From: Dave Berger <netbsd-current@dberg.net>
To: Manuel Bouyer <bouyer@antioche.eu.org>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/15790: dump SEGV's if source FS missing from /etc/fstab
Date: Mon, 4 Mar 2002 04:38:27 -0500
Thanks, Manuel.
Patch succeeded; SEGV cured. Note a side-effect, though: the
"files-to-dump" param is now ignored (i.e., the whole filesystem
is always dumped).
(Only tested on NetBSD1.5.3_ALPHA/atari)
Cheers, --Dave
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: Dave Berger <netbsd-current@dberg.net>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/15790: dump SEGV's if source FS missing from /etc/fstab
Date: Thu, 7 Mar 2002 22:35:36 +0100
--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Mon, Mar 04, 2002 at 04:38:27AM -0500, Dave Berger wrote:
> Thanks, Manuel.
>
> Patch succeeded; SEGV cured. Note a side-effect, though: the
> "files-to-dump" param is now ignored (i.e., the whole filesystem
> is always dumped).
OK, I found the problem for this side effect: I made a mistake while
merging changes from -current.
Can you try the attached diff ?
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--
--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff-dump
? .depend
? dump
? dump.cat8
? dump.core
Index: dump.h
===================================================================
RCS file: /cvsroot/basesrc/sbin/dump/dump.h,v
retrieving revision 1.19.6.7
diff -u -r1.19.6.7 dump.h
--- dump.h 2002/01/17 10:15:19 1.19.6.7
+++ dump.h 2002/03/07 21:32:52
@@ -1,4 +1,4 @@
-/* $NetBSD: dump.h,v 1.19.6.7 2002/01/17 10:15:19 he Exp $ */
+/* $NetBSD: dump.h,v 1.27 2001/05/28 01:09:55 lukem Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -231,6 +231,7 @@
#define DIALUP "ttyd" /* prefix for dialups */
struct fstab *fstabsearch __P((char *key)); /* search fs_file and fs_spec */
+struct statfs *mntinfosearch __P((const char *key));
#ifndef NAME_MAX
#define NAME_MAX 255
Index: main.c
===================================================================
RCS file: /cvsroot/basesrc/sbin/dump/main.c,v
retrieving revision 1.25.6.7
diff -u -r1.25.6.7 main.c
--- main.c 2002/01/16 10:01:37 1.25.6.7
+++ main.c 2002/03/07 21:32:52
@@ -99,14 +99,15 @@
ino_t ino;
int dirty;
struct dinode *dp;
- struct fstab *dt;
+ struct fstab *dt;
+ struct statfs *mntinfo, fsbuf;
char *map;
int ch;
int i, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1;
ino_t maxino;
time_t tnow, date;
- int dirlist;
- char *toplevel;
+ int dirc;
+ char *mountpoint;
int just_estimate = 0;
char labelstr[LBLSIZE];
@@ -248,38 +249,46 @@
exit(X_ABORT);
}
+
/*
* determine if disk is a subdirectory, and setup appropriately
*/
- dirlist = 0;
- toplevel = NULL;
+ getfstab(); /* /etc/fstab snarfed */
+ disk = NULL;
+ mountpoint = NULL;
+ dirc = 0;
for (i = 0; i < argc; i++) {
struct stat sb;
- struct statfs fsbuf;
- if (lstat(argv[i], &sb) == -1) {
- msg("Cannot lstat %s: %s\n", argv[i], strerror(errno));
- exit(X_ABORT);
- }
- if (!S_ISDIR(sb.st_mode) && !S_ISREG(sb.st_mode))
+ if (lstat(argv[i], &sb) == -1)
+ quit("Cannot stat %s: %s\n", argv[i], strerror(errno));
+ if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) {
+ disk = argv[i];
+ multicheck:
+ if (dirc != 0)
+ quit(
+ "Can't dump a mountpoint and a filelist\n");
break;
- if (statfs(argv[i], &fsbuf) == -1) {
- msg("Cannot statfs %s: %s\n", argv[i], strerror(errno));
- exit(X_ABORT);
}
- if (strcmp(argv[i], fsbuf.f_mntonname) == 0) {
- if (dirlist != 0) {
- msg("Can't dump a mountpoint and a filelist\n");
+ if ((dt = fstabsearch(argv[i])) != NULL) {
+ disk = dt->fs_spec;
+ if ((mountpoint = strdup(dt->fs_file)) == NULL) {
+ msg("Cannot malloc mountpoint\n");
exit(X_ABORT);
}
- break; /* exit if sole mountpoint */
+ goto multicheck;
}
- if (!disk) {
- if ((toplevel = strdup(fsbuf.f_mntonname)) == NULL) {
- msg("Cannot malloc diskname\n");
+ if (statfs(argv[i], &fsbuf) == -1)
+ quit("Cannot statfs %s: %s\n", argv[i],
+ strerror(errno));
+ disk = fsbuf.f_mntfromname;
+ if (strcmp(argv[i], fsbuf.f_mntonname) == 0)
+ goto multicheck;
+ if (mountpoint == NULL) {
+ if ((mountpoint = strdup(fsbuf.f_mntonname)) == NULL) {
+ msg("Cannot malloc mountpoint\n");
exit(X_ABORT);
}
- disk = toplevel;
if (uflag) {
msg("Ignoring u flag for subdir dump\n");
uflag = 0;
@@ -288,18 +297,20 @@
msg("Subdir dump is done at level 0\n");
level = '0';
}
- msg("Dumping sub files/directories from %s\n", disk);
+ msg("Dumping sub files/directories from %s\n",
+ mountpoint);
} else {
- if (strcmp(disk, fsbuf.f_mntonname) != 0) {
- msg("%s is not on %s\n", argv[i], disk);
- exit(X_ABORT);
- }
+ if (strcmp(mountpoint, fsbuf.f_mntonname) != 0)
+ quit("%s is not on %s\n", argv[i], mountpoint);
}
msg("Dumping file/directory %s\n", argv[i]);
- dirlist++;
+ dirc++;
}
- if (dirlist == 0) {
- disk = *argv++;
+ if (mountpoint)
+ free(mountpoint);
+
+ if (dirc == 0) {
+ argv++;
if (argc != 1) {
(void)fprintf(stderr, "Excess arguments to dump:");
while (--argc)
@@ -365,28 +376,32 @@
signal(SIGINT, SIG_IGN);
set_operators(); /* /etc/group snarfed */
- getfstab(); /* /etc/fstab snarfed */
/*
- * disk can be either the full special file name,
- * the suffix of the special file name,
- * the special name missing the leading '/',
- * the file system name with or without the leading '/'.
+ * disk can be either the full special file name, or
+ * the file system name.
*/
- dt = fstabsearch(disk);
- if (dt != NULL) {
+ mountpoint = NULL;
+ if ((dt = fstabsearch(disk)) != NULL) {
disk = rawname(dt->fs_spec);
- (void)strncpy(spcl.c_dev, dt->fs_spec, NAMELEN);
- if (dirlist != 0)
+ mountpoint = dt->fs_file;
+ msg("Found %s on %s in %s\n", disk, mountpoint, _PATH_FSTAB);
+ } else if ((mntinfo = mntinfosearch(disk)) != NULL) {
+ disk = rawname(mntinfo->f_mntfromname);
+ mountpoint = mntinfo->f_mntonname;
+ msg("Found %s on %s in mount table\n", disk, mountpoint);
+ }
+ if (mountpoint != NULL) {
+ if (dirc != 0)
(void)snprintf(spcl.c_filesys, NAMELEN,
- "a subset of %s", dt->fs_file);
+ "a subset of %s", mountpoint);
else
- (void)strncpy(spcl.c_filesys, dt->fs_file, NAMELEN);
+ (void)strncpy(spcl.c_filesys, mountpoint, NAMELEN);
} else {
- (void)strncpy(spcl.c_dev, disk, NAMELEN);
(void)strncpy(spcl.c_filesys, "an unlisted file system",
NAMELEN);
}
+ (void)strncpy(spcl.c_dev, disk, NAMELEN);
(void)strncpy(spcl.c_label, labelstr, sizeof(spcl.c_label) - 1);
(void)gethostname(spcl.c_host, NAMELEN);
spcl.c_host[sizeof(spcl.c_host) - 1] = '\0';
@@ -413,7 +428,7 @@
msg("Date of last level %c dump: %s", lastlevel,
spcl.c_ddate == 0 ? "the epoch\n" : ctime(&date));
msg("Dumping ");
- if (dt != NULL && dirlist != 0)
+ if (dirc != 0)
msgtail("a subset of ");
msgtail("%s (%s) ", disk, spcl.c_filesys);
if (host)
@@ -444,8 +459,8 @@
(void)signal(SIGINFO, statussig);
msg("mapping (Pass I) [regular files]\n");
- anydirskipped = mapfiles(maxino, &tapesize, toplevel,
- (dirlist ? argv : NULL));
+ anydirskipped = mapfiles(maxino, &tapesize, mountpoint,
+ (dirc ? argv : NULL));
msg("mapping (Pass II) [directories]\n");
while (anydirskipped) {
Index: optr.c
===================================================================
RCS file: /cvsroot/basesrc/sbin/dump/optr.c,v
retrieving revision 1.13.10.3
diff -u -r1.13.10.3 optr.c
--- optr.c 2002/01/16 09:57:08 1.13.10.3
+++ optr.c 2002/03/07 21:32:52
@@ -46,6 +46,8 @@
#include <sys/queue.h>
#include <sys/wait.h>
#include <sys/time.h>
+#include <sys/ucred.h>
+#include <sys/mount.h>
#include <errno.h>
#include <fstab.h>
@@ -505,6 +507,39 @@
}
return (NULL);
}
+
+/*
+ * Search in the mounted file list for a file name.
+ * This file name can be either the special or the path file name.
+ *
+ * The entries in the list are the BLOCK special names, not the
+ * character special names.
+ * The caller of mntinfosearch assures that the character device
+ * is dumped (that is much faster)
+ */
+struct statfs *
+mntinfosearch(const char *key)
+{
+ int i, mntbufc;
+ struct statfs *mntbuf, *fs;
+ char *rn;
+
+ if ((mntbufc = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
+ quit("Can't get mount list: %s", strerror(errno));
+ for (fs = mntbuf, i = 0; i < mntbufc; i++, fs++) {
+ if (strcmp(fs->f_fstypename, "ufs") != 0 &&
+ strcmp(fs->f_fstypename, "ffs") != 0)
+ continue;
+ if (strcmp(fs->f_mntonname, key) == 0 ||
+ strcmp(fs->f_mntfromname, key) == 0)
+ return (fs);
+ rn = rawname(fs->f_mntfromname);
+ if (rn != NULL && strcmp(rn, key) == 0)
+ return (fs);
+ }
+ return (NULL);
+}
+
/*
* Tell the operator what to do
--zYM0uCDKw75PZbzx--
From: Dave Berger <netbsd-current@dberg.net>
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/15790: dump SEGV's if source FS missing from /etc/fstab
Date: Wed, 13 Mar 2002 16:28:00 -0500
Thanks again, Manuel.
It's working better than before now, i.e., in most cases, dump
operates on exactly the specified subhierarchy. Three new items
are still worth noting, though (with apologies for the copious
response--I wasn't sure how to provide a clear explanation):
o In the "files-to-dump" param, dump can confuse a subdirecto-
ry-value with the name of a mountpoint: [HIGH SEVERITY]
##
# /mnt & wd0o are hand-mounted and not listed in /etc/fstab
##
piano% df -k /mnt
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/wd0o 915174 139204 730211 16% /mnt
piano% cd /mnt
piano% ls
1.4 bark-local distrib142A.tgz src
Dist current pkgsrc syssrc142A.tgz
piano% cd 1.4/
piano% ls
gnu.dif.gz pkgsrc share.dif.gz src.rm.gz tarlist.gz
pkg.dif.gz secr.dif.gz share.rm.gz sys.dif.gz usr
pkg.rm.gz secr.rm.gz src.dif.gz sys.rm.gz xsrc.dif.gz
piano% dump -0f - usr > /usr/tmp/foo.dmp
DUMP: Found /dev/rwd0i on /usr in /etc/fstab
DUMP: Date of this level 0 dump: Wed Mar 13 15:39:59 2002
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rwd0i (/usr) to standard output
DUMP: Label: none ...
I.e., dump reads the wrong filesystem: "/usr" rather than
./usr. If "./usr" is specified instead, however, dump will
operate as expected:
piano% dump -0f - ./usr > /usr/tmp/foo.dmp
DUMP: Dumping sub files/directories from /mnt
DUMP: Dumping file/directory ./usr
DUMP: Found /dev/rwd0o on /mnt in mount table
DUMP: Date of this level 0 dump: Wed Mar 13 15:51:54 2002
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping a subset of /dev/rwd0o (a subset of /mnt) to stan ...
DUMP: Label: none ...
o if "files-to-dump" is on an NFS mounted filesystem, an error
is generated and dump is aborted (maybe this is a separate
issue, warranting a separate pr?) [MEDIUM SEVERITY]
o the path recorded in the archive for "files-to-dump" is not
what was on the command-line, rather it's the absolute path
up to and including "files-to-dump" minus the mount point:
[LOW SEVERITY]
piano% cd /mnt/src/
piano% ls
ecartis-1.0.0 ecartis-1.0.0-snap20020125.tar.gz
piano% dump -0f - ecartis-1.0.0 > /usr/tmp/foo.dmp
...
DUMP: DUMP IS DONE
piano% restore -tf /usr/tmp/foo.dmp
Level 0 dump of a subset of /mnt on piano:/dev/rwd0o
Label: none
Dump date: Wed Mar 13 15:29:39 2002
Dumped from: the epoch
2 .
112641 ./src
112644 ./src/ecartis-1.0.0
112645 ./src/ecartis-1.0.0/debian
112646 ./src/ecartis-1.0.0/debian/README.debian
112650 ./src/ecartis-1.0.0/debian/README.debian-source
112651 ./src/ecartis-1.0.0/debian/changelog
...
T'd vote for the entries' being stored starting from
./ecartis-1.0.0 rather than ./src/ecartis-1.0.0. Although
maybe this is too subjective to mess with...
Sorry this has turned out to be such a can of worms, and
thanks again for your attention.
Cheers, --Dave
From: Manuel Bouyer <bouyer@antioche.eu.org>
To: netbsd-current@dberg.net
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/15790
Date: Thu, 28 Mar 2002 23:58:26 +0100
Hi,
diffs have just been commited to the 1.5 branch. Can you check if the
new sources works for you ?
--
Manuel Bouyer <bouyer@antioche.eu.org>
--
State-Changed-From-To: feedback->closed
State-Changed-By: bouyer
State-Changed-When: Sun Apr 6 12:06:07 PDT 2003
State-Changed-Why:
No news sine 28 Mar. I guess this is fixed.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.