From nobody Mon Oct 16 19:53:36 2023
X-Original-To: bugs@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S8STr4Ccxz4xkVc
	for <bugs@mlmmj.nyi.freebsd.org>; Mon, 16 Oct 2023 19:53:36 +0000 (UTC)
	(envelope-from bugzilla-noreply@freebsd.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4S8STr2xqZz4H2L
	for <bugs@FreeBSD.org>; Mon, 16 Oct 2023 19:53:36 +0000 (UTC)
	(envelope-from bugzilla-noreply@freebsd.org)
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697486016; a=rsa-sha256; cv=none;
	b=pqux1YMz/+LqoiNXsTFSNzMXuJJ7i7NfrJMJT0gZc7xU980q96s+GGlj0QSc9SRTVCmdtF
	R/tyB5LwPm/X1K5fBhDBfOuLz94qzRIEIZtBbipHf67zMXbcImLqRZRqdyAYZ84zb2YgYZ
	e/mMpvaCc0Il2XwvyV570+Vg1zLqz5+9PpJSgP9EllzuyqlpF87Ljoc7Gx6rSK+PwT7FLx
	57JQsM6VGBqbbPmbbz+zKlC6IFnhmU4CPSx5ChwCw7ZKRwzoxPzI9g/nRuoPyFbRLGHyjW
	U73QMNXHL2CE7tOiAPBM1rduixnkCqAby7Vw/Yo3zm19QpaTxrXXD1mn/7TqMA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1697486016;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=DhQO8cRIb01gC5KdQDDJ/RoNqmtMPXZ7PhgVL0KVuWk=;
	b=bSLLJxGJN8meK76otUwp8r4B/DeJ/Ztx+RwBsHsU5unJLhs5OUP9+3utUtFfQlUsgbnM09
	VdVLheCiSkMxo+kYO0dxWSKUKmOrQq9lrMtKV/6r6sYhhUhcpCB+8Cf6/vBpW83WSveHY+
	9tYp+LhN5C93EeM2p38jhEotEfo3SaHqBys44zKkqgEEDZgr3mFgA/7aee9PVPyU1htsSn
	RhHgMeuPiqysGFVSrkTweN3TFbJRPjrt14X9+66w1q751S0K+ApAIGc9MIiK2e6+LR1KHu
	U62FC3bPmyRF/d96iRo9n4V4/W4S/uSPyDp2MMaGCq24YOqT5lPMMK25lz7+jQ==
Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S8STr21HDztWB
	for <bugs@FreeBSD.org>; Mon, 16 Oct 2023 19:53:36 +0000 (UTC)
	(envelope-from bugzilla-noreply@freebsd.org)
Received: from kenobi.freebsd.org ([127.0.1.5])
	by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 39GJra4M037612
	for <bugs@FreeBSD.org>; Mon, 16 Oct 2023 19:53:36 GMT
	(envelope-from bugzilla-noreply@freebsd.org)
Received: (from www@localhost)
	by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 39GJraIt037611
	for bugs@FreeBSD.org; Mon, 16 Oct 2023 19:53:36 GMT
	(envelope-from bugzilla-noreply@freebsd.org)
X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f
From: bugzilla-noreply@freebsd.org
To: bugs@FreeBSD.org
Subject: [Bug 273723] bsdinstall breaking auto install after f66a8328c
Date: Mon, 16 Oct 2023 19:53:36 +0000
X-Bugzilla-Reason: AssignedTo
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: Base System
X-Bugzilla-Component: bin
X-Bugzilla-Version: 14.0-STABLE
X-Bugzilla-Keywords: install, regression
X-Bugzilla-Severity: Affects Only Me
X-Bugzilla-Who: jhb@FreeBSD.org
X-Bugzilla-Status: Open
X-Bugzilla-Resolution: 
X-Bugzilla-Priority: ---
X-Bugzilla-Assigned-To: bugs@FreeBSD.org
X-Bugzilla-Flags: 
X-Bugzilla-Changed-Fields: 
Message-ID: <bug-273723-227-sFSqsCFFVt@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-273723-227@https.bugs.freebsd.org/bugzilla/>
References: <bug-273723-227@https.bugs.freebsd.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/
Auto-Submitted: auto-generated
List-Id: Bug reports <freebsd-bugs.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/freebsd-bugs
List-Help: <mailto:freebsd-bugs+help@freebsd.org>
List-Post: <mailto:freebsd-bugs@freebsd.org>
List-Subscribe: <mailto:freebsd-bugs+subscribe@freebsd.org>
List-Unsubscribe: <mailto:freebsd-bugs+unsubscribe@freebsd.org>
Sender: owner-freebsd-bugs@freebsd.org
MIME-Version: 1.0

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D273723

--- Comment #5 from John Baldwin <jhb@FreeBSD.org> ---
Humm, I am not able to reproduce, at least with invoking bsdinstall directl=
y.

I first wrote a test program with both parsers:

```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static int
parse_disk_config(const char *token)
{
        printf("token: \"%s\"\n", token);
        return (0);
}

static int
old_editor(int argc, const char **argv)
{
        char *token;
        int i, error =3D 0, len =3D 0;

        for (i =3D 1; i < argc; i++)
                len +=3D strlen(argv[i]) + 1;
        char inputbuf[len], *input =3D inputbuf;
        strcpy(input, argv[1]);
        for (i =3D 2; i < argc; i++) {
                strcat(input, " ");
                strcat(input, argv[i]);
        }

        while ((token =3D strsep(&input, ";")) !=3D NULL) {
                error =3D parse_disk_config(token);
                if (error !=3D 0)
                        return (error);
        }

        return (0);

}

static int
new_editor(int argc, const char **argv)
{
        FILE *fp;
        char *input, *token;
        size_t len;
        int i, error =3D 0;

        fp =3D open_memstream(&input, &len);
        fputs(argv[1], fp);
        for (i =3D 2; i < argc; i++) {
                fprintf(fp, " %s", argv[i]);
        }
        fclose(fp);

        while ((token =3D strsep(&input, ";")) !=3D NULL) {
                error =3D parse_disk_config(token);
                if (error !=3D 0) {
                        free(input);
                        return (error);
                }
        }
        free(input);

        return (0);

}

int
main(int ac, const char **av)
{
        printf("old:\n");
        old_editor(ac, av);
        printf("new:\n");
        new_editor(ac, av);
        return (0);
}
```

And it invokes parse_disk_config with the same string in both cases:

```
> ./test "vtbd0 GPT { auto freebsd-ufs / }"
old:
token: "vtbd0 GPT { auto freebsd-ufs / }"
new:
token: "vtbd0 GPT { auto freebsd-ufs / }"
> ./test vtbd0 GPT { auto freebsd-ufs / }
old:
token: "vtbd0 GPT { auto freebsd-ufs / }"
new:
token: "vtbd0 GPT { auto freebsd-ufs / }"
```

I then ran this in a VM:

```
root@head:~ # mdconfig -a -t malloc -s 1g
md0
root@head:~ # /usr/libexec/bsdinstall/scriptedpart md0 GPT { auto freebsd-u=
fs /
}
root@head:~ # gpart show md0
=3D>     40  2097072  md0  GPT  (1.0G)
       40     1024    1  freebsd-boot  (512K)
     1064  2096048    2  freebsd-ufs  (1.0G)
```

I also tried running `bsdinstall scriptedpart md0 GPT { auto freebsd-ufs / =
}`
and it worked just as well.

Re: ZFS, ZFS doesn't use "scriptedpart":

>From usr.sbin/bsdinstall/scripts/script:

```
# Make partitions
rm -f $PATH_FSTAB
touch $PATH_FSTAB
if [ "$ZFSBOOT_DISKS" ]; then
        bsdinstall zfsboot
else
        bsdinstall scriptedpart "$PARTITIONS"
fi
bsdinstall mount
```

I also tried this simple config file:

```
export nonInteractive=3D"YES"

PARTITIONS=3D"md0"

#!/bin/sh

gpart show
mount
```

with `bsdinstall script ./testinstall`

and aborted it when it asked for a mirror to download the distributions fro=
m.=20
Afterwards, from gpart show (vtbd0 in this case is the real root of the VM):

```
root@head:~ # gpart show
=3D>      34  75497398  vtbd0  GPT  (36G)
        34       128      1  freebsd-boot  (64K)
       162  72560446      2  freebsd-ufs  (35G)
  72560608   2936816      3  freebsd-swap  (1.4G)
  75497424         8         - free -  (4.0K)

=3D>     63  2097089  md0  MBR  (1.0G)
       63        1       - free -  (512B)
       64  2097088    1  freebsd  (1.0G)

=3D>      0  2097088  md0s1  BSD  (1.0G)
        0  1990656      1  freebsd-ufs  (972M)
  1990656   104448      2  freebsd-swap  (51M)
  2095104     1984         - free -  (992K)

```

This was all tested on

commit edd2a9b887864d07ac5af480b4b8f35cb76443f6 (HEAD -> main, origin/main)
Author: John Baldwin <jhb@FreeBSD.org>
Date:   Fri Oct 13 12:26:58 2023 -0700

    bhyve ahci: Replace WPRINTF with EPRINTLN

    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D42181

I'll see if I can't reproduce with an install image.

--=20
You are receiving this mail because:
You are the assignee for the bug.=