If you attempt to concatenate two fonts.scale files by simply appending one to the other, e.g., if you merge two font directories, mkfontdir won't detect the resulting corruption (i.e., you've got two count lines in the file, both of which are wrong, rather than one count line at the top with the total count in it). I'll attach a patch which fixes this problem as well as fixing a security hole -- the code was previously using fscanf into strings without specifying the size of the strings.
Created attachment 24527 [details] Fix mkfontdir fonts.scale parsing
*** Bug 49658 has been marked as a duplicate of this bug. ***
This bug is not a critical bug, so I'd prefer if you sent the fix upstream so that someone more familiar with the code could eyeball it for correctness. I notice you're using sprintf, which is notorious for buffer overflows, string format bugs, etc.. I dunno if there are any, but I'd rather see it eyeballed upstream. Submit fix to: fixes Thanks jik.