From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bruno Haible Newsgroups: gmane.comp.lib.gnulib.bugs,gmane.emacs.devel Subject: Re: errors from fchownat copying directories Date: Sat, 26 Aug 2023 18:40:20 +0200 Message-ID: <13334762.uLZWGnKmhe@nimes> References: <835y52meww.fsf@gnu.org> <87wmxi1ad3.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="642"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, bug-gnulib@gnu.org To: Po Lu , Eli Zaretskii , Paul Eggert Original-X-From: bug-gnulib-bounces+gnu-bug-gnulib=m.gmane-mx.org@gnu.org Sat Aug 26 18:41:09 2023 Return-path: Envelope-to: gnu-bug-gnulib@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qZwLU-000AXM-EZ for gnu-bug-gnulib@m.gmane-mx.org; Sat, 26 Aug 2023 18:41:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZwL2-0001eT-SN; Sat, 26 Aug 2023 12:40:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZwL1-0001eB-MN; Sat, 26 Aug 2023 12:40:39 -0400 Original-Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.24]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZwKy-0006pg-QH; Sat, 26 Aug 2023 12:40:39 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1693068020; cv=none; d=strato.com; s=strato-dkim-0002; b=ZDLGbZtyOrLSSR7BL1wuMKpPE1i+VOJ8XnA89jCaWUDCJ1cmMIzVDBT/+de13XHtwY SJveemSo7f6uibw6EQPYfm97hs+pqX9QZfvqziLnb+ug9pxjni2Q7POwe0rmjipX2gVw +6/cqj7Z1mq4AilpDqPkXW7JwaqYPa82odCIU/T8wCI7XeQJux/wJAxN8lJpm0kvL8MU yBDiJOpJvlhkLFKTXZxl5cpXt25QQkgG6dY56pd1h2d1hYLGdDhiIO+w9K91kXpanR7+ atdcYjdmdXFaOPq6pR+T7BSJl0WN+u+u41EqkUvww2kWnCoB6twYYEEoo9foN6hUZOFq w9uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1693068020; s=strato-dkim-0002; d=strato.com; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=vANd0YQR1YwZr5rojikbzDpz+aleG+5kyuDYC4J4ysA=; b=gOV0RIKgCQ0ltn3C8ASAqv9V324QboUlfSKsysdFXE0pIkU1JUSDB2UqRIqiGlpbSz UocPJ5uAfFcSV7ShLCXaUBMO/dEQpBUHoBlb4TwFfTxrcp9QDasXMFL8TelMGG0NCt4Y HZ3oA3Ei7TaKPQ+Z/wJIjidcwKzeHEtWeKF32iW2/oQtPchZAbgueOVDErOeYMr/LLEG fvQlHUq6obMgF+rEpUGMBOQ7QZLVsts8vb9dUolLOHvYrgJ2DLqWQ/pEzwNZgIra2oKH y1dRF9FbsnFPL/LEDq6NwomlxaFocdIumtEbYT+27QjqmjTFTYlvaCdT5h+2OsNnIqmq F0Qw== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1693068020; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=vANd0YQR1YwZr5rojikbzDpz+aleG+5kyuDYC4J4ysA=; b=MqmI85QtseAwXI3kyhsfi49pcEx29Dp1ie2YXo9z1u+uceCpkNNsT3dznepn6TWJMf sa7gqwUvV0tLhR2Tcm94rMcP4YbOI3k3wBFT4J6ZwbDLjhJOgTvAwK+/o7R+4PDk6IzS 403oL6hQqRhZ8dLm0Zbzxp7rOaaGd0zEDlVHlA4cbxbDhVjfnwozhUdzpH2PXTy/u5dk oZ6OWMjl0lzP3UqC84dke8WiJKyGwNz4NHLR35JZq6u1Uy1WvBj3uYGnXwBoYxD+zUpr jDjCifaCXKW9YerRD//P89+BAvMy7Ru0XgZuRoBSQwJBfQ37oVA5t4q7xkDegd9hTbwA eCzA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1693068020; s=strato-dkim-0003; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=vANd0YQR1YwZr5rojikbzDpz+aleG+5kyuDYC4J4ysA=; b=4CDWrIUPEADlOXz8xxFlt1OdtfQuYxh4Fcvy/q+av8ygTseWp9ZbXF4CrnoEUkaZ+R xWgcqPGUVf4xI0iS31AQ== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpOT2KBDyyohy2Ll6m0IPgAVk8SOYA==" Original-Received: from nimes.localnet by smtp.strato.de (RZmta 49.8.1 AUTH) with ESMTPSA id v2e18cz7QGeKP0J (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 26 Aug 2023 18:40:20 +0200 (CEST) In-Reply-To: Received-SPF: none client-ip=85.215.255.24; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+gnu-bug-gnulib=m.gmane-mx.org@gnu.org Original-Sender: bug-gnulib-bounces+gnu-bug-gnulib=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.comp.lib.gnulib.bugs:48238 gmane.emacs.devel:309259 Archived-At: Paul Eggert wrote: > https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=349798a9b81fb4f7f8e1e1963ea9039a4a68a471 Isn't there something missing in this function 'copy-directory', around emacs/lisp/files.el line 6624? I see code for preserving the modes and the times, but not for preserving the owner. For comparison, 'mv' from GNU coreutils 9.3.147-d553ab contains also code for preserving the owner, and this code sometimes gives diagnostics that are ignored, in the sense that 'mv' terminates with exit code 0. See: $ ldd mv linux-vdso.so.1 (0x00007fff51f73000) libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f856994a000) libacl.so.1 => /lib/x86_64-linux-gnu/libacl.so.1 (0x00007f8569940000) libattr.so.1 => /lib/x86_64-linux-gnu/libattr.so.1 (0x00007f8569938000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8569710000) libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f8569679000) /lib64/ld-linux-x86-64.so.2 (0x00007f8569998000) $ mkdir dir1 $ echo foo > dir1/file1 $ mv dir1 /media/nas/bruno/dir1 mv: failed to preserve ownership for '/media/nas/bruno/dir1': Permission denied $ echo $? 0 Here /media/nas/bruno/dir1 is on a CIFS version 1 file system, and the 'strace' log from the 'mv' command shows the essential syscalls: utimensat(AT_FDCWD, "/media/nas/bruno/dir1", [{tv_sec=1693067148, tv_nsec=145342620} /* 2023-08-26T18:25:48.145342620+0200 */, {tv_sec=1693067154, tv_nsec=717388257} /* 2023-08-26T18:25:54.717388257+0200 */], 0) = 0 fchownat(AT_FDCWD, "/media/nas/bruno/dir1", 1000, 1000, AT_SYMLINK_NOFOLLOW) = -1 EACCES (Permission denied) Note: In earlier versions of coreutils 'mv', instead of an fchownat call, we saw an equivalent lchown call: lchown("/media/nas/bruno/dir1", 1000, 1000) = -1 EACCES (Permission denied) Bruno