all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Artem Chuprina <ran@lasgalen.net>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 16133@debbugs.gnu.org
Subject: bug#16133: 24.3; copy-file fails on chmod when copying to FAT filesystem
Date: Sun, 22 Dec 2013 19:50:22 +0400	[thread overview]
Message-ID: <87y53czxz5.fsf@wizzle.ran.pp.ru> (raw)
In-Reply-To: <52B66414.1090709@cs.ucla.edu> (Paul Eggert's message of "Sat, 21 Dec 2013 20:01:24 -0800")

Paul Eggert -> Eli Zaretskii  @ Sat, 21 Dec 2013 20:01:24 -0800:

 >> Emacs throws an error, and stops the copy operation,
 >> even if there are more files to copy.

 PE> copy-file copies just one file, so there can't be any more
 PE> files to copy.  When GNU 'cp' is acting like copy-file and
 PE> is copying just one file, it doesn't do anything more to the
 PE> file after fchmod fails -- it simply exits with nonzero status,
 PE> which corresponds to Emacs throwing an error.

Please note that, first, GNU cp HAS mode that allows to use in scripts
when copying to other filesystems.  That is, it has a mode in which it
returns success if it successfully copied file, but not its meta
information.  copy-file in emacs 24 - HAS NOT.  Moreover, GNU cp works
just in that mode BY DEFAULT.  That is, its authors do understand that
this is the mode of operation that most users want, not the mode that
fails in that situation.

So, if I write

#!/bin/sh -e
cp /from/ext2/filesystem/... /to/fat/filesystem/
# some code follows that depend on files on target

I get an error from cp ONLY if it could not copy file(s) (this is quite
reasonable, and this is just what most cp users want), not if it could
not copy permissions (this has no sense in this case at all, FAT
filesystem just has no permissions, and chmod always fails there).  If
for some strange reason I really insist on copying permissions also, I
should explicitly state it, and in this case this would be my fault, not
cp authors.

With copy-file in emacs24 I just cannot write such code, and moreover,
much code that used copy-file before, just stopped working.  (I've
mentioned org-mobile-push, and emacs' own file backup code, just to note
two).

Now ALL those libraries authors, including emacs authors, need to wrap
EVERY call to copy-file to catch code, and thoroughly filter exceptions
to check whether this was just chmod failure (which is acceptable) or
real copy failure.  Because in reality only copy problem is not
acceptable, not chmod problem.  This is the problem with copy-file.

And I don't remember exactly, but it seems to me that even defadvice is
not guaranteed to help, because copy-file is a primitive function, and
can be called from C code - I really suspect that backup problem cannot
be fixed by advice just by this reason.





  reply	other threads:[~2013-12-22 15:50 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-13 19:51 bug#16133: 24.3; copy-file fails on chmod when copying to FAT filesystem Artem Chuprina
2013-12-13 22:51 ` Glenn Morris
2013-12-13 22:55   ` Glenn Morris
2013-12-14 10:10   ` Artem Chuprina
2013-12-14 20:19     ` Glenn Morris
2013-12-14 20:46       ` Josh
2013-12-14 20:57         ` Eli Zaretskii
2013-12-14 21:21           ` Josh
2013-12-15  3:44             ` Eli Zaretskii
2013-12-14 20:55       ` Eli Zaretskii
2013-12-14 21:07       ` Achim Gratz
2013-12-15 14:38       ` Artem Chuprina
2013-12-16 14:15         ` Stefan Monnier
2013-12-20 23:27 ` Paul Eggert
2013-12-22  0:01 ` Paul Eggert
2013-12-22  3:47   ` Eli Zaretskii
2013-12-22  4:01     ` Paul Eggert
2013-12-22 15:50       ` Artem Chuprina [this message]
2013-12-22 19:03         ` Paul Eggert
2013-12-22 20:13           ` Artem Chuprina
2013-12-23 23:58             ` Paul Eggert
2013-12-24  6:52               ` Artem Chuprina
2013-12-24  9:58                 ` Andreas Schwab
2013-12-24 10:22                   ` Artem Chuprina
2013-12-24 17:39                     ` Paul Eggert
2013-12-24 16:51                 ` Artem Chuprina
2013-12-29 18:31                 ` Paul Eggert
2013-12-22 16:24       ` Eli Zaretskii
2013-12-22 17:37         ` Paul Eggert
2013-12-22 18:35           ` Eli Zaretskii
2013-12-22 18:54             ` Paul Eggert
2013-12-22 20:32               ` Artem Chuprina
2013-12-22 21:00               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y53czxz5.fsf@wizzle.ran.pp.ru \
    --to=ran@lasgalen.net \
    --cc=16133@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.