* Re: copy-directory [not found] ` <83zl87nw88.fsf@gnu.org> @ 2009-10-04 16:41 ` Stefan Monnier 2009-10-04 20:02 ` copy-directory Michael Albinus 2009-10-04 19:58 ` copy-directory Michael Albinus 1 sibling, 1 reply; 9+ messages in thread From: Stefan Monnier @ 2009-10-04 16:41 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Michael Albinus, emacs-devel > Please don't rely on the `chown' command being available for the > preserve-uid-gid option. Especially since chown only works for root anyway, and since I don't think we should cater specially for root-uses of Emacs (I rather discourage the use of Emacs when running as root), I'd rather we don't touch the uid. Stefan ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: copy-directory 2009-10-04 16:41 ` copy-directory Stefan Monnier @ 2009-10-04 20:02 ` Michael Albinus 2009-10-05 3:13 ` copy-directory Stefan Monnier 0 siblings, 1 reply; 9+ messages in thread From: Michael Albinus @ 2009-10-04 20:02 UTC (permalink / raw) To: Stefan Monnier; +Cc: Eli Zaretskii, emacs-devel Stefan Monnier <monnier@iro.umontreal.ca> writes: >> Please don't rely on the `chown' command being available for the >> preserve-uid-gid option. > > Especially since chown only works for root anyway, and since I don't > think we should cater specially for root-uses of Emacs (I rather > discourage the use of Emacs when running as root), I'd rather we don't > touch the uid. I've tried to be as close as possible to `copy-file'. There is the code #ifndef MSDOS /* Preserve the original file modes, and if requested, also its owner and group. */ if (input_file_statable_p) { if (! NILP (preserve_uid_gid)) fchown (ofd, st.st_uid, st.st_gid); fchmod (ofd, st.st_mode & 07777); } #endif /* not MSDOS */ Shall we add a subroutine function for this, as proposed by Eli? Or shall we remove PRESERVE-UID-GID from `copy-directory'? > Stefan Best regards, Michael. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: copy-directory 2009-10-04 20:02 ` copy-directory Michael Albinus @ 2009-10-05 3:13 ` Stefan Monnier 2009-10-05 7:22 ` copy-directory Michael Albinus 2009-10-05 7:57 ` copy-directory David Kastrup 0 siblings, 2 replies; 9+ messages in thread From: Stefan Monnier @ 2009-10-05 3:13 UTC (permalink / raw) To: Michael Albinus; +Cc: Eli Zaretskii, emacs-devel > Or shall we remove PRESERVE-UID-GID from `copy-directory'? I guess we can remove it for now, Stefan ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: copy-directory 2009-10-05 3:13 ` copy-directory Stefan Monnier @ 2009-10-05 7:22 ` Michael Albinus 2009-10-05 7:57 ` copy-directory David Kastrup 1 sibling, 0 replies; 9+ messages in thread From: Michael Albinus @ 2009-10-05 7:22 UTC (permalink / raw) To: Stefan Monnier; +Cc: Eli Zaretskii, emacs-devel@gnu.org Stefan Monnier <monnier@iro.umontreal.ca> writes: >> Or shall we remove PRESERVE-UID-GID from `copy-directory'? > > I guess we can remove it for now, OK, I'll do so. > Stefan Best regards, Michael. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: copy-directory 2009-10-05 3:13 ` copy-directory Stefan Monnier 2009-10-05 7:22 ` copy-directory Michael Albinus @ 2009-10-05 7:57 ` David Kastrup 2009-10-06 17:26 ` copy-directory Michael Albinus 1 sibling, 1 reply; 9+ messages in thread From: David Kastrup @ 2009-10-05 7:57 UTC (permalink / raw) To: emacs-devel Stefan Monnier <monnier@iro.umontreal.ca> writes: >> Or shall we remove PRESERVE-UID-GID from `copy-directory'? > > I guess we can remove it for now, I think that UID/GID should transparently be preserved when copying directories whenever possible (in particular when using /sudo:: methods or similar). I don't think that there is an important usage case for "don't preserve UID/GID even if you could": it would likely imply copying a tree and turning it into root/root possession on today's systems. I would like to add that before the time of disk quotas, the owner of a file was always able to do chown/chgrp on files (this cleared the setuid bit for security reasons, but that was it). It was the usual way of passing data to somebody else (and nobody other). -- David Kastrup ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: copy-directory 2009-10-05 7:57 ` copy-directory David Kastrup @ 2009-10-06 17:26 ` Michael Albinus 2009-10-06 18:50 ` copy-directory Eli Zaretskii 0 siblings, 1 reply; 9+ messages in thread From: Michael Albinus @ 2009-10-06 17:26 UTC (permalink / raw) To: emacs-devel David Kastrup <dak@gnu.org> writes: > Stefan Monnier <monnier@iro.umontreal.ca> writes: > >>> Or shall we remove PRESERVE-UID-GID from `copy-directory'? >> >> I guess we can remove it for now, > > I think that UID/GID should transparently be preserved when copying > directories whenever possible (in particular when using /sudo:: methods > or similar). I don't think that there is an important usage case for > "don't preserve UID/GID even if you could": it would likely imply > copying a tree and turning it into root/root possession on today's > systems. Although it is not on my top priority, I would second David. A primitive function `set-file-owner' would not harm, if it is explicitely said in the docstring, that it works only in the cases the underlying OS supports it. And a Tramp file name handler could be called for this, useful at least for "su" and "sudo" connections. What I'm curious: does change ownership work for other systems, like Win32? The smbclient, used in Tramp for "smb" connections, offers a chown subcommand ... maybe it is applicable only, if there is a Samba server at the other end. Best regards, Michael. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: copy-directory 2009-10-06 17:26 ` copy-directory Michael Albinus @ 2009-10-06 18:50 ` Eli Zaretskii 0 siblings, 0 replies; 9+ messages in thread From: Eli Zaretskii @ 2009-10-06 18:50 UTC (permalink / raw) To: Michael Albinus; +Cc: emacs-devel > From: Michael Albinus <michael.albinus@gmx.de> > Date: Tue, 06 Oct 2009 19:26:36 +0200 > > What I'm curious: does change ownership work for other systems, like > Win32? Yes, it does, if the process who calls the appropriate APIs has the required privileges. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: copy-directory [not found] ` <83zl87nw88.fsf@gnu.org> 2009-10-04 16:41 ` copy-directory Stefan Monnier @ 2009-10-04 19:58 ` Michael Albinus 2009-10-04 21:31 ` copy-directory Eli Zaretskii 1 sibling, 1 reply; 9+ messages in thread From: Michael Albinus @ 2009-10-04 19:58 UTC (permalink / raw) To: Eli Zaretskii; +Cc: emacs-devel Eli Zaretskii <eliz@gnu.org> writes: > Please don't rely on the `chown' command being available for the > preserve-uid-gid option. It is only available on Posix platforms. > Instead, please add a primitive to do this from within Emacs. I know that. But I do not know how important it is on W32. > And one more comment about the code: > > (mapc > (lambda (file) > (if (file-directory-p file) > (copy-directory file newname keep-time preserve-uid-gid parents) > (copy-file file newname t keep-time preserve-uid-gid))) > ;; We do not want to delete "." and "..". > (directory-files > directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")) > > Instead of this complicated regexp, isn't it easier to just filter out > "." and ".." by adding a suitable comparison to the function you map > of the files? I find it not easy to convince myself that the regexp > indeed matches every valid file name but those two. I've stolen it from `dired-re-no-dot'. One option would be to add a similar regexp to files.el, given that I have used it also in `delete-directory'? (And I will need it also in Tramp) Best regards, Michael. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: copy-directory 2009-10-04 19:58 ` copy-directory Michael Albinus @ 2009-10-04 21:31 ` Eli Zaretskii 0 siblings, 0 replies; 9+ messages in thread From: Eli Zaretskii @ 2009-10-04 21:31 UTC (permalink / raw) To: Michael Albinus; +Cc: emacs-devel > From: Michael Albinus <michael.albinus@gmx.de> > Cc: emacs-devel@gnu.org > Date: Sun, 04 Oct 2009 21:58:51 +0200 > > Eli Zaretskii <eliz@gnu.org> writes: > > > Please don't rely on the `chown' command being available for the > > preserve-uid-gid option. It is only available on Posix platforms. > > Instead, please add a primitive to do this from within Emacs. > > I know that. But I do not know how important it is on W32. NTFS, the native filesystem of Windows 2K/XP/Vista supports file ownership, so it's at least as important as on Posix. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-10-06 18:50 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <8763avuyt3.fsf@gmx.de> [not found] ` <83zl87nw88.fsf@gnu.org> 2009-10-04 16:41 ` copy-directory Stefan Monnier 2009-10-04 20:02 ` copy-directory Michael Albinus 2009-10-05 3:13 ` copy-directory Stefan Monnier 2009-10-05 7:22 ` copy-directory Michael Albinus 2009-10-05 7:57 ` copy-directory David Kastrup 2009-10-06 17:26 ` copy-directory Michael Albinus 2009-10-06 18:50 ` copy-directory Eli Zaretskii 2009-10-04 19:58 ` copy-directory Michael Albinus 2009-10-04 21:31 ` copy-directory Eli Zaretskii
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.