GNU bug report logs - #49644
27.2; copy-directory fails when Unix socket file is present in the source directory tree

Previous Next

Package: emacs;

Reported by: Pierre Rouleau <prouleau001 <at> gmail.com>

Date: Mon, 19 Jul 2021 15:05:01 UTC

Severity: normal

Found in version 27.2

To reply to this bug, email your comments to 49644 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#49644; Package emacs. (Mon, 19 Jul 2021 15:05:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Pierre Rouleau <prouleau001 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 19 Jul 2021 15:05:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Pierre Rouleau <prouleau001 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.2; copy-directory fails when Unix socket file is present in the 
 source directory tree
Date: Mon, 19 Jul 2021 11:04:39 -0400
There is no Emacs crash involved here.  It's just a feature request.

Try `copy-directory' on a directory tree that contains one Unix socket.
Something like "~/elpa/gnupg" which often contains Unix socket files.
This will fail with an error stating that the Unix socket cannot be
copied.

Although its true that Unix sockets cannot be copied, it would be nice
to offer the users the ability to copy the directory tree anyway,
skipping the Unix socket files.

The function `copy-directory' does not provide a mechanism to skip the
copy of such files, so it becomes impossible to copy a directory tree
that contains such a file.  It would be useful to add argument to
provide the ability to skip such files.   Currently, the only way is to
override or advise the function `copy-file' when using `copy-directory'.

The cond clause at the end of `copy-directory' only supports
directories, symbolic links and normal files.  It does not support Unix
socket, which cannot be copied.  In some conditions users may want to
copy the directory tree even in the presence of Unix socket
files. Adding an optional argument for that would increase the
usefulness of the function while allowing user's code to document the
fact that they want (or don't want) to skip things like Unix sockets.

The latest version of files.el code in
https://github.com/emacs-mirror/emacs/blob/master/lisp/files.el#L6148 
still behaves like this.


In GNU Emacs 27.2 (build 1, x86_64-apple-darwin18.7.0)
of 2021-03-25 built on Mojave
System Description:  Mac OS X 10.14.6

Recent messages:
Generating autoloads for ztree-view.el...done
  INFO     Scraping files for pel-bundle-autoloads.el...100% 
Generating autoloads for ztree.el...done
  INFO     Scraping files for pel-bundle-autoloads.el...done
Wrote /Users/roup/.emacs.d/pel-bundle/pel-bundle-autoloads.el [2 times]
Restart Emacs to complete the process!
Type "q" in help window to delete it.
mouse-2, RET: find function's definition
\ is undefined
uncompressing files.el.gz...done

Configured using:
'configure --disable-silent-rules
--enable-locallisppath=/usr/local/share/emacs/site-lisp
--infodir=/usr/local/Cellar/emacs/27.2/share/info/emacs
--prefix=/usr/local/Cellar/emacs/27.2 --with-gnutls --without-x
--with-xml2 --without-dbus --with-modules --without-ns
--without-imagemagick --without-selinux'

Configured features:
NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB MODULES THREADS JSON PDUMPER GMP

Important settings:
  value of $LANG: en_CA.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  ido-everywhere: t
  which-key-mode: t
  winner-mode: t
  key-chord-mode: t
  lispy-mode: t
  flyspell-mode: t
  superword-mode: t
  global-anzu-mode: t
  anzu-mode: t
  recentf-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/Users/roup/.emacs.d/utils/origami hides /Users/roup/.emacs.d/elpa/origami-20200331.1019/origami
/Users/roup/.emacs.d/utils/origami-parsers hides /Users/roup/.emacs.d/elpa/origami-20200331.1019/origami-parsers
/Users/roup/.emacs.d/utils/sr-speedbar hides /Users/roup/.emacs.d/elpa/sr-speedbar-20161025.831/sr-speedbar
/Users/roup/.emacs.d/elpa/lispy-20210121.926/elpa hides /Users/roup/.emacs.d/elpa/ivy-20210602.1349/elpa
/Users/roup/.emacs.d/elpa/lfe-mode-20210603.1241/lfe-indent hides /usr/local/share/emacs/site-lisp/lfe/lfe-indent
/Users/roup/.emacs.d/elpa/lfe-mode-20210603.1241/lfe-mode hides /usr/local/share/emacs/site-lisp/lfe/lfe-mode
/Users/roup/.emacs.d/elpa/lfe-mode-20210603.1241/inferior-lfe hides /usr/local/share/emacs/site-lisp/lfe/inferior-lfe
/Users/roup/.emacs.d/elpa/rtags-20210313.1541/rtags hides /usr/local/share/emacs/site-lisp/rtags/rtags
/Users/roup/.emacs.d/elpa/rtags-xref-20200310.1909/rtags-xref hides /usr/local/share/emacs/site-lisp/rtags/rtags-xref
/Users/roup/.emacs.d/elpa/seq-2.22/seq hides /usr/local/Cellar/emacs/27.2/share/emacs/27.2/lisp/emacs-lisp/seq

Features:
(shadow sort mail-extr emacsbug message rmc puny format-spec rfc822 mml
mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs
text-property-search time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils jka-compr windmove eieio-opt
warnings emacros autoload lisp-mnt pel-setup pel-package pel-elpa
pel-filedir smex time benchmark-init-modes pel-benchmark ace-link
pel-skels-generic counsel xdg dired-x dired dired-loaddefs compile
comint ansi-color ido-grid ido pel-completion pel-seq which-key winner
pel-xref pel-text-transform pel-read pel-navigate pel-scroll key-seq
pel-key-chord key-chord term/xterm xterm tempo pel-skels-elisp
pel-text-insert pel-window pel-tempo pel-skels pel-prompt lispy pcase
swiper cl-extra ivy flx ivy-faces ivy-overlay colir color delsel
lispy-inline avy noutline outline easy-mmode etags fileloop generator
xref project edebug backtrace help-fns radix-tree help-mode lispy-tags
mode-local find-func pel__hydra hydra ring lv pel-lispy regexp-opt
flyspell pel-spell ispell cap-words superword subword imenu+ pel-imenu
imenu pel_keys anzu advice thingatpt recentf tree-widget wid-edit
speedbar sb-image ezimage image dframe pel-autoload pel--keys-macros
pel--options pel--macros pel--base pel finder-inf info tool-bar edmacro
kmacro package easymenu browse-url url-handlers url-parse auth-source
cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json
subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv
cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads kqueue multi-tty make-network-process emacs)

Memory information:
((conses 16 443285 23771)
(symbols 48 29623 1)
(strings 32 142354 5578)
(string-bytes 1 4079491)
(vectors 16 39237)
(vector-slots 8 884160 78722)
(floats 8 267 653)
(intervals 56 762 0)
(buffers 1000 16))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49644; Package emacs. (Mon, 19 Jul 2021 16:12:01 GMT) Full text and rfc822 format available.

Message #8 received at 49644 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Pierre Rouleau <prouleau001 <at> gmail.com>
Cc: 49644 <at> debbugs.gnu.org
Subject: Re: bug#49644: 27.2;
 copy-directory fails when Unix socket file is present in the source
 directory tree
Date: Mon, 19 Jul 2021 19:10:52 +0300
> From: Pierre Rouleau <prouleau001 <at> gmail.com>
> Date: Mon, 19 Jul 2021 11:04:39 -0400
> 
> There is no Emacs crash involved here.  It's just a feature request.
> 
> Try `copy-directory' on a directory tree that contains one Unix socket.
> Something like "~/elpa/gnupg" which often contains Unix socket files.
> This will fail with an error stating that the Unix socket cannot be
> copied.
> 
> Although its true that Unix sockets cannot be copied, it would be nice
> to offer the users the ability to copy the directory tree anyway,
> skipping the Unix socket files.
> 
> The function `copy-directory' does not provide a mechanism to skip the
> copy of such files, so it becomes impossible to copy a directory tree
> that contains such a file.  It would be useful to add argument to
> provide the ability to skip such files.   Currently, the only way is to
> override or advise the function `copy-file' when using `copy-directory'.

