Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #54808 > unrolled thread

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

Started byMartin Pitt <mpitt@debian.org>
First post2016-08-02 08:00 +0200
Last post2016-08-26 03:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.debian.kernel


Contents

  Bug#833238: Do not set CONFIG_FAT_DEFAULT_IOCHARSET="utf8", use FAT_DEFAULT_UTF8 instead Martin Pitt <mpitt@debian.org> - 2016-08-02 08:00 +0200
    Processed: Re: Bug#833238: Do not set CONFIG_FAT_DEFAULT_IOCHARSET="utf8",  use FAT_DEFAULT_UTF8 instead owner@bugs.debian.org (Debian Bug Tracking System) - 2016-08-26 03:50 +0200
    Bug#833238: Do not set CONFIG_FAT_DEFAULT_IOCHARSET="utf8", use FAT_DEFAULT_UTF8 instead Ben Hutchings <ben@decadent.org.uk> - 2016-08-26 03:50 +0200

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

FromMartin Pitt <mpitt@debian.org>
Date2016-08-02 08:00 +0200
SubjectBug#833238: Do not set CONFIG_FAT_DEFAULT_IOCHARSET="utf8", use FAT_DEFAULT_UTF8 instead
Message-ID<s1AU9-jn-3@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

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)

[toc] | [next] | [standalone]


#54931 — Processed: Re: Bug#833238: Do not set CONFIG_FAT_DEFAULT_IOCHARSET="utf8", use FAT_DEFAULT_UTF8 instead

Fromowner@bugs.debian.org (Debian Bug Tracking System)
Date2016-08-26 03:50 +0200
SubjectProcessed: Re: Bug#833238: Do not set CONFIG_FAT_DEFAULT_IOCHARSET="utf8", use FAT_DEFAULT_UTF8 instead
Message-ID<saero-rr-3@gated-at.bofh.it>
In reply to#54808
Processing control commands:

> tag -1 pending
Bug #833238 [linux-image-4.6.0-1-amd64] Do not set CONFIG_FAT_DEFAULT_IOCHARSET="utf8", use FAT_DEFAULT_UTF8 instead
Added tag(s) pending.

-- 
833238: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833238
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems

[toc] | [prev] | [next] | [standalone]


#54932

FromBen Hutchings <ben@decadent.org.uk>
Date2016-08-26 03:50 +0200
Message-ID<saero-rr-5@gated-at.bofh.it>
In reply to#54808

[Multipart message — attachments visible in raw view] — view raw

Control: tag -1 pending

On Tue, 2016-08-02 at 07:50 +0200, Martin Pitt wrote:
[...]
> So I suggest to set
> 
>   CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
>   FAT_DEFAULT_UTF8=y
> 
> instead.

I think I get it.  Is this an accurate summary?

commit 0e156c15e31ac4f3e160a6ac262b172d0390d7e8
Author: Ben Hutchings <ben@decadent.org.uk>
Date:   Fri Aug 26 02:31:50 2016 +0100

    fat: Mitigate the lack of UTF-8 case folding
    
    FAT has to convert between Linux filenames ('iocharset' encoding,
    should be UTF-8 today) and native filenames (UTF-16 for long names,
    'codepage' encoding for short names).  And it has to do case
    folding in multiple encodings.  Unfortunately Linux doesn't
    implement case-folding for UTF-8, resulting in inconsistent name
    lookup behaviour as shown in bug #833238.
    
    The 'utf8' option makes FAT assume the Linux filename encoding is
    UTF-8, regardless of the 'iocharset' encoding.  Enabling this and
    setting iocharset=ascii mitigates the problems by enabling case-
    folding for the ASCII subset.
    
    Make that the default by enabling FAT_DEFAULT_UTF8 and setting
    FAT_DEFAULT_IOCHARSET to "ascii".

Ben.

-- 
Ben Hutchings
Editing code like this is akin to sticking plasters on the bleeding
stump
of a severed limb. - me, 29 June 1999

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.kernel


csiph-web