diff -Naur a/manpages/fatlabel.8.in b/manpages/fatlabel.8.in
--- a/manpages/fatlabel.8.in 2021-01-31 04:49:12.000000000 -0800
+++ b/manpages/fatlabel.8.in 2022-10-20 10:39:36.449439626 -0700
@@ -51,6 +51,8 @@
.IP "\fB-c\fP \fIPAGE\fP, \fB\-\-codepage\fP=\fIPAGE\fP" 4
Use DOS codepage \fIPAGE\fP to encode/decode label.
By default codepage 850 is used.
+.IP "\fB\-\-skip-name-validation\fP" 4
+Do not validate filesystem label.
.IP "\fB\-h\fP, \fB\-\-help\fP" 4
Display a help message and terminate.
.IP "\fB\-V\fP, \fB\-\-version\fP" 4
diff -Naur a/manpages/mkfs.fat.8.in b/manpages/mkfs.fat.8.in
--- a/manpages/mkfs.fat.8.in 2021-01-31 04:49:12.000000000 -0800
+++ b/manpages/mkfs.fat.8.in 2022-10-20 10:39:36.449439626 -0700
@@ -218,6 +218,8 @@
Multiple runs of \fBmkfs.fat\fP on the same device create identical results
with this option.
Its main purpose is testing \fBmkfs.fat\fP.
+.IP "\fB\-\-skip-name-validation\fP" 4
+Do not validate filesystem label.
.\" ----------------------------------------------------------------------------
.SH BUGS
\fBmkfs.fat\fP can not create boot-able filesystems.
diff -Naur a/src/common.c b/src/common.c
--- a/src/common.c 2021-01-31 04:49:12.000000000 -0800
+++ b/src/common.c 2022-10-20 10:39:36.450439587 -0700
@@ -42,6 +42,7 @@
int interactive;
int write_immed;
int atari_format;
+int skip_name_validation;
const char *program_name;
@@ -327,6 +328,9 @@
int ret = 0;
wchar_t wlabel[12];
+ if (skip_name_validation)
+ return 0;
+
if (dos_string_to_wchar_string(wlabel, doslabel, sizeof(wlabel))) {
for (i = 0; wlabel[i]; i++) {
/* FAT specification: Lower case characters are not allowed in DIR_Name
diff -Naur a/src/common.h b/src/common.h
--- a/src/common.h 2021-01-31 04:49:12.000000000 -0800
+++ b/src/common.h 2022-10-20 10:39:36.450439587 -0700
@@ -35,6 +35,7 @@
extern int interactive;
extern int write_immed;
extern int atari_format; /* Use Atari variation of MS-DOS FS format */
+extern int skip_name_validation;
/* program_name used for printing messages; no name will be printed when it is
* left as NULL */
diff -Naur a/src/fatlabel.c b/src/fatlabel.c
--- a/src/fatlabel.c 2021-01-31 04:49:12.000000000 -0800
+++ b/src/fatlabel.c 2022-10-20 10:39:36.451439549 -0700
@@ -195,21 +195,24 @@
fprintf(f, "existing label or serial if NEW is not given.\n");
fprintf(f, "\n");
fprintf(f, "Options:\n");
- fprintf(f, " -i, --volume-id Work on serial number instead of label\n");
- fprintf(f, " -r, --reset Remove label or generate new serial number\n");
- fprintf(f, " -c N, --codepage=N use DOS codepage N to encode/decode label (default: %d)\n", DEFAULT_DOS_CODEPAGE);
- fprintf(f, " -V, --version Show version number and terminate\n");
- fprintf(f, " -h, --help Print this message and terminate\n");
+ fprintf(f, " -i, --volume-id Work on serial number instead of label\n");
+ fprintf(f, " -r, --reset Remove label or generate new serial number\n");
+ fprintf(f, " -c N, --codepage=N use DOS codepage N to encode/decode label (default: %d)\n", DEFAULT_DOS_CODEPAGE);
+ fprintf(f, " --skip-name-validation Do not validate filesystem label\n");
+ fprintf(f, " -V, --version Show version number and terminate\n");
+ fprintf(f, " -h, --help Print this message and terminate\n");
exit(status);
}
int main(int argc, char *argv[])
{
+ enum {OPT_SKIP_NAME_VALIDATION=1000};
const struct option long_options[] = {
{"volume-id", no_argument, NULL, 'i'},
{"reset", no_argument, NULL, 'r'},
{"codepage", required_argument, NULL, 'c'},
+ {"skip-name-validation", optional_argument, NULL, OPT_SKIP_NAME_VALIDATION},
{"version", no_argument, NULL, 'V'},
{"help", no_argument, NULL, 'h'},
{0,}
@@ -246,6 +249,10 @@
usage(1, 0);
break;
+ case OPT_SKIP_NAME_VALIDATION:
+ skip_name_validation = 1;
+ break;
+
case 'V':
printf("fatlabel " VERSION " (" VERSION_DATE ")\n");
exit(0);
diff -Naur a/src/mkfs.fat.c b/src/mkfs.fat.c
--- a/src/mkfs.fat.c 2021-01-31 04:49:12.000000000 -0800
+++ b/src/mkfs.fat.c 2022-10-20 10:41:34.018323059 -0700
@@ -1454,6 +1454,7 @@
fprintf(stderr, " -S SIZE Select a sector size of SIZE (a power of two, at least 512)\n");
fprintf(stderr, " -v Verbose execution\n");
fprintf(stderr, " --variant=TYPE Select variant TYPE of filesystem (standard or Atari)\n");
+ fprintf(stderr, " --skip-name-validation Do not validate filesystem label\n");
fprintf(stderr, "\n");
fprintf(stderr, " --invariant Use constants for randomly generated or time based values\n");
fprintf(stderr, " --offset=SECTOR Write the filesystem at a specific sector into the device file.\n");
@@ -1478,14 +1479,15 @@
struct timeval create_timeval;
long long conversion;
- enum {OPT_HELP=1000, OPT_INVARIANT, OPT_MBR, OPT_VARIANT, OPT_CODEPAGE, OPT_OFFSET};
+ enum {OPT_HELP=1000, OPT_INVARIANT, OPT_MBR, OPT_VARIANT, OPT_CODEPAGE, OPT_OFFSET, OPT_SKIP_NAME_VALIDATION};
const struct option long_options[] = {
- {"codepage", required_argument, NULL, OPT_CODEPAGE},
- {"invariant", no_argument, NULL, OPT_INVARIANT},
- {"mbr", optional_argument, NULL, OPT_MBR},
- {"variant", required_argument, NULL, OPT_VARIANT},
- {"offset", required_argument, NULL, OPT_OFFSET},
- {"help", no_argument, NULL, OPT_HELP},
+ {"codepage", required_argument, NULL, OPT_CODEPAGE},
+ {"invariant", no_argument, NULL, OPT_INVARIANT},
+ {"mbr", optional_argument, NULL, OPT_MBR},
+ {"variant", required_argument, NULL, OPT_VARIANT},
+ {"offset", required_argument, NULL, OPT_OFFSET},
+ {"skip-name-validation", optional_argument, NULL, OPT_SKIP_NAME_VALIDATION},
+ {"help", no_argument, NULL, OPT_HELP},
{0,}
};
@@ -1813,6 +1815,10 @@
part_sector = (off_t) conversion;
break;
+ case OPT_SKIP_NAME_VALIDATION:
+ skip_name_validation = 1;
+ break;
+
case '?':
usage(argv[0], 1);
exit(1);