Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Oct 2023 19:53:36 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 273723] bsdinstall breaking auto install after f66a8328c
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/>

next in thread | previous in thread | raw e-mail | index | archive | help
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.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-273723-227-sFSqsCFFVt>