Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4342480imm; Mon, 30 Jul 2018 12:51:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcWx+Zv4bMCj1cQPxBKAa0k8SmsFVOnePTXUDMg19JLNYCpIalBEVSBBJm/Y1li5ti3/M5V X-Received: by 2002:a63:9902:: with SMTP id d2-v6mr17562243pge.343.1532980305185; Mon, 30 Jul 2018 12:51:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532980305; cv=none; d=google.com; s=arc-20160816; b=mDphH6QctSg2AKjhH7asMhjj/LnH6WoM754dvTA4iuvMrvJZYFLURKCqCPkEku8+Ra 7jt3zZ/L1WiHnPIxBuspaj5SrO4siKflzhtueD5t434JLuQrFIO3IMdi5/T8IgshTzRu CvNCFez1QHob7+BHCrBZ1IxaBidVpiJ/kA5z2PiS1vfb6l+kE6bhIjCAOr3WPqd45WHO s2n8jCtWWK2wWfjuUSfvqGlDc+IGuyZqq+NpgK/a2hhqZxrW5PjiibgHOr3hwWbdwDK9 E046wFQ/MrUhH7vbLXHs54Hslv36/0KVXQzS8JWTeXr+jTo1QDgpg7YO9D1m8aP0HYLb vqBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=IHoVBTpFqQn7X9RtLhUsvLGUpv7IPz/8PsXByKxVTZ8=; b=s6fChJrYCvZC39Oj46T9Okz8VvKDmhzd2x4yr6Gm6XUooiqSou0kK/VY8xSH6f1qlT Y215TS6QE2JIt6qcQVD1n1BHH5yxFdJ6KUnVFqxJnJyXLcIP/1xJUimY/RMGS9wyuBbf h2rIVUeOx19gGs95gAWj/PvMv7ki2VMedOHrYGe779gnw+kU9jN0sr+ePbbbNoB/QgUe AVwovbvaRDb+z2MBkpqip/2mD3qeGockcuEuL3sz5ir7ohu0/hF6Rc5BiXOtWwv+IaAD wiGk8CzuOrbr2gGnx/8Tl1iCrWdWou16gotq8ZiAoxmcEnA4AJtVyWFAcw4ajHlkIxhl NvwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=VpEExwqg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6-v6si11272369pgh.569.2018.07.30.12.51.30; Mon, 30 Jul 2018 12:51:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=VpEExwqg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732010AbeG3V0O (ORCPT + 99 others); Mon, 30 Jul 2018 17:26:14 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48846 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727474AbeG3V0O (ORCPT ); Mon, 30 Jul 2018 17:26:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=IHoVBTpFqQn7X9RtLhUsvLGUpv7IPz/8PsXByKxVTZ8=; b=VpEExwqgmE3iDSOyT2YTtNQJko 5XOgNdGDPb8YUMYBc/Ttkc0Zrd6M2mkNtsLdEJ1G0z0VUTTz/10HIrWypcQ86TeYRmCpoxGe57IMq S0a5zvmh3KF6Z/jGQEzFEp+ocBXXzNzWVOD8nNkdQMcwMvCndfmU8nNvR5Kr3OX3BQ3STPbcDTHY+ 31SPjvIMMo78f7SfG+q2xw5Ub19GxPMwZezuAJM/x4dpvSR6+cX2mSsmSc49qhpLhsCWh7osJgNEl 5x308HGB0wNBCFEI6ZmMVfPjtGhJIoCMDXtziKVHJYcIxmS6FNCdXTssB/85P4aRNQ0co/Na4s/Bp PvdeeMDA==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fkEAl-00032z-47; Mon, 30 Jul 2018 19:49:39 +0000 Date: Mon, 30 Jul 2018 12:49:38 -0700 From: Matthew Wilcox To: Linus Torvalds Cc: Pavel Machek , David Howells , Al Viro , linux-fsdevel , Linux Kernel Mailing List Subject: Re: [PATCH 36/38] vfs: Add a sample program for the new mount API [ver #10] Message-ID: <20180730194938.GA12962@bombadil.infradead.org> References: <20180729113749.GA7333@amd> <153271267980.9458.7640156373438016898.stgit@warthog.procyon.org.uk> <153271292330.9458.14583488053811372222.stgit@warthog.procyon.org.uk> <25489.1532953411@warthog.procyon.org.uk> <20180730143104.GB24051@amd> <20180730180842.GA5544@bombadil.infradead.org> <20180730183847.GB5544@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 30, 2018 at 11:59:13AM -0700, Linus Torvalds wrote: > On Mon, Jul 30, 2018 at 11:38 AM Matthew Wilcox wrote: > > > > I wasn't proposing putting gettext in the kernel. I was reacting to > > Pavel saying "You can't return English strings from the kernel, you have > > to translate numbers into any language's strings". > > The problem with gettext() is that if you *don't* have the strings > marked for translated at the source, you're going to have a hard time > with anything but the simplest fixed strings. > > When the kernel does something like > > mntinfo("Option %s can not take value %d", opt->name, opt->value); > > a gettext() interface inside the kernel (which really would be nasty) > would have seen the format string and the values independently and > would have generated the translation database from that. > > But once the string has been generated, it can now be thousands of > different strings, and you can't just look them up from a table any > more. > > Real examples from David's patch-series: > > errorf(fc, "%s: Lookup failure for '%s'", > desc->name, param->key); > > errorf(fc, "%s: Non-blockdev passed to '%s'", > desc->name, param->key); > > which means that by the time user space sees it, you can't just "look > up the string". The string will have various random key names etc in > it. That's fair, it becomes a good deal more complex than gettext() can cope with. Someone sufficiently determined could regex-match the "Non-blockdev passed to", and translate that. If they really want to sell a computer system to the Office qu?b?cois de la langue fran?aise. > But the alternative to pass things as format strings and raw data, and > having all the rules for a "good gettext interface" are worse. It gets > very ugly very quickly. Yes, catching all the corner cases gets ridiculously hard, particularly plurals. https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html#Plural-forms really makes my brain hurt, and makes me glad I work on simple things like OS kernels. > So I really think the best option is "Ignore the problem". The system > calls will still continue to report the basic error numbers (EINVAL > etc), and the extended error strings will be just that: extended error > strings. Ignore them if you can't understand them. > > That said, people have wanted these kinds of extended error > descriptors forever, and the reason we haven't added them is that it > generally is more pain than it is necessarily worth. I'm not actually > at all convinced that has magically changed with the mount > configuration thing. I'm not convinced we want to do this either, but if there's anywhere we do want to do it then mount seems like one of the few places it might be worth doing. The reasons that a mount failed are many, and it doesn't seem like a good idea to introduce a new errno every time a network filesystem finds a new failure mode. I do think it might be worth marking the strings specially to indicate "This is returned to userspace, do not adjust the spelling lightly". I mean, we haven't even put the 'e' back on creat yet, so we're clearly willing to live with bad spelling.