Return to BSD News archive
Newsgroups: comp.bugs.2bsd Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!zombie.ncsc.mil!news.mathworks.com!tank.news.pipex.net!pipex!in2.uu.net!spcuna!wlbr!sms From: sms@wlv.iipo.gtegsc.com (Steven M. Schultz) Subject: Standalone utilities bug (#272) Sender: news@wlbr.iipo.gtegsc.com (Steven M. Schultz) Organization: GTE Government Systems, Westlake Village Message-ID: <DDsuBt.9IB@wlbr.iipo.gtegsc.com> X-Nntp-Posting-Host: wlv.iipo.gtegsc.com Date: Thu, 24 Aug 1995 05:09:29 GMT Lines: 131 Subject: Standalone utilities bug (#272) Index: pdpstand/sys.c 2.11BSD Description: All of the standalone utilities (mkfs, restor, icheck) will incorrectly use the 0'th ('a') partition even if another one is specified. In the case of 'mkfs' or 'restor' this will corrupt or destroy the root filesystem. Repeat-By: You probably should take my word (or taylor@oswego.oswego.edu's word) for this. Using the standalone 'mkfs' with a device of "xp(0,3)" (to create a filesystem on /usr) created a 110mb root filesystem on the 'a' (0'th) partition. Fix: The problem was a lingering clear of the block offset to use by the standalone i/o system. Previous to disklabels being implemented this offset was always 0, i.e. _only_ the root filesystem could be manipulated by the standalone utilities. When label support was added that clear of i_boff should have been moved elsewhere. With the introduction of disklabels, several of the disk drivers (ra, rl, and xp) fetch the block offset of a partition from the label and thus the starting block offset should *not* be cleared. The clearing of 'i_boff' is still needed for those drivers which do not implement labels. Cut where indicated, saving to a file (/tmp/272), then: patch -p0 < /tmp/272 cd /sys/pdpstand make cp boot /boot If you keep bootable backup tapes handy it is highly recommended that they be recreated (current backups are a good idea anyway) so that up to date copies of the standalone programs are present. If this is not feasible at the present time then remember one thing: DO NOT SPECIFY a partition other than 0 when using the standalone programs. This has not been a problem in the past because there was no concept of partitions in the standalone programs - all they knew how to deal with was partition 0. Previous patches and updates are available via anonymous FTP to the system FTP.IIPO.GTEGSC.COM and are in the directory /pub/2.11BSD. ==============================cut here===================== *** /usr/src/sys/pdpstand/sys.c.old Mon Jun 12 21:17:02 1995 --- /usr/src/sys/pdpstand/sys.c Wed Aug 23 21:20:15 1995 *************** *** 3,9 **** * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)sys.c 2.2 (2.11BSD) 1995/06/08 */ #include "../h/param.h" --- 3,9 ---- * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * ! * @(#)sys.c 2.3 (2.11BSD) 1995/08/23 */ #include "../h/param.h" *************** *** 500,507 **** * The unit number must be less than 8. * * The partition number is also used to specify the tapefile to be loaded. ! * When loading a tapefile the filename' must not be specified. The partition ! * number must be less than 8. */ *cp++ = '('; --- 500,508 ---- * The unit number must be less than 8. * * The partition number is also used to specify the tapefile to be loaded. ! * When loading a tapefile the 'filename' must not be specified. The partition ! * number must be less than 8. This means that the number of standalone ! * programs is limited to 7. */ *cp++ = '('; *************** *** 558,564 **** file->i_flgs = 0; return(-1); } - file->i_boff = 0; /* tapes don't want this */ if (*cp == '\0') { file->i_flgs |= how+1; goto comret; --- 559,564 ---- *************** *** 665,670 **** --- 665,677 ---- if (csr == 0) return(-1); dp->dv_csr[ctlr] = (caddr_t *)csr; + /* + * Tapes don't need this. Disk drivers which support labels do not need + * this either but disk drivers which do not support labels _do_ need this. + * Doing it here is safe for everyone because label capable drivers will + * load i_boff from the label _after_ calling this routine. + */ + io->i_boff = 0; return(0); } *** /VERSION.old Mon Aug 21 22:14:22 1995 --- /VERSION Wed Aug 23 20:34:40 1995 *************** *** 1,4 **** ! Current Patch Level: 271 2.11 BSD ============ --- 1,4 ---- ! Current Patch Level: 272 2.11 BSD ============