[Bug 274513] bsdinstall(8): Can't disable forcing of 4k sectors with ZFS pool using scripted install

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 16 Oct 2023 13:36:32 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274513

            Bug ID: 274513
           Summary: bsdinstall(8): Can't disable forcing of 4k sectors
                    with ZFS pool using scripted install
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: bugs.freebsd.org@a12l.xyz

Context
=======

I'm trying to write my own `installconfig` script to make it easier to install
FreeBSD 14 on my desktop machines. From what I understand, modern SSD drives
have 8k physical sectors. Therefore I want to use 8k sectors for my ZFS pool.

I've added `-o ashift=13` to `$ZFSBOOT_POOL_CREATE_OPTIONS`. I now want to
disable the forcing of 4k sectors to avoid problems with contradicting
settings.

Expected Behavior
=================

I only need to set `$ZFSBOOT_FORCE_4K_SECTORS` to some specific value, so that
the condition `[ "$ZFSBOOT_FORCE_4K_SECTORS" ]` evaluates to false.

Actual Behavior
===============

On line 833 in `//usr.sbin/bsdinstall/scripts/zfsboot` we have the if-statement

        if [ "$ZFSBOOT_FORCE_4K_SECTORS" ];

From what I understand, it's only with the empty string argument that the
`test` builtin evaluates to false. I.e., for this condition to be evaluated to
`false` requires `$ZFSBOOT_FORCE_4K_SECTORS` to be equal to the empty string.

But on line 74 in the above mentioned file we have

        : ${ZFSBOOT_FORCE_4K_SECTORS:=1}

From what I've understood from what I've read and tested, I conclude that this
line will bind `ZFSBOOT_FORCE_4K_SECTORS=1` if `ZFSBOOT_FORCE_4K_SECTORS` is
unset or equal to the empty string.

Therefore, I conclude that it's currently impossible to disable this option.
Have I missed something, or is this a bug?

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