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

Bug#833238: Do not set CONFIG_FAT_DEFAULT_IOCHARSET="utf8", use FAT_DEFAULT_UTF8 instead



Package: linux-image-4.6.0-1-amd64
Version: 4.6.4-1

Hello,

The Debian kernel currently has CONFIG_FAT_DEFAULT_IOCHARSET="utf8"
enabled. This is not recommended [1]:

| config FAT_DEFAULT_IOCHARSET
| 	string "Default iocharset for FAT"
| 	depends on VFAT_FS
| 	default "iso8859-1"
| 	help
| 	  Set this to the default input/output character set you'd
| 	  like FAT to use. It should probably match the character set
| 	  that most of your FAT filesystems use, and can be overridden
| 	  with the "iocharset" mount option for FAT filesystems.
| 	  Note that "utf8" is not recommended for FAT filesystems.
| 	  If unsure, you shouldn't set "utf8" here - select the next option
| 	  instead if you would like to use UTF-8 encoded file names by default.
| 	  See <file:Documentation/filesystems/vfat.txt> for more information.

This leads to irritating bugs [2][3] and misleading
stat()/open()/mkdir() as it seems that a file or dir simultaneously
exists and not exists:

  $ mkdir FOO
  $ test -e Foo && echo yes || echo no
  no
  $ mkdir -p Foo
  mkdir: cannot create directory ‘Foo’: File exists

This is on a VFAT partition with the default mount options:

  (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=utf8,shortname=mixed,errors=remount-ro)

This can be worked around by always using all uppercase file names,
but this is not very obvious and prone to get wrong.

It behaves much better with mount -o utf8,iocharset=ascii:

  $ test -e Foo && echo yes || echo no yes
  yes
  $ mkdir -p Foo  # succeeds
  $

With the first try and the default mount options I created a file
"Hällé€". This still appears correctly with utf8,iocharset=ascii.

So I suggest to set

  CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
  FAT_DEFAULT_UTF8=y

instead.

Thanks for considering,

Martin

[1] https://github.com/torvalds/linux/blob/38739380683795354b3f0f1a1e80614e311b8617/fs/fat/Kconfig#L86
[2] https://bugs.debian.org/745280
[3] https://github.com/systemd/systemd/issues/3740

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)

Attachment: signature.asc
Description: PGP signature


Reply to: