From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 03 19:05:03 2013 Received: (at submit) by debbugs.gnu.org; 4 Jan 2013 00:05:03 +0000 Received: from localhost ([127.0.0.1]:42199 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TqumT-0006D2-Uk for submit@debbugs.gnu.org; Thu, 03 Jan 2013 19:05:02 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58784) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TqumR-0006Cq-79 for submit@debbugs.gnu.org; Thu, 03 Jan 2013 19:05:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TqumJ-0003G3-M9 for submit@debbugs.gnu.org; Thu, 03 Jan 2013 19:04:55 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-106.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:35998) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqumJ-0003Fz-IW for submit@debbugs.gnu.org; Thu, 03 Jan 2013 19:04:51 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqumH-0000gj-3j for bug-coreutils@gnu.org; Thu, 03 Jan 2013 19:04:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TqumG-0003Ep-00 for bug-coreutils@gnu.org; Thu, 03 Jan 2013 19:04:49 -0500 Received: from smtp.gentoo.org ([140.211.166.183]:55251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqumF-0003EY-Pj for bug-coreutils@gnu.org; Thu, 03 Jan 2013 19:04:47 -0500 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id A556C33D860 for ; Fri, 4 Jan 2013 00:04:46 +0000 (UTC) From: Mike Frysinger To: bug-coreutils@gnu.org Subject: [PATCH] cp: ignore EEXIST errors from mkdir Date: Thu, 3 Jan 2013 19:06:36 -0500 Message-Id: <1357257996-24917-1-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 1.8.0.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) If you're copying multiple source trees into a single destination in parallel (which have overlapping dirs, but not files), you can easily hit a race condition. This can crop up more generally if you're running multiple installs from different build directories in parallel. You don't get as much of a speed up due to the parallel I/O, but you do from processing all the build scripts. Simple test to reproduce: mkdir -p in/`printf %s/ {a..z} {0..10}` (rm -rf out; for ((i=0;i<100;++i)); do cp -pPR in out & :; done) * src/cp.c (make_dir_parents_private): Ignore EEXIST from mkdir. --- src/cp.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/cp.c b/src/cp.c index 625ea0b..b9dff18 100644 --- a/src/cp.c +++ b/src/cp.c @@ -473,9 +473,15 @@ make_dir_parents_private (char const *const_dir, size_t src_offset, mkdir_mode = src_mode & CHMOD_MODE_BITS & ~omitted_permissions; if (mkdir (dir, mkdir_mode) != 0) { - error (0, errno, _("cannot make directory %s"), - quote (dir)); - return false; + /* If someone else created it between our stat/mkdir, + don't complain. It's debatable whether we should + also preserve the mode bits in this scenario. */ + if (errno != EEXIST) + { + error (0, errno, _("cannot make directory %s"), + quote (dir)); + return false; + } } else { -- 1.8.0.2 From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 03 19:17:14 2013 Received: (at 13352) by debbugs.gnu.org; 4 Jan 2013 00:17:14 +0000 Received: from localhost ([127.0.0.1]:42221 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TquyH-0006YE-MA for submit@debbugs.gnu.org; Thu, 03 Jan 2013 19:17:14 -0500 Received: from smtp.cs.ucla.edu ([131.179.128.62]:33633) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TquyD-0006Y3-1i for 13352@debbugs.gnu.org; Thu, 03 Jan 2013 19:17:11 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 49D91A60005; Thu, 3 Jan 2013 16:17:04 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QLtI-yHPN1Lb; Thu, 3 Jan 2013 16:17:03 -0800 (PST) Received: from [192.168.1.9] (pool-71-189-154-249.lsanca.fios.verizon.net [71.189.154.249]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id B189439E8008; Thu, 3 Jan 2013 16:17:03 -0800 (PST) Message-ID: <50E61F7F.3060408@cs.ucla.edu> Date: Thu, 03 Jan 2013 16:17:03 -0800 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Mike Frysinger Subject: Re: bug#13352: [PATCH] cp: ignore EEXIST errors from mkdir References: <1357257996-24917-1-git-send-email-vapier@gentoo.org> In-Reply-To: <1357257996-24917-1-git-send-email-vapier@gentoo.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.5 (-) X-Debbugs-Envelope-To: 13352 Cc: 13352@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.5 (-) Thanks for the bug report, but I'm not sure that's the right fix. Wouldn't it be better to address the following FIXME in cp.c? /* FIXME: Synch this function with the one in ../lib/mkdir-p.c. */ The function in mkdir-p.c doesn't have the bug. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 04 00:14:56 2013 Received: (at 13352) by debbugs.gnu.org; 4 Jan 2013 05:14:56 +0000 Received: from localhost ([127.0.0.1]:42466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TqzcO-0008C8-7y for submit@debbugs.gnu.org; Fri, 04 Jan 2013 00:14:56 -0500 Received: from smtp.gentoo.org ([140.211.166.183]:45569) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TqzcM-0008C1-Bg for 13352@debbugs.gnu.org; Fri, 04 Jan 2013 00:14:55 -0500 Received: from vapier.localnet (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 47AAC335E2B; Fri, 4 Jan 2013 05:14:48 +0000 (UTC) From: Mike Frysinger Organization: wh0rd.org To: bug-coreutils@gnu.org Subject: Re: bug#13352: [PATCH] cp: ignore EEXIST errors from mkdir Date: Fri, 4 Jan 2013 00:16:39 -0500 User-Agent: KMail/1.13.7 (Linux/3.7.1; KDE/4.6.5; x86_64; ; ) References: <1357257996-24917-1-git-send-email-vapier@gentoo.org> <50E61F7F.3060408@cs.ucla.edu> In-Reply-To: <50E61F7F.3060408@cs.ucla.edu> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart10613297.TSoIYlA0zM"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201301040016.40111.vapier@gentoo.org> X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 13352 Cc: 13352@debbugs.gnu.org, Paul Eggert X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) --nextPart10613297.TSoIYlA0zM Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Thursday 03 January 2013 19:17:03 Paul Eggert wrote: > Thanks for the bug report, but I'm not sure that's the right > fix. Wouldn't it be better to address the following FIXME in cp.c? >=20 > /* FIXME: Synch this function with the one in ../lib/mkdir-p.c. */ >=20 > The function in mkdir-p.c doesn't have the bug. i thought it might, but i didn't want to get into the nuances here. `mkdir= - p` isn't copying a tree and its set of perms like `cp -pR` does. it might = not=20 actually affect the code, but i'm not familiar enough with the code base to= =20 say. =2Dmike --nextPart10613297.TSoIYlA0zM Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iQIcBAABAgAGBQJQ5mW4AAoJEEFjO5/oN/WB8GkP/139LlJGqDozpHGGXx/pBDnQ 7Iz2S4dPJUJPyavVkgshrlnNUhCvyr2CthUdZbxpEcbtA3txfi1kSDXE/P4S20cm 5kRpwO/9ykw1QCg810r5BIkxsAqxO1UtvdSIQ516BkbQ0fYs0nMC+7ngLpe46Rjk mv0Y9joOUw9MtbRIW944X4f+XE52hDJQIHJSzGc4Xzygu4fX7kvY8cHv7vkcIEsG 9pig7KhQOLbPPUUXa2lC6y5mZPz8i++1k73IUkupO8LO5gd65xiwC4fIfXZ3+/92 3mTiUqljPKEJsMFEZFMte4vywvaNHjBTKVlYcNcdyTP2oKsrBJYGBer1XoAP1Xvo 7gjCY7O+00HdGBLXU2r+q42H9iHrW3tR70V+VkfrqkHOoyAzVTB3BA5AYhOi7jgS /yjNUX4up4qx3W1kDtuJXTzn+Hl8re8LT9YgMWYq7w+0ObppzEhtxUlJmqQBD+vr /6EIY3VmWGg3KCxFxQQUvR7fPZvLxdKhZua3FuLR4Z3sep3vwl2gkKraSh3Exz1r 4brIYcUk33wiM05jCtWvOt99rt98tuADHRA3F5pAxCzcI9FQktGmdMcYQ7thh0wi gac8YDMZDyfd3pnzJG5ptIYZYyVkEeLrLsi6LQgsNyqiBtFiN+cvb6874IVcPRv+ eypqYRmODL9ecAHDBrKF =cYFw -----END PGP SIGNATURE----- --nextPart10613297.TSoIYlA0zM-- From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 30 00:25:49 2018 Received: (at control) by debbugs.gnu.org; 30 Oct 2018 04:25:49 +0000 Received: from localhost ([127.0.0.1]:52992 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHLbA-0006i0-LC for submit@debbugs.gnu.org; Tue, 30 Oct 2018 00:25:48 -0400 Received: from mail-pf1-f181.google.com ([209.85.210.181]:39962) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHLb9-0006hm-Dv for control@debbugs.gnu.org; Tue, 30 Oct 2018 00:25:47 -0400 Received: by mail-pf1-f181.google.com with SMTP id g21-v6so5133173pfi.7 for ; Mon, 29 Oct 2018 21:25:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:message-id:date:user-agent:mime-version:content-language :content-transfer-encoding; bh=dx+YSH02TcyGc0WZQYDPIV1E2EE32I2EutvSefmtHUk=; b=KePTyO3nSQx8R3Y3jYS4Lttb5LMBh8L5BVBse1NkymHfNaW+9GAm4oOSRHpO+VDAEH AuQAlyOD6t50zTMgf7zJzr3YzZhaZSOc33T+QOLiJ6Gs4cgZnLmpq9wux/RHHQESdTRp kZQWs7v3Gt/OJXRmbd0PHSUCiDwi4vCvgZidwyQf0A9qXVQbfEmc1y6OpikPWQder7g3 jaJfQXmLsKZKS8lXRF6qc5JGTAdH6Wy1kyasAj0dkhuccZd9Fhm1SPZupng+kcefWjAF Y2zeOoOfEmSDtwkOw8vBaOUNzIaQXTSK2kD1XtIbg59vHJSG2f30JvFpEKogMiIZJs2N WqXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=dx+YSH02TcyGc0WZQYDPIV1E2EE32I2EutvSefmtHUk=; b=GYpY+G1hPX/VG82QLz51EuWc+NePnt4vpi/Qg10lxptu0Y+rqS6cHAGHKB988WuHln mg3ETyC97UerYTerCFIpX5nJcMy3j7BHrkrXFbsWy1pK4CKdDKyFAU3ztnN/nsnz+ITZ XOpoI8ydYea3D4STNlBsrPWZ4X6gVW5KOfWOZN7pCvezUuwZ337u8LRW35hnMCf4NlgM pJDXeha/aldltAhiW8KS15r96J6wvvSWW8FDWesNmuYO6f2eJIE2wfqeW1fO7deVb+zp w9M4P74+nQQeEteaXbdi1D9wVYnUXLcRGXF6/rMwdmO7h5oJ07+/e5pANB1mcFeDRpHv SfDQ== X-Gm-Message-State: AGRZ1gI7lCxXS4pP6m8BQEOimRAlXqfLXpx2LP9xlepUNYZ9jdXcjz4D sBL1xi0v90SrKO+GgdISKymuj9zInQ0= X-Google-Smtp-Source: AJdET5e65OayXg7r2dL6VJxRPor5Kyuo9LjdOHWU0XQggtrDOvHOJlSVbDSa7klYyPmQQMKz5OCLmA== X-Received: by 2002:a63:b30f:: with SMTP id i15mr14239091pgf.240.1540873540893; Mon, 29 Oct 2018 21:25:40 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id w63-v6sm29260706pgw.60.2018.10.29.21.25.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 21:25:39 -0700 (PDT) To: control@debbugs.gnu.org From: Assaf Gordon Message-ID: Date: Mon, 29 Oct 2018 22:25:38 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: retitle 13352 cp: ignore EEXIST errors from mkdir [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.210.181 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (assafgordon[at]gmail.com) 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) retitle 13352 cp: ignore EEXIST errors from mkdir