unofficial mirror of bug-gnu-emacs@gnu.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: Tue, 24 Dec 2013 10:52:59 +0400	[thread overview]
Message-ID: <87lhzahh9w.fsf@wizzle.ran.pp.ru> (raw)
In-Reply-To: <52B8CE25.9080803@cs.ucla.edu> (Paul Eggert's message of "Mon, 23 Dec 2013 15:58:29 -0800")

Paul Eggert -> Artem Chuprina  @ Mon, 23 Dec 2013 15:58:29 -0800:

 >> As you appeal to GNU cp, see
 >> its default behavior: BY DEFAULT it TRIES to save permissions and
 >> owner/group

 PE> No, by default GNU cp does not try to copy either owner/group
 PE> or permissions to an existing destination.  It does not invoke
 PE> chmod or chown unless you use something like 'cp -p'.

You are wrong.

zsh% umask 
002
zsh% touch testfile
zsh% ls -l testfile
-rw-rw-r-- 1 ran ran 0 Дек 24 10:37 testfile
zsh% chmod 600 testfile
zsh% cp testfile testfile.copy
zsh% ls -l testfile.copy 
-rw------- 1 ran ran 0 Дек 24 10:38 testfile.copy

Debian GNU/Linux 7.3 (wheezy)

 >> I can create files there, but I cannot change
 >> their metainfo, because they are not mine.

 PE> This is an unusual setup, at least for me.
 PE> If I create a file, I should be able to change its metainformation.

Key phrase: "at least for me".  This is usual setup with FAT filesystems
on every multiuser system.  Because FAT cannot keep owner and there are
multiple users, it is mounted so that all the files belong to root or
another system user, not to some real user.

 PE> I expect this setup will cause problems with other applications,
 PE> not just Emacs.  GNU tar would be one example.

You are wrong again.

zsh% tar tvf ~/testfiles.tar
-rw------- ran/ran           0 2013-12-24 10:37 testfile
-rw------- ran/ran           0 2013-12-24 10:38 testfile.copy
zsh% cd /fat 
zsh% tar xvf ~/testfiles.tar 
testfile
testfile.copy
zsh% echo $?
0
zsh% ls -l testfile*
-rw-rw-rw- 1 root root 0 Дек 24 10:37 testfile
-rw-rw-rw- 1 root root 0 Дек 24 10:38 testfile.copy

 PE> That being said, we should be able to work around the problem
 PE> by having copy-file behave more like 'cp'.  That is, copy-file
 PE> should not invoke chmod by default; it should invoke chmod only
 PE> if it's told to preserve permissions (or preserve ownership,
 PE> since that often involves temporarily revoking permissions for
 PE> security reasons).  That way, plain copy-file should work with
 PE> your setup, although you'll still have trouble with
 PE> copy-file with the last arg t (which asks to copy permissions).

This is also reasonable behavior, but not the best one, and it is
inconsistent with such of GNU cp and GNU tar, as proved above.

 PE> Attached is a proposed patch to do that, against trunk bzr 115721.
 PE> Does it solve your problem?

I'll try to check it today.





  reply	other threads:[~2013-12-24  6:52 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
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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87lhzahh9w.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 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).