unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: unable to copy directory recursively to a vfat partition
@ 2008-07-23 22:51 Chong Yidong
  2008-07-24  5:30 ` Sven Joachim
  0 siblings, 1 reply; 9+ messages in thread
From: Chong Yidong @ 2008-07-23 22:51 UTC (permalink / raw)
  To: Sven Joachim; +Cc: emacs-devel

Regarding bug 268 in the bug tracker:

> Copying a directory recursively in dired to a vfat partition fails
> because `dired-copy-file-recursive' calls `set-file-modes' on
> directories after creating them.  This behaviour appears to be
> new in 22.2, same recursive copy worked in 22.1.

This appears to be due to the following change:

2007-10-31  Sven Joachim  <svenjoac@gmx.de>

	* dired-aux.el (dired-copy-file-recursive):
	Preserve directory permissions.

Could someone fix this in both the trunk and the branch?
It looks like a simple condition-case around the call to
set-file-modes in dired-copy-file-recursive should be
enough; but someone with access to vfat needs to test this.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unable to copy directory recursively to a vfat partition
  2008-07-23 22:51 unable to copy directory recursively to a vfat partition Chong Yidong
@ 2008-07-24  5:30 ` Sven Joachim
  2008-07-24  5:54   ` Sven Joachim
  0 siblings, 1 reply; 9+ messages in thread
From: Sven Joachim @ 2008-07-24  5:30 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

On 2008-07-24 00:51 +0200, Chong Yidong wrote:

> Regarding bug 268 in the bug tracker:
>
>> Copying a directory recursively in dired to a vfat partition fails
>> because `dired-copy-file-recursive' calls `set-file-modes' on
>> directories after creating them.  This behaviour appears to be
>> new in 22.2, same recursive copy worked in 22.1.
>
> This appears to be due to the following change:
>
> 2007-10-31  Sven Joachim  <svenjoac@gmx.de>
>
> 	* dired-aux.el (dired-copy-file-recursive):
> 	Preserve directory permissions.
>
> Could someone fix this in both the trunk and the branch?
> It looks like a simple condition-case around the call to
> set-file-modes in dired-copy-file-recursive should be
> enough; but someone with access to vfat needs to test this.

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.

Sven




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unable to copy directory recursively to a vfat partition
  2008-07-24  5:30 ` Sven Joachim
@ 2008-07-24  5:54   ` Sven Joachim
  2008-07-24 13:23     ` Chong Yidong
  0 siblings, 1 reply; 9+ messages in thread
From: Sven Joachim @ 2008-07-24  5:54 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

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.

Sven




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unable to copy directory recursively to a vfat partition
  2008-07-24  5:54   ` Sven Joachim
@ 2008-07-24 13:23     ` Chong Yidong
  2008-07-24 14:05       ` Sven Joachim
  2008-07-24 14:35       ` Jason Rumney
  0 siblings, 2 replies; 9+ messages in thread
From: Chong Yidong @ 2008-07-24 13:23 UTC (permalink / raw)
  To: Sven Joachim; +Cc: emacs-devel

Sven Joachim <svenjoac@gmx.de> 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)?




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unable to copy directory recursively to a vfat partition
  2008-07-24 13:23     ` Chong Yidong
@ 2008-07-24 14:05       ` Sven Joachim
  2008-07-24 14:59         ` Stefan Monnier
  2008-07-24 16:19         ` Chong Yidong
  2008-07-24 14:35       ` Jason Rumney
  1 sibling, 2 replies; 9+ messages in thread
From: Sven Joachim @ 2008-07-24 14:05 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

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

> Sven Joachim <svenjoac@gmx.de> 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  <svenjoac@gmx.de>

	* 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




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unable to copy directory recursively to a vfat partition
  2008-07-24 13:23     ` Chong Yidong
  2008-07-24 14:05       ` Sven Joachim
@ 2008-07-24 14:35       ` Jason Rumney
  1 sibling, 0 replies; 9+ messages in thread
From: Jason Rumney @ 2008-07-24 14:35 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Sven Joachim, emacs-devel

Chong Yidong wrote:

> 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)?

Also what do other versions of the Linux kernel do on other more capable
filesystems if you set up ACLs in such a way that new files can be
created but their permissions can't be later changed (it may be possible
to set up the same scenario without ACLs by using combinations of setuid
and sticky bits on the destination directory)?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unable to copy directory recursively to a vfat partition
  2008-07-24 14:59         ` Stefan Monnier
@ 2008-07-24 14:57           ` Sven Joachim
  0 siblings, 0 replies; 9+ messages in thread
From: Sven Joachim @ 2008-07-24 14:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Chong Yidong, emacs-devel

On 2008-07-24 16:59 +0200, Stefan Monnier wrote:

>> 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:
>
> Assuming your meant "chmod", I agree.

Yes, of course I meant that.

Sven




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unable to copy directory recursively to a vfat partition
  2008-07-24 14:05       ` Sven Joachim
@ 2008-07-24 14:59         ` Stefan Monnier
  2008-07-24 14:57           ` Sven Joachim
  2008-07-24 16:19         ` Chong Yidong
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2008-07-24 14:59 UTC (permalink / raw)
  To: Sven Joachim; +Cc: Chong Yidong, emacs-devel

> 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:

Assuming your meant "chmod", I agree.


        Stefan




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: unable to copy directory recursively to a vfat partition
  2008-07-24 14:05       ` Sven Joachim
  2008-07-24 14:59         ` Stefan Monnier
@ 2008-07-24 16:19         ` Chong Yidong
  1 sibling, 0 replies; 9+ messages in thread
From: Chong Yidong @ 2008-07-24 16:19 UTC (permalink / raw)
  To: Sven Joachim; +Cc: 268-done, emacs-devel

Sven Joachim <svenjoac@gmx.de> writes:

> 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:

Checked in, thanks.




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-07-24 16:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-23 22:51 unable to copy directory recursively to a vfat partition Chong Yidong
2008-07-24  5:30 ` Sven Joachim
2008-07-24  5:54   ` Sven Joachim
2008-07-24 13:23     ` Chong Yidong
2008-07-24 14:05       ` Sven Joachim
2008-07-24 14:59         ` Stefan Monnier
2008-07-24 14:57           ` Sven Joachim
2008-07-24 16:19         ` Chong Yidong
2008-07-24 14:35       ` Jason Rumney

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).