From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artem Chuprina Newsgroups: gmane.emacs.bugs Subject: bug#16133: 24.3; copy-file fails on chmod when copying to FAT filesystem Date: Tue, 24 Dec 2013 10:52:59 +0400 Message-ID: <87lhzahh9w.fsf@wizzle.ran.pp.ru> References: <52B62BC3.4050508@cs.ucla.edu> <83ob498s3q.fsf@gnu.org> <52B66414.1090709@cs.ucla.edu> <87y53czxz5.fsf@wizzle.ran.pp.ru> <52B7377C.3070004@cs.ucla.edu> <8738lkhcen.fsf@wizzle.ran.pp.ru> <52B8CE25.9080803@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1387868059 25485 80.91.229.3 (24 Dec 2013 06:54:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Dec 2013 06:54:19 +0000 (UTC) Cc: 16133@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 24 07:54:24 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VvLsj-000780-8J for geb-bug-gnu-emacs@m.gmane.org; Tue, 24 Dec 2013 07:54:21 +0100 Original-Received: from localhost ([::1]:36796 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvLsi-0007A3-Qa for geb-bug-gnu-emacs@m.gmane.org; Tue, 24 Dec 2013 01:54:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvLsY-00075x-CH for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2013 01:54:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VvLsR-0006Zl-2U for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2013 01:54:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VvLsQ-0006Zd-V2 for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2013 01:54:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VvLsQ-0007hh-EA for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2013 01:54:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Artem Chuprina Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Dec 2013 06:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16133 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed patch Original-Received: via spool by 16133-submit@debbugs.gnu.org id=B16133.138786800429562 (code B ref 16133); Tue, 24 Dec 2013 06:54:02 +0000 Original-Received: (at 16133) by debbugs.gnu.org; 24 Dec 2013 06:53:24 +0000 Original-Received: from localhost ([127.0.0.1]:37473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VvLrn-0007gj-39 for submit@debbugs.gnu.org; Tue, 24 Dec 2013 01:53:23 -0500 Original-Received: from minas.ran.pp.ru ([178.63.209.8]:54712) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VvLrh-0007gV-JH for 16133@debbugs.gnu.org; Tue, 24 Dec 2013 01:53:18 -0500 Original-Received: from [188.32.7.67] (helo=wizzle.ran.pp.ru) by minas.ran.pp.ru with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1VvLrZ-0004Ss-Nb; Tue, 24 Dec 2013 06:53:09 +0000 Original-Received: from ran by wizzle.ran.pp.ru with local (Exim 4.80) (envelope-from ) id 1VvLrQ-0002XA-6I; Tue, 24 Dec 2013 10:53:00 +0400 In-Reply-To: <52B8CE25.9080803@cs.ucla.edu> (Paul Eggert's message of "Mon, 23 Dec 2013 15:58:29 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:82488 Archived-At: 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.