From owner-svn-src-head@freebsd.org Thu Dec 28 01:21:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46A31E8C40C; Thu, 28 Dec 2017 01:21:32 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10A3F1E2E; Thu, 28 Dec 2017 01:21:31 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBS1LV7i016905; Thu, 28 Dec 2017 01:21:31 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBS1LVds016904; Thu, 28 Dec 2017 01:21:31 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201712280121.vBS1LVds016904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Thu, 28 Dec 2017 01:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327258 - head/usr.sbin/bsdinstall/partedit X-SVN-Group: head X-SVN-Commit-Author: nwhitehorn X-SVN-Commit-Paths: head/usr.sbin/bsdinstall/partedit X-SVN-Commit-Revision: 327258 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Dec 2017 01:21:32 -0000 Author: nwhitehorn Date: Thu Dec 28 01:21:30 2017 New Revision: 327258 URL: https://svnweb.freebsd.org/changeset/base/327258 Log: Fix bug introduced in r326674, in which efi boot partitions created by the installer but not mounted (i.e. with boot1.efifat dd'ed to them rather than the forthcoming proper filesystem) would get newfs_msdos run on them immediately after the boot code was copied. This would overwrite the bootstrap code, causing the EFI system partition to be blanked and resulting in an unbootable system. PR: 224562 Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- head/usr.sbin/bsdinstall/partedit/gpart_ops.c Thu Dec 28 01:20:30 2017 (r327257) +++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c Thu Dec 28 01:21:30 2017 (r327258) @@ -942,7 +942,9 @@ add_boot_partition(struct ggeom *geom, struct gprovide choice = 0; if (choice == 0) { /* yes */ + struct partition_metadata *md; const char *bootmount = NULL; + char *bootpartname = NULL; char sizestr[7]; humanize_number(sizestr, 7, @@ -950,7 +952,21 @@ add_boot_partition(struct ggeom *geom, struct gprovide HN_NOSPACE | HN_DECIMAL); gpart_create(pp, bootpart_type(scheme, &bootmount), - sizestr, bootmount, NULL, 0); + sizestr, bootmount, &bootpartname, 0); + + if (bootpartname == NULL) /* Error reported to user already */ + return 0; + + /* If the part is not mountable, make sure newfs isn't set */ + if (bootmount == NULL) { + md = get_part_metadata(bootpartname, 0); + if (md != NULL && md->newfs != NULL) { + free(md->newfs); + md->newfs = NULL; + } + } + + free(bootpartname); return (bootpart_size(scheme)); }