emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unable to copy directory recursively to a vfat partition


From: Sven Joachim
Subject: Re: unable to copy directory recursively to a vfat partition
Date: Thu, 24 Jul 2008 16:05:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

On 2008-07-24 15:23 +0200, Chong Yidong wrote:

> Sven Joachim <address@hidden> writes:
>
>> On 2008-07-24 07:30 +0200, Sven Joachim wrote:
>>
>>> I do have access to vfat, but I cannot reproduce the bug.  IIRC there
>>> was some change in Linux 2.6.25 that caused the chmod call to report
>>> failure (it never works on vfat anyway, but that used to be silently
>>> ignored).  This change seems to have been reverted in the meantime,
>>> though; I'm running 2.6.26 here.
>>
>> The change in 2.6.25 also broke rsync, as can be seen on
>> https://bugzilla.redhat.com/show_bug.cgi?id=449080.  I'll have a look at
>> the problem when I get around to reboot with a 2.6.25 kernel.
>
> Does anyone know what the BSDs do?  In other words, is reporting failure
> for chmod simply "undefined behavior" that is up to the discretion of
> the kernel (i.e., we need to be able to handle it), or is it simply a
> Linux bug (i.e., we can probably get away with doing nothing)?

I think we should avoid the first chown and create the directory with
correct permissions from the start.  Here is a patch for EMACS_22_BASE:

2008-07-24  Sven Joachim  <address@hidden>

        * dired-aux.el (dired-copy-file-recursive): Avoid calling
        set-file-modes when creating target directories.

--8<---------------cut here---------------start------------->8---
--- dired-aux.el.~1.151.2.7.~   2008-04-07 18:03:21.000000000 +0200
+++ dired-aux.el        2008-07-24 15:43:30.000000000 +0200
@@ -1180,9 +1180,12 @@
            (if (file-exists-p to)
                (or top (dired-handle-overwrite to))
              (condition-case err
-                 (progn
-                   (make-directory to)
-                   (set-file-modes to #o700))
+                 (let ((default-mode (default-file-modes)))
+                   (unwind-protect
+                       (progn
+                         (set-default-file-modes #o700)
+                         (make-directory to))
+                     (set-default-file-modes default-mode)))
                (file-error
                 (push (dired-make-relative from)
                       dired-create-files-failures)
--8<---------------cut here---------------end--------------->8---

If the directory permissions fail to be restored later, this will still
be reported as an error, but I think it's correct to do that.  Note that
any program that recursively copies files and preserves permissions will
have this problem on Linux 2.6.25 and vfat.  Unless you mount the vfat
filesystem with the `quiet' option, that is.

Sven




reply via email to

[Prev in Thread] Current Thread [Next in Thread]