2009-06-25 20:06:23

by OGAWA Hirofumi

[permalink] [raw]
Subject: [RFC] vfat: change the default from shortname=lower to shortname=mixed

Hi,

I was asked like the following sometimes,

Why is shortname=lower the default mount option for vfat filesystems?
Because, with "shortname=lower", copying one FAT filesystem tree to
another FAT filesystem tree using Liux results in semantically
different filesystems. (E.g.: Filenames which were once "all
uppercase" are now "all lowercase").

And from recently email

http://bugs.debian.org/476903
http://bugs.debian.org/497121
http://bugzilla.gnome.org/554031
https://bugs.launchpad.net/ubuntu/+bug/290362


My usual answer for it is, personally I agree that "winnt" or "mixed"
is proper. However, it is long-standing default behavior. Um...

But, now, situation would not be same with long past (didn't have
shortname= option).

Well, so, what do you think about changing the default of vfat from
"shortname=lower" to "shortname=mixed"? If default was changed, the
shortname (8.3) will not changed to lower case to show. And if possible,
it will try to preserve created shortname.

Thanks.
--
OGAWA Hirofumi <[email protected]>


This causes Linux and Windows to display filenames the same.

Signed-off-by: Paul Wise <[email protected]>

Documentation/filesystems/vfat.txt | 2 +-
fs/fat/inode.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/filesystems/vfat.txt b/Documentation/filesystems/vfat.txt
index b58b84b..eed520f 100644
--- a/Documentation/filesystems/vfat.txt
+++ b/Documentation/filesystems/vfat.txt
@@ -102,7 +102,7 @@ shortname=lower|win95|winnt|mixed
winnt: emulate the Windows NT rule for display/create.
mixed: emulate the Windows NT rule for display,
emulate the Windows 95 rule for create.
- Default setting is `lower'.
+ Default setting is `mixed'.

tz=UTC -- Interpret timestamps as UTC rather than local time.
This option disables the conversion of timestamps
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 8970d8c..f9af501 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -971,7 +971,7 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug,
opts->codepage = fat_default_codepage;
opts->iocharset = fat_default_iocharset;
if (is_vfat) {
- opts->shortname = VFAT_SFN_DISPLAY_LOWER|VFAT_SFN_CREATE_WIN95;
+ opts->shortname = VFAT_SFN_DISPLAY_WINNT|VFAT_SFN_CREATE_WIN95;
opts->rodir = 0;
} else {
opts->shortname = 0;
--
1.6.3.1


2009-06-30 03:23:08

by Jamie Lokier

[permalink] [raw]
Subject: Re: [RFC] vfat: change the default from shortname=lower to shortname=mixed

OGAWA Hirofumi wrote:
> Hi,
>
> I was asked like the following sometimes,
>
> Why is shortname=lower the default mount option for vfat filesystems?
> Because, with "shortname=lower", copying one FAT filesystem tree to
> another FAT filesystem tree using Liux results in semantically
> different filesystems. (E.g.: Filenames which were once "all
> uppercase" are now "all lowercase").
>
> And from recently email
>
> http://bugs.debian.org/476903
> http://bugs.debian.org/497121
> http://bugzilla.gnome.org/554031
> https://bugs.launchpad.net/ubuntu/+bug/290362
>
> My usual answer for it is, personally I agree that "winnt" or "mixed"
> is proper. However, it is long-standing default behavior. Um...
>
> But, now, situation would not be same with long past (didn't have
> shortname= option).
>
> Well, so, what do you think about changing the default of vfat from
> "shortname=lower" to "shortname=mixed"? If default was changed, the
> shortname (8.3) will not changed to lower case to show. And if possible,
> it will try to preserve created shortname.

I agree with the change to "shortname=mixed" being the default.

Not only does it solve problems with Linux seeing files it created
_itself_ change, "shortname=mixed" is the only option where files
created on all versions of Windows appear the same in Linux, and vice
versa. It is better than Windows itself in that respect...

"shortname=winnt" is not as good. It solves the problem of
Linux<->itself compatibility and Linux<->Windows-NT/2000/XP/Vista
compatibility, but not Linux<->Windows-95/98/ME compatibility.

I don't see any problems with changing the option from it's default,
for filesystems which were written as VFAT by any OS. For filesystems
written as plain FAT, it may change them to appear as upper case in
Linux, when they previously showed as lower case. If there is a
reliable way to detect filenames written by a plain FAT system, it
might be desirable to show the names as lower case from them.

Below are my notes, when I had to add "shortname=mixed" to a program
because of user bug reports when they created files on various
versions of Windows and they didn't work on an embedded Linux media
player. Feel free to use the notes in the Changelog or documentation.

Why use shortname=mixed.

This affects 8.3 filename reading and creation for maximum
compatibility with the behaviour of all versions of Windows.

There is a classic conflict between Windows 95 derivatives and
Windows NT derivatives, which causes spurious case changes when
moving some file names between them on removable media. This
Linux setting manages to be compatible with both of them reliably,
and is therefore superior to all versions of Windows.

1. Filename reading uses the algorithm of Windows NT: if there
is only an 8.3 short name, its case is calculated from flags in
byte 12 of the short name entry.

This is needed for compatibility with files written by Windows
NT derivatives (including 2000, XP and Vista). When Windows NT
creates two files called "PLAYLIST" and "file.ogg", the default
Linux algorithm ("shortname=lower") would see them as
"playlist" and "file.ogg" together, and the Windows 95
algorithm would see them as "PLAYLIST" and "FILE.OGG" together.
Both cause problems.

2. Filename creation uses the algorithm of Windows 95: Linux
creates a long name entry unless the original name fits into
8.3 and is entirely upper case. This is more compatible than
shortname=winnt, because it creates a long name in more cases
to remove uncertainty.

This is needed for compatability with files created by Linux
and read by Windows 95 derivatives (and MS-DOS). Windows 95
derivatives and MS-DOS interpret short name entries as upper
case, even when case flags are set in byte 12. By storing a
long name entry, files stored by Linux will be read in the
desired case by all versions of Windows.

The patch has my

Signed-Off-By: Jamie Lokier <[email protected]>

-- Jamie

2009-06-30 20:49:16

by OGAWA Hirofumi

[permalink] [raw]
Subject: Re: [RFC] vfat: change the default from shortname=lower to shortname=mixed

Jamie Lokier <[email protected]> writes:

> I agree with the change to "shortname=mixed" being the default.
>
> Not only does it solve problems with Linux seeing files it created
> _itself_ change, "shortname=mixed" is the only option where files
> created on all versions of Windows appear the same in Linux, and vice
> versa. It is better than Windows itself in that respect...
>
> "shortname=winnt" is not as good. It solves the problem of
> Linux<->itself compatibility and Linux<->Windows-NT/2000/XP/Vista
> compatibility, but not Linux<->Windows-95/98/ME compatibility.
>
> I don't see any problems with changing the option from it's default,
> for filesystems which were written as VFAT by any OS. For filesystems
> written as plain FAT, it may change them to appear as upper case in
> Linux, when they previously showed as lower case. If there is a
> reliable way to detect filenames written by a plain FAT system, it
> might be desirable to show the names as lower case from them.
>
> Below are my notes, when I had to add "shortname=mixed" to a program
> because of user bug reports when they created files on various
> versions of Windows and they didn't work on an embedded Linux media
> player. Feel free to use the notes in the Changelog or documentation.
>
> Why use shortname=mixed.
>
> This affects 8.3 filename reading and creation for maximum
> compatibility with the behaviour of all versions of Windows.
>
> There is a classic conflict between Windows 95 derivatives and
> Windows NT derivatives, which causes spurious case changes when
> moving some file names between them on removable media. This
> Linux setting manages to be compatible with both of them reliably,
> and is therefore superior to all versions of Windows.
>
> 1. Filename reading uses the algorithm of Windows NT: if there
> is only an 8.3 short name, its case is calculated from flags in
> byte 12 of the short name entry.
>
> This is needed for compatibility with files written by Windows
> NT derivatives (including 2000, XP and Vista). When Windows NT
> creates two files called "PLAYLIST" and "file.ogg", the default
> Linux algorithm ("shortname=lower") would see them as
> "playlist" and "file.ogg" together, and the Windows 95
> algorithm would see them as "PLAYLIST" and "FILE.OGG" together.
> Both cause problems.
>
> 2. Filename creation uses the algorithm of Windows 95: Linux
> creates a long name entry unless the original name fits into
> 8.3 and is entirely upper case. This is more compatible than
> shortname=winnt, because it creates a long name in more cases
> to remove uncertainty.
>
> This is needed for compatability with files created by Linux
> and read by Windows 95 derivatives (and MS-DOS). Windows 95
> derivatives and MS-DOS interpret short name entries as upper
> case, even when case flags are set in byte 12. By storing a
> long name entry, files stored by Linux will be read in the
> desired case by all versions of Windows.
>
> The patch has my
>
> Signed-Off-By: Jamie Lokier <[email protected]>

Thanks for comment. I don't know whether signed-off-by is desirable for
this, so I'll add one Acked-by: simply if I apply this. Is it ok?

Thanks.
--
OGAWA Hirofumi <[email protected]>