Plan 9 from Bell Labs’s /usr/web/sources/patch/applied/boot-devsd-probe/readme
The code to walk through the list of discovered devices updates the index of the first device (sdev) when it should be updating the index of the currect device (tail).