Package: dosfstools
Version: 3.0.6-1
Severity: important
Tags: patch

dosfsck in interactive mode complains about bad file name when it finds
a direntry with 7 or more characters with codes > 127. This is wrong:
filenames containing such characters are valid (at least in MSDOS,
Windows and Linux), but they can be interpreted differently depending
on the local codepage (CP437, CP866, etc.)

Another problem is a misleading error message: dosfsck thinks that short
filename is wrong, but shows a long filename.

Patches are attached.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.33.2 (SMP w/2 CPU cores)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages dosfstools depends on:
ii  libc6                         2.10.1-5   GNU C Library: Shared libraries

dosfstools recommends no packages.

dosfstools suggests no packages.

-- debconf-show failed
commit 8577de60c50c774cf12b2c4311e2cfce67e13bd2
Author: Alexander Korolkov <alexander.korol...@gmail.com>
Date:   Sun Sep 5 16:57:21 2010 +0400

    dosfsck: don't complain about bad filenames when short filename contains 7 or more characters with codes 128-255

diff --git a/src/check.c b/src/check.c
index 01f34ab..8da13c5 100644
--- a/src/check.c
+++ b/src/check.c
@@ -339,11 +339,10 @@ static int bad_name(DOS_FILE *file)
     if (atari_format && suspicious)
 	return 1;
 
-    /* Only complain about too much suspicious chars in interactive mode,
-     * never correct them automatically. The chars are all basically ok, so we
-     * shouldn't auto-correct such names. */
-    if (interactive && suspicious > 6)
-	return 1;
+    /* Under MS-DOS and Windows, chars >= 128 in short names are valid
+     * (but these characters can be visualised differently depending on
+     * local codepage: CP437, CP866, etc). The chars are all basically ok,
+     * so we shouldn't auto-correct such names. */
     return 0;
 }
 
commit 1db5fc9a4c39103c6d7297714b3ac08e8c861741
Author: Alexander Korolkov <alexander.korol...@gmail.com>
Date:   Sun Sep 5 17:15:15 2010 +0400

    If the test of short filename fails, dosfsck could complain about bad long 
filename

diff --git a/src/check.c b/src/check.c
index 0378da5..2a71b1b 100644
--- a/src/check.c
+++ b/src/check.c
@@ -629,7 +629,8 @@ static int check_dir(DOS_FS *fs,DOS_FILE **root,int dots)
        }
        if (!((*walk)->dir_ent.attr & ATTR_VOLUME) &&
            bad_name(*walk)) {
-           printf("%s\n  Bad file name.\n",path_name(*walk));
+           puts(path_name(*walk));
+           printf("  Bad short file name (%s).\n", 
file_name((*walk)->dir_ent.name));
            if (interactive)
                printf("1) Drop file\n2) Rename file\n3) Auto-rename\n"
                  "4) Keep it\n");

Reply via email to