From mboxrd@z Thu Jan 1 00:00:00 1970 From: Danny Milosavljevic Subject: bug#26353: VFS name encoding Date: Thu, 1 Jun 2017 12:57:43 +0200 Message-ID: <20170601125743.6b13cd94@scratchpost.org> References: <20170403202146.2a9317ce@scratchpost.org> <87poghdbge.fsf@gnu.org> <87mvb8f2a7.fsf@gnu.org> <20170423040301.53ea208f@scratchpost.org> <87fugo1efp.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGNnp-0005JQ-6j for bug-guix@gnu.org; Thu, 01 Jun 2017 06:58:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGNnm-0007bC-40 for bug-guix@gnu.org; Thu, 01 Jun 2017 06:58:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:45819) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGNnm-0007b8-1W for bug-guix@gnu.org; Thu, 01 Jun 2017 06:58:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dGNnl-0005Mw-RO for bug-guix@gnu.org; Thu, 01 Jun 2017 06:58:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87fugo1efp.fsf@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 26353@debbugs.gnu.org Hi Ludo, > The problem of how to deal with file name encoding has been discussed on > the Guile side so hopefully the next release in the 2.2 series will have > a solution for this. For what it's worth, I think the sane solution is the Plan 9 solution: Just represent file names as bytevectors. Programs which don't care about the actual name - for example programs that just want to do (for-each unlink (scandir (string->utf8 "."))) or something - have no reason to care about the encoding at all. And then use UTF-8 encoding everywhere (for the file names, also for everything else) throughout the operating system for the tools that do care. There are also utf8 mount options in the Linux kernel to be able to present UTF-8 names to userspace even when the actual names on disk are something else - and we should use them. (I think we should even modify flags to default to "utf8" or "iocharset=utf8" where possible) This conversion of UTF-8 to UCS-4 especially is really just busywork. My opinion changed over the years - earlier I was all for UCS-4. But actually, most tools don't care about the actual content of the file names - it's just an opaque ID to them (similar to an UUID). Representing them as something else in userspace again (inviting another conversion failure) is just ... unnecessary. In any case, it would be different if we had a non-UNIX kernel underneath. But as long as we do have UNIX the kernel VFS interface expects bytevectors, preferrably interpreted as UTF-8 (if interpreted at all). I think this is also the consensus among the major Linux distributions and also among lowlevel libraries like glib: They assume one is using UTF-8 filenames and default to it whereever possible.