NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/52724: ntfs driver doen't allow ':' in file names.



>Number:         52724
>Category:       kern
>Synopsis:       ntfs driver doen't allow ':' in file names.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 13 11:05:00 +0000 2017
>Originator:     trebol
>Release:        current
>Organization:
>Environment:
NetBSD npi 8.99.6 NetBSD 8.99.6 (RPI2) #2: Mon Nov 13 00:06:36 WET 2017  trebol@npi:/data/netbsd/src/sys/arch/evbarm/compile/obj/RPI2 evbarm
>Description:
In a POSIX environment, all unicode characters except '/' and '\0' must be allowed in file names of a ntfs file system.

The ntfs driver of NetBSD uses ':' for representing ntfs attributes, making impossible to properly read any file with ':' in its name.
>How-To-Repeat:
Write a file with ':' in its name using a POSIX OS without this problem, and try to read it in NetBSD with the kernel's ntfs driver.
>Fix:
The best solution in my opinion is to make a system utility for deal with ntfs attributes.

An invisible character, like ^G can be used instead of ':' to avoid problems with POSIX name space.

--- sys/fs/ntfs/ntfs_subr.c.orig        2017-11-12 11:44:53.152382608 +0000
+++ sys/fs/ntfs/ntfs_subr.c     2017-11-13 00:05:07.333116651 +0000
@@ -696,7 +696,7 @@
 }
 
 /*
- * Lookup attribute name in format: [[:$ATTR_TYPE]:$ATTR_NAME],
+ * Lookup attribute name in format: [['\a'$ATTR_TYPE]:$ATTR_NAME],
  * $ATTR_TYPE is searched in attrdefs read from $AttrDefs.
  * If $ATTR_TYPE not specified, ATTR_A_DATA assumed.
  */
@@ -782,14 +782,14 @@
        }
 
        /*
-        * Divide file name into: foofilefoofilefoofile[:attrspec]
+        * Divide file name into: foofilefoofilefoofile['\a'attrspec]
         * Store like this:       fname:fnamelen       [aname:anamelen]
         */
        fname = cnp->cn_nameptr;
        aname = NULL;
        anamelen = 0;
        for (fnamelen = 0; fnamelen < cnp->cn_namelen; fnamelen++)
-               if (fname[fnamelen] == ':') {
+               if (fname[fnamelen] == '\a') {
                        aname = fname + fnamelen + 1;
                        anamelen = cnp->cn_namelen - fnamelen - 1;
                        dprintf(("%s: %s (%d), attr: %s (%d)\n", __func__,



Home | Main Index | Thread Index | Old Index