From unknown Tue Aug 19 02:53:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8306: copy-file should report chmod or chown failure Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Mar 2011 02:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8306 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 8306@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.130067568525671 (code B ref -1); Mon, 21 Mar 2011 02:49:02 +0000 Received: (at submit) by debbugs.gnu.org; 21 Mar 2011 02:48:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1VA5-0006fz-BJ for submit@debbugs.gnu.org; Sun, 20 Mar 2011 22:48:05 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1VA3-0006fY-4O for submit@debbugs.gnu.org; Sun, 20 Mar 2011 22:48:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q1V9x-0003xH-8O for submit@debbugs.gnu.org; Sun, 20 Mar 2011 22:47:58 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:48700) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q1V9x-0003x7-64 for submit@debbugs.gnu.org; Sun, 20 Mar 2011 22:47:57 -0400 Received: from [140.186.70.92] (port=41530 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q1V9w-0000nB-DE for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2011 22:47:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q1V9v-0003wJ-0R for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2011 22:47:56 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:42824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q1V9u-0003w1-Po for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2011 22:47:54 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 2FBC039E80DC for ; Sun, 20 Mar 2011 19:47:52 -0700 (PDT) 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 7iBHJTjWkJU9 for ; Sun, 20 Mar 2011 19:47:51 -0700 (PDT) Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id C0BEA39E80DA for ; Sun, 20 Mar 2011 19:47:51 -0700 (PDT) Message-ID: <4D86BC57.7000908@cs.ucla.edu> Date: Sun, 20 Mar 2011 19:47:51 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -4.7 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.7 (----) On the Emacs trunk, (copy-file A B) does not report an error if A's permissions cannot be copied to B's, and (copy-file A B nil nil t) does not report an error if A's ownership info cannot be copied to B's. I plan to install the following patch so that Emacs reports errors in these cases. * fileio.c (Fcopy_file): Report error if fchown or fchmod fail. === modified file 'src/fileio.c' --- src/fileio.c 2011-03-15 21:14:06 +0000 +++ src/fileio.c 2011-03-21 02:38:48 +0000 @@ -1951,9 +1951,10 @@ owner and group. */ if (input_file_statable_p) { - if (! NILP (preserve_uid_gid)) - fchown (ofd, st.st_uid, st.st_gid); - fchmod (ofd, st.st_mode & 07777); + if (!NILP (preserve_uid_gid) && fchown (ofd, st.st_uid, st.st_gid) != 0) + report_file_error ("Doing chown", Fcons (newname, Qnil)); + if (fchmod (ofd, st.st_mode & 07777) != 0) + report_file_error ("Doing chmod", Fcons (newname, Qnil)); } #endif /* not MSDOS */ From unknown Tue Aug 19 02:53:07 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Paul Eggert Subject: bug#8306: closed (fix merged to trunk) Message-ID: References: <4D8A6EF6.6010006@cs.ucla.edu> <4D86BC57.7000908@cs.ucla.edu> X-Gnu-PR-Message: they-closed 8306 X-Gnu-PR-Package: emacs Reply-To: 8306@debbugs.gnu.org Date: Wed, 23 Mar 2011 22:07:12 +0000 Content-Type: multipart/mixed; boundary="----------=_1300918032-30524-1" This is a multi-part message in MIME format... ------------=_1300918032-30524-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #8306: copy-file should report chmod or chown failure which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 8306@debbugs.gnu.org. --=20 8306: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D8306 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1300918032-30524-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 8306-done) by debbugs.gnu.org; 23 Mar 2011 22:07:03 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q2WCj-0007v2-75 for submit@debbugs.gnu.org; Wed, 23 Mar 2011 18:07:01 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q2WCb-0007uA-KO; Wed, 23 Mar 2011 18:06:54 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 7955339E80F5; Wed, 23 Mar 2011 15:06:47 -0700 (PDT) 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 DCQ03AM5OnEs; Wed, 23 Mar 2011 15:06:47 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 2047839E80B1; Wed, 23 Mar 2011 15:06:47 -0700 (PDT) Message-ID: <4D8A6EF6.6010006@cs.ucla.edu> Date: Wed, 23 Mar 2011 15:06:46 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 MIME-Version: 1.0 To: 8310-done@debbugs.gnu.org, 8318-done@debbugs.gnu.org, 8306-done@debbugs.gnu.org, 8303-done@debbugs.gnu.org, 8277-done@debbugs.gnu.org, 8298-done@debbugs.gnu.org, 8290-done@debbugs.gnu.org, 8278-done@debbugs.gnu.org Subject: fix merged to trunk Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 8306-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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: -3.2 (---) I committed a fix to the trunk for this, as part of a recent merge (bzr 103721). ------------=_1300918032-30524-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 21 Mar 2011 02:48:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1VA5-0006fz-BJ for submit@debbugs.gnu.org; Sun, 20 Mar 2011 22:48:05 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1VA3-0006fY-4O for submit@debbugs.gnu.org; Sun, 20 Mar 2011 22:48:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q1V9x-0003xH-8O for submit@debbugs.gnu.org; Sun, 20 Mar 2011 22:47:58 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:48700) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q1V9x-0003x7-64 for submit@debbugs.gnu.org; Sun, 20 Mar 2011 22:47:57 -0400 Received: from [140.186.70.92] (port=41530 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q1V9w-0000nB-DE for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2011 22:47:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q1V9v-0003wJ-0R for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2011 22:47:56 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:42824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q1V9u-0003w1-Po for bug-gnu-emacs@gnu.org; Sun, 20 Mar 2011 22:47:54 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 2FBC039E80DC for ; Sun, 20 Mar 2011 19:47:52 -0700 (PDT) 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 7iBHJTjWkJU9 for ; Sun, 20 Mar 2011 19:47:51 -0700 (PDT) Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id C0BEA39E80DA for ; Sun, 20 Mar 2011 19:47:51 -0700 (PDT) Message-ID: <4D86BC57.7000908@cs.ucla.edu> Date: Sun, 20 Mar 2011 19:47:51 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 MIME-Version: 1.0 To: bug-gnu-emacs@gnu.org Subject: copy-file should report chmod or chown failure Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.7 (----) On the Emacs trunk, (copy-file A B) does not report an error if A's permissions cannot be copied to B's, and (copy-file A B nil nil t) does not report an error if A's ownership info cannot be copied to B's. I plan to install the following patch so that Emacs reports errors in these cases. * fileio.c (Fcopy_file): Report error if fchown or fchmod fail. === modified file 'src/fileio.c' --- src/fileio.c 2011-03-15 21:14:06 +0000 +++ src/fileio.c 2011-03-21 02:38:48 +0000 @@ -1951,9 +1951,10 @@ owner and group. */ if (input_file_statable_p) { - if (! NILP (preserve_uid_gid)) - fchown (ofd, st.st_uid, st.st_gid); - fchmod (ofd, st.st_mode & 07777); + if (!NILP (preserve_uid_gid) && fchown (ofd, st.st_uid, st.st_gid) != 0) + report_file_error ("Doing chown", Fcons (newname, Qnil)); + if (fchmod (ofd, st.st_mode & 07777) != 0) + report_file_error ("Doing chmod", Fcons (newname, Qnil)); } #endif /* not MSDOS */ ------------=_1300918032-30524-1--