Title [lDOS] FindFirst with device name and label attribute shouldn't find device
AuthorE. C. Masloch
Created2026-06-07 09:00:40 +0200 Jun Sun
State closed

FindFirst with the label attribute (mask 8) set should only ever find a volume label, even if a file, subdirectory, or character device matches the search name mask.

If the search name matched a character device name without wildcards, the first label search would find this character device.

Test program: NASM source text, executable, run as testfind.com A: to search for "CON" with attribute 8.

Reference: https://github.com/LoopZ/TheList/blob/fa803c25/source/Interrupt%20List/INT%2021%20DOS%20Function%20Calls/INT%20214E%20DOS%202%20FINDFIRST%20FIND%20FIRST%20MATCHING%20FILE.txt

E. C. Masloch on 2026-06-07 09:08:08 +0200 Jun Sun

Solution is to init Attrib from SAttrib before calling DEVNAME, so that it can correctly detect a label search. This is exactly what MS-DOS v5 does (determined by debugging). The fix was attempted in hg 713242bd5dc3 on 2026-05-19, but this patched the wrong branch of an %if FALSE construct. The fix was copied to apply to the correct code in hg ce4b8b95ae96 on 2026-05-25.