Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp998750ybj; Tue, 5 May 2020 11:08:31 -0700 (PDT) X-Google-Smtp-Source: APiQypKAsMUTtTqohIat8lBro02cOugM3JHvW4PvHjdjG1E9yYfZd+dbbAC2+xzWw10OkV9MRSpC X-Received: by 2002:a17:906:2351:: with SMTP id m17mr4069447eja.179.1588702111714; Tue, 05 May 2020 11:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588702111; cv=none; d=google.com; s=arc-20160816; b=HNDpU5CUXCB43h5Glv57gKPQ57yp2xtdVLI10OUeJmJh7U3Ohj65YJpOwas8S5gF9H gJlNdKqbetRIr1Zau2dYKgJABQU2FnAwP9oMgOFrIb19EBQRPTeIaExo1cqjeujAaMST 4uHgfytU5z9FJ6drXy3F8/0X8djJYGKiUDpcNv2huH9iimij9nEeOz7hId7UrAUS4GF4 kgcdf4mYlK+WkoD9l3D0v/nHNL7EMuTw3JdDRBquN2RQIsvL9mAFiGMSnv6mqiqZV91M +plk0jo+v0yCZ4p2C9iF6Xg8118g1VbYy+gSaHCove/SfQ/v0PPueHVSZ6V3vz2Mov9O g/LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Fx7kZ2uSm1xU0XXkuL1rRzPHu6dl52TkjbxfxBH5rdU=; b=qq5QIuN84GVO1OyNK37YnIXasoDkPVF3pvw/5Ixw3J6agrvzUVpEK+XOe7s5T0JHJl EHwOH9AgDsM6926NTsmcMafAMIONXGe6QKZ1+DH5G1kjYHavJcHQ2WVrqfopZ7cWWntC DjVBzc2sWGkczABS3YRVNeFzz6X0/ACmTaPQ5Gk4IjaNDWG1dKBi73jySdMkuVb8fZiZ 5ac/7VkTCg0NIvj9XGVOd1XEiS3uGtV5Dv+orvvsCLThW6pvsvnMKGTFE7v/S7hAIv2a ponm0Y7oCjvvGTlInljEzbYve2/0Vv2wPJMrfCX9BkBhY37sQGtPyJ52irQtxVFgGVKs RP3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jguk.org header.s=google header.b=nyEhQ4UP; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si2078630edl.579.2020.05.05.11.07.57; Tue, 05 May 2020 11:08:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@jguk.org header.s=google header.b=nyEhQ4UP; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730667AbgEESH3 (ORCPT + 99 others); Tue, 5 May 2020 14:07:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729315AbgEESH3 (ORCPT ); Tue, 5 May 2020 14:07:29 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72731C061A0F for ; Tue, 5 May 2020 11:07:28 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id u127so3380177wmg.1 for ; Tue, 05 May 2020 11:07:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jguk.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Fx7kZ2uSm1xU0XXkuL1rRzPHu6dl52TkjbxfxBH5rdU=; b=nyEhQ4UPzXvsPWOFh9tqB4Y/YGsJMDD8Cl06XYN4Bgsx6Xt4iiwYiAT/fuzjMCL+Ov RVvTDo4ZYRUuTaNLWywUbcHB1vx9EBSf/qRDaHbP+BNkFeqWmWcuEJDP0xp7MSY/jSPB Ll/oRABuNL0jfuZcyYupMgwjiUY8P6OzpgFwo9ptIZXjD+eZ0WW1K2VswmiTr6pDMIak gDXnWyDrrOmjtw+4DIpNYY0PLvSIr22mSJlK6Gifk5+DC75Hqk2ceIe0UrHzJq/S8et1 Nh1OC4MbW96sUSzPR1gSJ7JGTpni267wJ7Q08CdqXI78TyFdqtuMudr61F+tG1gZYp8O ZQCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Fx7kZ2uSm1xU0XXkuL1rRzPHu6dl52TkjbxfxBH5rdU=; b=eP8JjN9RJWHH6bklfp0ESN28VSRp26ScXoa9h0VWjsCfMM+a0XQ8EAFH4d5Lw1rOaX sFszs9Eebxiy/pndw0UJOXK6sJ9Zi/6zrwrCn1Ez+25fecMYag/2poc0jFBmiSc/XDL9 QooHdm22dbPPSj8SvH1F9ulO47+d5GBWgEDKRGg0nQus/FkqAvk8TA/s41sgUhzRSEEU dnfr4rRAXuSDyaRNqr1rQV9Pv5UZJPk1hgFonp2II6bYiEe93Hp/hCAn4Rs6roYIozrE ++rNFXlEJBC4ODAvIQW/xGBGsgzKynSpJRn49NcrSSwpQ1Gd9YLCtC2ZF3/apQMTfvXJ 1c8Q== X-Gm-Message-State: AGi0PuZ6Vlb/L5s0yjHJvl47bXryOIWoXJAjSAoE2veq9IQiuPDxsqLd gKRwsDF3PU+MbmuLCU6PrHxZEhfbDf0= X-Received: by 2002:a1c:3b0a:: with SMTP id i10mr3293wma.26.1588702046011; Tue, 05 May 2020 11:07:26 -0700 (PDT) Received: from [192.168.0.12] (cpc87281-slou4-2-0-cust47.17-4.cable.virginm.net. [92.236.12.48]) by smtp.gmail.com with ESMTPSA id x13sm5238437wmc.5.2020.05.05.11.07.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 May 2020 11:07:24 -0700 (PDT) Subject: Re: /fs/ext4/namei.c ext4_find_dest_de() To: "Theodore Y. Ts'o" Cc: linux-ext4@vger.kernel.org References: <2edc7d6a-289e-57ad-baf1-477dc240474d@jguk.org> <20200504015122.GB404484@mit.edu> <20200504195255.GC404484@mit.edu> From: Jonny Grant Message-ID: Date: Tue, 5 May 2020 19:07:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200504195255.GC404484@mit.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 04/05/2020 20:52, Theodore Y. Ts'o wrote: > On Mon, May 04, 2020 at 08:38:33AM +0100, Jonny Grant wrote: >>>> I noticed that mkdir() returns EEXIST if a directory already exists. >>>> strerror(EEXIST) text is "File exists" >>>> >>>> Can ext4_find_dest_de() be amended to return EISDIR if a directory already >>>> exists? This will make the error message clearer. >>> >>> No; this will confuse potentially a large number of existing programs. >>> Also, the current behavior is required by POSIx and the Single Unix >>> Specification standards. >>> >>> https://pubs.opengroup.org/onlinepubs/009695399/ >>> >> Is it likely POSIX would introduce this change? It's a shame we're still >> constrained by old standards (SVr4, BSD), but it's fine if they can be >> updated. > > No, because it has the potential to break existing Unix/Linux/Posix-compliant > programs. There may very well be C programs doing the following.... > > if (mkdir(filename) < 0) { > if (errno != EEXIST) { > perror(filename); > exit(1); > } > } > > For example, there may very well be implementations of "mkdir -p" that > do precisely this. > > If we change the error returned by the mkdir system call as you > propose, it would break these innocent, unsuspecting programs. That's > not something which will be allowed, because it falls into the > category of a Bad Thing. Thank you for your reply. What's an appropriate solution to this problem? To achieve the desired output. when a directory exists. $ mkdir test $ mkdir: cannot create directory ‘test’: Is a directory Cheers, Jonny