From unknown Sat Sep 06 00:11:12 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#58918 <58918@debbugs.gnu.org> To: bug#58918 <58918@debbugs.gnu.org> Subject: Status: 28.2; Copying files in dired Reply-To: bug#58918 <58918@debbugs.gnu.org> Date: Sat, 06 Sep 2025 07:11:12 +0000 retitle 58918 28.2; Copying files in dired reassign 58918 emacs submitter 58918 Skyler Mayfield severity 58918 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 31 04:14:18 2022 Received: (at submit) by debbugs.gnu.org; 31 Oct 2022 08:14:18 +0000 Received: from localhost ([127.0.0.1]:39435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opPw1-0008DK-MG for submit@debbugs.gnu.org; Mon, 31 Oct 2022 04:14:18 -0400 Received: from lists.gnu.org ([209.51.188.17]:45764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opPBV-00072M-Pu for submit@debbugs.gnu.org; Mon, 31 Oct 2022 03:26:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opPBU-0004Yb-Hm for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 03:26:13 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1opPBS-0002V9-8N for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 03:26:11 -0400 Received: by mail-ej1-x62d.google.com with SMTP id 13so27240693ejn.3 for ; Mon, 31 Oct 2022 00:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:subject:to:from:user-agent:from:to:cc :subject:date:message-id:reply-to; bh=LGEK+fQt57x+uMElVSM/NrB8whePrgBEDPcE7GQyuCg=; b=peUGmT3Iqw63MemoTemJBp2RnG5a3G2YGVw0m5rDuS4vCLG2aygXMN/Q8vIFd+ezNY vrrYcil0c6dkvWeK4feYTINP+9VY1vOSSaSoQ1PlsjruM/4S9Nd68cpby+2j1/8GBk6p 6bg5klwMDkb92CW5TqJOVaOAZHSiDPpWpVhZGtafy6/8jyl8tAXurCVGCsKoc8W2euZe ZtpseK8Y53itGOv13SFHuxQnlhFYPprqzALAfEB+yozhgudTXcnD1GtDN40jRY7DhM7G pR//JaehJT9BHOAOTNKX0AxNd5aqul8fUwYT+ZQhTTH/KurdlIaHEww9h1Iug0jkZKzw v0lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:subject:to:from:user-agent :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LGEK+fQt57x+uMElVSM/NrB8whePrgBEDPcE7GQyuCg=; b=X9kX8ZYHMZtri3iOJzLUItl3U14Qkqh1pQFj8r+SxH0alqFiZRrDZnIx4v2fBBaCtV /BRXizH3C3R+VGSORozFRsRDFxXwo8/ErTMsyv5xLCVRLX+MxJB4zE0kPwMBqT6D+slG Sqftkmaexd4eyBbdg2dQFLb31EZl0k18brIEPgxzlsX3aJQayi6ffmDjlyqkAFRVXr45 uXs7qDxlTpUch8UPZpkoWdsWKnSYVesE8x5aSR/D0Cq5APG2b5dMpXD+tDcva81wol8O PC2xMWe0r78rRN+MQ0h5h44aZEXihBDeI50DJOhf0+7nEgTvGSqOgJ8yPmrG9+ekhdmn mNUA== X-Gm-Message-State: ACrzQf2oZ5u/n/h/s7E8FNFWJ/v+6bLwqlkBRvyPCdZ437MDAbd+/Jf0 WdHVhuXWNiBzffJFyLuOpNY= X-Google-Smtp-Source: AMsMyM7VMyVc4XkFmSLzELqeI4kmtS1zMgHLxPmJft7HKxOekgn492oMmic0CjkToZPMgEokhcPNaA== X-Received: by 2002:a17:907:1c8a:b0:782:1a0d:3373 with SMTP id nb10-20020a1709071c8a00b007821a0d3373mr11010490ejc.135.1667201166427; Mon, 31 Oct 2022 00:26:06 -0700 (PDT) Received: from void (84-115-217-197.cable.dynamic.surfer.at. [84.115.217.197]) by smtp.gmail.com with ESMTPSA id f15-20020a17090631cf00b007a03313a78esm2651225ejf.20.2022.10.31.00.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 00:26:04 -0700 (PDT) User-agent: mu4e 1.8.10; emacs 28.2 From: Skyler Mayfield To: bug-gnu-emacs@gnu.org Subject: 28.2; Copying files in dired Date: Mon, 31 Oct 2022 08:25:27 +0100 Message-ID: <878rkw8nin.fsf@void.mail-host-address-is-not-set> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=skyler544@gmail.com; helo=mail-ej1-x62d.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 31 Oct 2022 04:14:15 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) I've discovered what seems might be a bug in the functions dired-do-copy and dired-do-rename. Copying or renaming files fails when attempting to merge directories. Consider the following: 1. Start emacs via emacs -Q 2. Navigate with dired to some safe, user-writable directory, such as your home directory. 3. Create two directories called testA and testB, with dired-create-directory for instance. 4. Inside ~/testA create another subdirectory called foo. 5. Create a file ~/testA/foo/bar and enter some example text. 6. In a dired buffer visiting ~/testA, mark the foo directory. 7. Copy the directory to the other directory, via dired-do-copy. This should prompt for a destination, ~/testA/ by default, so press backspace twice and complete the destination to ~/testB/ and press enter. 8. Now modify the file ~/testB/foo/bar and save it. (This step is actually optional as the outcome won't change either way.) 9. Switch back to the dired buffer visiting ~/testA/ and attempt to copy the foo directory to ~/testB/ again as in step 7. 10. You will be prompted to overwrite, press y or ! here to do so. Now you should be prompted to copy recursively, so type in yes and press enter. 11. The command fails with the error: Copy: '/home/clock/testA/foo' to '/home/clock/testB/' failed: (file-already-exists File exists /home/clock/testB/foo) My expectation here is that dired would recurse into the foo directory, and in the case that you have pressed y, it should ask if you would like to overwrite the file bar, and if you have pressed !, you shouldn't be prompted and the file should be overwritten. Furthermore, if the contents of ~/testA/foo differ further, with more subdirectories and files, those files should all be copied over as with the behavior of cp -r in bash. If you perform these same steps up to step 9, but in step 9 you use dired-do-rename, the resulting error changes to this: Move: '/home/clock/testA/foo' to '/home/clock/testB/foo' failed: (file-error Renaming Directory not empty /home/clock/testA/foo /home/clock/testB/foo) In GNU Emacs 28.2 (build 2, x86_64-unknown-linux-gnu, GTK+ Version 3.24.34, cairo version 1.16.0) of 2022-09-13 built on a-fsn-de Windowing system distributor 'The X.Org Foundation', version 11.0.12101004 System Description: Void Linux Configured using: 'configure --with-x-toolkit=gtk3 --with-xwidgets --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --bindir=/usr/bin --mandir=/usr/share/man --infodir=/usr/share/info --localstatedir=/var --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu '--libdir=${exec_prefix}/lib64' --with-file-notification=inotify --with-modules --with-jpeg --with-tiff --with-gif --with-png --with-xpm --with-rsvg --without-imagemagick --with-xml2 --with-gnutls --with-sound --with-m17n-flt --with-json --with-harfbuzz --with-cairo --with-libgmp --with-native-compilation 'CFLAGS=-fno-PIE -mtune=generic -O2 -pipe -g -fdebug-prefix-map=/builddir/emacs-28.2=.' 'CPPFLAGS= ' 'LDFLAGS=-no-pie -Wl,--as-needed '' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM XWIDGETS GTK3 ZLIB Important settings: value of $LC_COLLATE: C value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs auth-source eieio eieio-core eieio-loaddefs password-cache json map text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils apropos comp comp-cstr warnings rx cl-seq cl-macs cl-extra help-mode seq byte-opt gv bytecomp byte-compile cconv time-date subr-x cl-loaddefs cl-lib iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax 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 emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads xwidget-internal dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 89023 9463) (symbols 48 7940 1) (strings 32 23961 4125) (string-bytes 1 841821) (vectors 16 18290) (vector-slots 8 337377 23668) (floats 8 32 33) (intervals 56 307 0) (buffers 992 13)) From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 31 09:02:28 2022 Received: (at control) by debbugs.gnu.org; 31 Oct 2022 13:02:28 +0000 Received: from localhost ([127.0.0.1]:39740 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opUQu-0005I9-43 for submit@debbugs.gnu.org; Mon, 31 Oct 2022 09:02:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38950) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opUQn-0005Hm-KV; Mon, 31 Oct 2022 09:02:26 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opUQg-0006PY-Ka; Mon, 31 Oct 2022 09:02:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ktCnJJZxVIvxSPqCujvMQHBc2aygj1RNq7IdojRPMkU=; b=THNVBceqqPd9 zkuJYzndNAE/91ak3FiUF/pw28IUFkpjZIPeZDcRu8RJEQYY//nqdfJWvpzttqwNRPeTThTsEqf5/ OBh8cxxugVgvCgLykSSi75GhLdCIR5lwCsmkciF4LJXTPJeERHlx3q1/Oimu49GBMkYqxS9Ru5S6V ehpq4azFgtFuO94ZizpwzIcerFTmqxkz1YsXSTjm4kT4YetgAcVzw1wpoHhXn9bGo+/0g8zAV/J7s X0oML5XBS2YuPA/fTqIhVlbYPF3QVKxH6P4B90Tdt1pzaF/c7werUu4R/WkghIrI2N77hZ4uGlPnX AddwQdk6VSs0Dbas7x1uIg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opUQV-00080X-Lg; Mon, 31 Oct 2022 09:02:13 -0400 Date: Mon, 31 Oct 2022 15:01:47 +0200 Message-Id: <83wn8gdu4k.fsf@gnu.org> From: Eli Zaretskii To: Thierry Volpiatto , Paul Eggert In-Reply-To: <87y1sws6eq.fsf@posteo.net> (message from Thierry Volpiatto on Mon, 31 Oct 2022 08:54:28 +0000) Subject: Re: bug#58919: 28.2; dired-copy-file-recursive fails to overwrite directory References: <87y1sws6eq.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control Cc: 58919@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) merge 58919 58918 thanks > From: Thierry Volpiatto > Date: Mon, 31 Oct 2022 08:54:28 +0000 > > > This is a followup of this report on reddit: > https://www.reddit.com/r/emacs/comments/yha104/merging_directories_in_dired_am_i_doing_it_wrong/ Which was already reported as bug#58918... > When using dired-copy to copy a directory to another directory > containing a directory with the same name overwriting fails. > e.g. copy ~/tmp/test/foo/ to ~/tmp/test1/ fails when test1 contain foo/ > > The bug is IMHO in copy-directory 3th clause of this cond: > > (cond ((not (directory-name-p newname)) > ;; If NEWNAME is not a directory name, create it; > ;; that is where we will copy the files of DIRECTORY. > (make-directory newname parents)) > ;; NEWNAME is a directory name. If COPY-CONTENTS is non-nil, > ;; create NEWNAME if it is not already a directory; > ;; otherwise, create NEWNAME/[DIRECTORY-BASENAME]. > ((if copy-contents > (or parents (not (file-directory-p newname))) > (setq newname (concat newname > (file-name-nondirectory directory)))) > (make-directory (directory-file-name newname) parents)) > (t (setq follow t))) > > This change was introduced here: > > commit 047f02f00f602b9aef63ae8938e12f3f0ab481eb > Author: Paul Eggert > Date: Wed Sep 20 11:49:12 2017 -0700 > > Fix new copy-directory bug with empty dirs > > Problem reported by Afdam Plaice (Bug#28520) and by Eli Zaretskii > (Bug#28483#34). This is another bug that I introduced in my > recent copy-directory changes. > * lisp/files.el (copy-directory): Work with empty subdirectories, too. > * test/lisp/files-tests.el (files-tests--copy-directory): > Test for this bug. > > Reverting this change fix the bug. Paul, could you please look into this? I think this also affects bug#58721. Thanks. From unknown Sat Sep 06 00:11:12 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 21 Jan 2023 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator