| From | Sent On | Attachments |
|---|---|---|
| Rick C. Petty | Dec 13, 2008 9:38 am | |
| Jaakko Heinonen | Dec 13, 2008 10:30 am | |
| Rick C. Petty | Dec 13, 2008 11:22 am | |
| Dag-Erling Smørgrav | Dec 15, 2008 9:04 am | |
| Rick C. Petty | Dec 15, 2008 3:47 pm | |
| Dag-Erling Smørgrav | Dec 16, 2008 5:29 am | |
| Rick C. Petty | Dec 16, 2008 12:10 pm | |
| Rick C. Petty | Jul 22, 2009 3:10 pm |
| Subject: | UFS label limitations | |
|---|---|---|
| From: | Rick C. Petty (rick...@kiwi-computer.com) | |
| Date: | Dec 13, 2008 9:38:28 am | |
| List: | org.freebsd.freebsd-fs | |
I always found it strange that when creating or changing a UFS label, you were restricted to alphanumeric characters. I really wanted some sort of separator, so I took a look at the code. Since the checks use isalnum(3) it is possible to create labels that are not 7-bit clean, depending upon your locale. After further investigation, I can't see any reason (in geom_label or otherwise) that the characters should be restricted in such a way.
I applied the attached (inline) patch and have had no troubles creating, editing, or mounting via UFS labels. The patch allows you to create labels with any characters except '/' (for obvious reasons) and should work with most locales (with the tiny exception that multibyte characters which use 0x2F in subsequent bytes should be rejected, since geom_label is locale-agnostic).
Would someone mind reviewing and committing this patch? Thank you,
-- Rick C. Petty
--- src/sbin/newfs/newfs.c.orig 2007-03-02 14:07:59.000000000 -0600 +++ src/sbin/newfs/newfs.c 2008-12-12 19:13:19.000000000 -0600 @@ -168,11 +168,10 @@ case 'L': volumelabel = optarg; i = -1; - while (isalnum(volumelabel[++i])); - if (volumelabel[i] != '\0') { - errx(1, "bad volume label. Valid characters are alphanumerics."); - } - if (strlen(volumelabel) >= MAXVOLLEN) { + while ((ch = volumelabel[++i]) != '\0') + if (ch == '/') + errx(1, "bad volume label. \"/\" not allowed."); + if (i >= MAXVOLLEN) { errx(1, "bad volume label. Length is longer than %d.", MAXVOLLEN); } --- src/sbin/tunefs/tunefs.c.orig 2008-02-26 14:25:35.000000000 -0600 +++ src/sbin/tunefs/tunefs.c 2008-12-12 19:19:33.000000000 -0600 @@ -153,13 +153,12 @@ name = "volume label"; Lvalue = optarg; i = -1; - while (isalnum(Lvalue[++i])); - if (Lvalue[i] != '\0') { + while ((ch = Lvalue[++i]) != '\0') + if (ch == '/') errx(10, - "bad %s. Valid characters are alphanumerics.", + "bad %s. \"/\" not allowed.", name); - } - if (strlen(Lvalue) >= MAXVOLLEN) { + if (i >= MAXVOLLEN) { errx(10, "bad %s. Length is longer than %d.", name, MAXVOLLEN - 1); }
_______________________________________________ free...@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-fs To unsubscribe, send any mail to "free...@freebsd.org"