I think it would be more useful to add an optional behavior whereby
any file that cannot be copied for some reason would not terminate the
copy.  There's no need to allow such tolerance only for sockets.  I
could imagine a huge file that cannot be copied because the target
directory doesn't have enough space, for example.  Perhaps ask the
user whether to continue, when a copy fails, or provide a user option




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49644; Package emacs. (Mon, 19 Jul 2021 19:51:02 GMT) Full text and rfc822 format available.

Message #11 received at 49644 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Rouleau <prouleau001 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 49644 <at> debbugs.gnu.org
Subject: Re: bug#49644: 27.2; copy-directory fails when Unix socket file is
 present in the source directory tree
Date: Mon, 19 Jul 2021 15:50:32 -0400

> On Jul 19, 2021, at 12:10 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Pierre Rouleau <prouleau001 <at> gmail.com>
>> Date: Mon, 19 Jul 2021 11:04:39 -0400
>> 
>> There is no Emacs crash involved here.  It's just a feature request.
>> 
>> Try `copy-directory' on a directory tree that contains one Unix socket.
>> Something like "~/elpa/gnupg" which often contains Unix socket files.
>> This will fail with an error stating that the Unix socket cannot be
>> copied.
>> 
>> Although its true that Unix sockets cannot be copied, it would be nice
>> to offer the users the ability to copy the directory tree anyway,
>> skipping the Unix socket files.
>> 
>> The function `copy-directory' does not provide a mechanism to skip the
>> copy of such files, so it becomes impossible to copy a directory tree
>> that contains such a file.  It would be useful to add argument to
>> provide the ability to skip such files.   Currently, the only way is to
>> override or advise the function `copy-file' when using `copy-directory'.
> 
> I think it would be more useful to add an optional behavior whereby
> any file that cannot be copied for some reason would not terminate the
> copy.  There's no need to allow such tolerance only for sockets.  I
> could imagine a huge file that cannot be copied because the target
> directory doesn't have enough space, for example.  Perhaps ask the
> user whether to continue, when a copy fails, or provide a user option

I agree that supporting more use cases would be beneficial. 
It would be nice that no prompting is required though or at least that it would be possible to use the function in a non-interactive way.

Providing user-options might be the way. 
That would leave the signature intact and yet would allow introducing several new behaviours, 
whether prompting is used or not, what type of condition is ignored, etc…. 

For my use case I would at least need to be able to set a copy directory user-option to prevent copy-file from stopping on a Unix socket.



This bug report was last modified 4 years and 29 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.