[Bug 294093] bsdconfig(8): Sort devices naturally (numerically), not lexicographically

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 28 Mar 2026 16:06:23 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294093

            Bug ID: 294093
           Summary: bsdconfig(8): Sort devices naturally (numerically),
                    not lexicographically
           Product: Base System
           Version: 16.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: michaelo@FreeBSD.org

Installed a new machine via SOL yesterday and the installer gave me this
listing:

┌──────ZFS Configuration────────┐
│ Select a disk device          │
│ ┌───────────────────────────┐ │
│ │ da0   SEAGATE ST9300653SS │ │
│ │ da1   SEAGATE ST9900805SS │ │
│ │ da10  SEAGATE ST9900805SS │ │
│ │ da11  SEAGATE ST9300605SS │ │
│ │ da12  Generic Flash Disk  │ │
│ │ da2   SEAGATE ST9900805SS │ │
│ │ da3   SEAGATE ST9300605SS │ │
│ │ da4   SEAGATE ST9900805SS │ │
│ │ da5   SEAGATE ST9300653SS │ │
│ │ da6   SEAGATE ST9900805SS │ │
│ │ da7   SEAGATE ST9900805SS │ │
│ │ da8   SEAGATE ST9900805SS │ │
│ │ da9   SEAGATE ST9900805SS │ │
│ └───────────────────────────┘ │
├───────────────────────────────┤
│     <  OK  >   < Back >       │
└───────────────────────────────┘

The device sort order is awkward from a user's PoV, the sort order should be
naturally:

┌──────ZFS Configuration────────┐
│ Select a disk device          │
│ ┌───────────────────────────┐ │
│ │ da0   SEAGATE ST9300653SS │ │
│ │ da1   SEAGATE ST9900805SS │ │
│ │ da2   SEAGATE ST9900805SS │ │
│ │ da3   SEAGATE ST9300605SS │ │
│ │ da4   SEAGATE ST9900805SS │ │
│ │ da5   SEAGATE ST9300653SS │ │
│ │ da6   SEAGATE ST9900805SS │ │
│ │ da7   SEAGATE ST9900805SS │ │
│ │ da8   SEAGATE ST9900805SS │ │
│ │ da9   SEAGATE ST9900805SS │ │
│ │ da10  SEAGATE ST9900805SS │ │
│ │ da11  SEAGATE ST9300605SS │ │
│ │ da12  Generic Flash Disk  │ │
│ └───────────────────────────┘ │
├───────────────────────────────┤
│     <  OK  >   < Back >       │
└───────────────────────────────┘

The code is in ./usr.sbin/bsdconfig/share/device.subr: f_device_sort_by_awk,
function _asorti()

camcontrol(8) output is naturally sorted:
# camcontrol devlist
<SEAGATE ST9300653SS 5301>         at scbus1 target 4 lun 0 (pass0,da0)
<SEAGATE ST9900805SS 5101>         at scbus1 target 5 lun 0 (pass1,da1)
<SEAGATE ST9900805SS 5101>         at scbus1 target 6 lun 0 (pass2,da2)
<SEAGATE ST9300605SS 5101>         at scbus1 target 7 lun 0 (pass3,da3)
<SEAGATE ST9900805SS 5101>         at scbus1 target 8 lun 0 (pass4,da4)
<SEAGATE ST9300653SS 5301>         at scbus1 target 9 lun 0 (pass5,da5)
<SEAGATE ST9900805SS 5101>         at scbus1 target 10 lun 0 (pass6,da6)
<SEAGATE ST9900805SS 5101>         at scbus1 target 11 lun 0 (pass7,da7)
<SEAGATE ST9900805SS 5101>         at scbus1 target 12 lun 0 (pass8,da8)
<SEAGATE ST9900805SS 5101>         at scbus1 target 13 lun 0 (pass9,da9)
<SEAGATE ST9900805SS 5101>         at scbus1 target 14 lun 0 (pass10,da10)
<SEAGATE ST9300605SS 5101>         at scbus1 target 15 lun 0 (pass11,da11)
<AHCI SGPIO Enclosure 2.00 0001>   at scbus4 target 0 lun 0 (ses0,pass12)
<Generic Flash Disk 8.07>          at scbus5 target 0 lun 0 (da12,pass13)

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