Subject: bug#8306: closed (fix merged to trunk)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 23 Mar 2011 22:07:12 +0000

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 [email-masked].

-- 
8306: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8306
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: fix merged to trunk
From: Paul Eggert <[email-masked]>
To: [email-masked], [email-masked], [email-masked], [email-masked], [email-masked], [email-masked], [email-masked], [email-masked]
Date: Wed, 23 Mar 2011 15:06:46 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

I committed a fix to the trunk for this,
as part of a recent merge (bzr 103721).

Subject: copy-file should report chmod or chown failure
From: Paul Eggert <[email-masked]>
To: [email-masked]
Date: Sun, 20 Mar 2011 19:47:51 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

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 */