Date: Fri, 5 Sep 1997 14:07:33 -0600 (MDT) From: Brandon Gillespie <brandon@roguetrader.com> To: freebsd-hackers@freebsd.org Subject: disklabel bugs/fixes Message-ID: <Pine.BSF.3.96.970905135420.7652A-100000@roguetrader.com>
next in thread | raw e-mail | index | archive | help
I've noticed the following problems in disklabel, in regard to parsing the fstype in a partition specification. I have some suggested fixes, and can make them myself, unless somebody else is actively working on disklabel. 1) it grabs the next 'word' when identifying the fstype, this is wrong in the case of fstypes with spaces in them, in 'fstypenames', this includes: "Version 6", "Version 7", "System V", "Eighth Edition", Suggested Solution: when formatting the 'disklabel' strip spaces from the type names in the table, before they are printed (thus "System V" becomes "SystemV"), and when parsing strip spaces before a comparison is made. AND/OR allow quoting of fstype as a name. 2) If the fstype does not match any names, and the word begins with a digit, disklabel runs atoi() and accepts the output as the fstype. This is wrong, in the case of a mistype '4.!BSD' or something similar will be translated to a SystemV fstype because atoi("4.!BSD") => 4 => SystemV fstype. Suggested Solution: use strtol(), verify that the ending character is the end of the word, if not set fstype to FS_UNUSED and print an error message (as it would if the fstype is unrecognized). I would also like to cruft up the error message, when the fstype is unrecognized, to have it list all of the valid fstype names and relative token numbers. -Brandon Gillespie
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.970905135420.7652A-100000>