[Bug 273723] bsdinstall breaking auto install after f66a8328c
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 273723] bsdinstall breaking auto install after f66a8328c"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 16 Oct 2023 19:53:36 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273723
--- Comment #5 from John Baldwin <jhb@FreeBSD.org> ---
Humm, I am not able to reproduce, at least with invoking bsdinstall directly.
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 = 0, len = 0;
for (i = 1; i < argc; i++)
len += strlen(argv[i]) + 1;
char inputbuf[len], *input = inputbuf;
strcpy(input, argv[1]);
for (i = 2; i < argc; i++) {
strcat(input, " ");
strcat(input, argv[i]);
}
while ((token = strsep(&input, ";")) != NULL) {
error = parse_disk_config(token);
if (error != 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 = 0;
fp = open_memstream(&input, &len);
fputs(argv[1], fp);
for (i = 2; i < argc; i++) {
fprintf(fp, " %s", argv[i]);
}
fclose(fp);
while ((token = strsep(&input, ";")) != NULL) {
error = parse_disk_config(token);
if (error != 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-ufs /
}
root@head:~ # gpart show md0
=> 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="YES"
PARTITIONS="md0"
#!/bin/sh
gpart show
mount
```
with `bsdinstall script ./testinstall`
and aborted it when it asked for a mirror to download the distributions from.
Afterwards, from gpart show (vtbd0 in this case is the real root of the VM):
```
root@head:~ # gpart show
=> 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)
=> 63 2097089 md0 MBR (1.0G)
63 1 - free - (512B)
64 2097088 1 freebsd (1.0G)
=> 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.
--
You are receiving this mail because:
You are the assignee for the bug.