From owner-freebsd-bugs Fri Jul 25 15:00:03 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id PAA27033 for bugs-outgoing; Fri, 25 Jul 1997 15:00:03 -0700 (PDT) Received: (from gnats@localhost) by hub.freebsd.org (8.8.5/8.8.5) id PAA27012; Fri, 25 Jul 1997 15:00:02 -0700 (PDT) Resent-Date: Fri, 25 Jul 1997 15:00:02 -0700 (PDT) Resent-Message-Id: <199707252200.PAA27012@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, jin@adv-pc-1.lbl.gov Received: from adv-pc-1.lbl.gov (adv-pc-1.lbl.gov [128.3.196.189]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id OAA26835 for ; Fri, 25 Jul 1997 14:56:17 -0700 (PDT) Received: (from jin@localhost) by adv-pc-1.lbl.gov (8.8.5/8.8.5) id OAA00641; Fri, 25 Jul 1997 14:56:15 -0700 (PDT) Message-Id: <199707252156.OAA00641@adv-pc-1.lbl.gov> Date: Fri, 25 Jul 1997 14:56:15 -0700 (PDT) From: "Jin Guojun[ITG]" Reply-To: jin@adv-pc-1.lbl.gov To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/4167: dump fials for dumping subdirectory Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Number: 4167 >Category: bin >Synopsis: dump fials for dumping subdirectory >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jul 25 15:00:01 PDT 1997 >Last-Modified: >Originator: Jin Guojun[ITG] >Organization: >Release: FreeBSD all-RELEASE i386 >Environment: all FreeBSD RELEASEs >Description: dump only dumps on the root of a file system. >How-To-Repeat: # uname -r 2.2.2-RELEASE # dump 0f - src DUMP: Date of this level 0 dump: Fri Jul 25 14:10:19 1997 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping src to standard output DUMP: bad sblock magic number DUMP: The ENTIRE dump is aborted. # dump 0f - /data/src | (cd /X/src ; restore xf -) DUMP: Date of this level 0 dump: Fri Jul 25 14:10:58 1997 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /data/src to standard output DUMP: bad sblock magic number DUMP: The ENTIRE dump is aborted. Tape is not a dump tape # dump 0f - /data | (cd /X/src ; restore xf -) DUMP: Date of this level 0 dump: Fri Jul 25 14:11:22 1997 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /dev/rsd0s2e (/data) to standard output DUMP: mapping (Pass I) [regular files] DUMP: mapping (Pass II) [directories] DUMP: estimated 408089 tape blocks. DUMP: dumping (Pass III) [directories] DUMP: dumping (Pass IV) [regular files] DUMP: 82.06% done, finished in 0:02 DUMP: DUMP: 408117 tape blocks DUMP: finished in 707 seconds, throughput 577 KBytes/sec DUMP: DUMP IS DONE set owner/mode for '.'? [yn] y # uname -r 3.0-970618-SNAP # dump 0f - /usr/src/sys | more DUMP: Date of this level 0 dump: Fri Jul 25 14:18:12 1997 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /usr/src/sys to standard output DUMP: bad sblock magic number DUMP: The ENTIRE dump is aborted. # dump 0f - /usr/src | more DUMP: Date of this level 0 dump: Fri Jul 25 14:18:25 1997 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /usr/src to standard output DUMP: bad sblock magic number DUMP: The ENTIRE dump is aborted. # dump 0f - /usr | more DUMP: Date of this level 0 dump: Fri Jul 25 14:23:32 1997 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /dev/rwd0s2e (/usr) to standard output DUMP: mapping (Pass I) [regular files] DUMP: mapping (Pass II) [directories] DUMP: estimated 358154 tape blocks. DUMP: dumping (Pass III) [directories] >Fix: ---------------- /usr/src/sbin/dump/main.c ---------- Line 337: if ((diskfd = open(disk, O_RDONLY)) < 0) { msg("Cannot open %s\n", disk); exit(X_ABORT); } sync(); sblock = (struct fs *)sblock_buf; bread(SBOFF, (char *) sblock, SBSIZE); if (sblock->fs_magic != FS_MAGIC) quit("bad sblock magic number\n"); Line 347: ... ----------------------- The variable "disk" on line 338 needs to be replaced as open(disk, ...) ==> open(get_rawdisk(disk), ...) by using following routines. -------------------- raw-dev.c ---------------------- #include "something may need" #include #include static subpath(full, sub) register char *full, *sub; { if (full && sub) { register int len = strlen(sub); return !strncmp(sub, full, len); } } char * get_rawdisk(name) char *name; { long mntsize, i; struct statfs *mntbuf; static char cwd[256]; mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); if (*name != '/' && cwd[0] == '\0') { if (!getwd(cwd)) { cwd[0] = 0; return 0; } name = cwd; } for (i=mntsize; i--;) if (!strcmp(mntbuf[i].f_mntonname, name) || subpath(name, mntbuf[i].f_mntonname)) { register char* cp=mntbuf[i].f_mntfromname; if (!strncmp(cp, "/dev/", 5)) bcopy(cp+5, cp+6, strlen(cp)-5), cp[5] = 'r'; return cp; } return (0); } ---------------- end of raw-dev.c ------------------------ Hopefully, this will not break other things. >Audit-Trail: >Unformatted: