From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 09 16:03:43 2020 Received: (at submit) by debbugs.gnu.org; 9 Jan 2020 21:03:43 +0000 Received: from localhost ([127.0.0.1]:53145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ipexz-0000U2-DX for submit@debbugs.gnu.org; Thu, 09 Jan 2020 16:03:43 -0500 Received: from lists.gnu.org ([209.51.188.17]:37406) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ipexx-0000Tv-Hh for submit@debbugs.gnu.org; Thu, 09 Jan 2020 16:03:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48542) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipexw-0000f5-0y for bug-gnu-emacs@gnu.org; Thu, 09 Jan 2020 16:03:41 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipexu-0003ue-OC for bug-gnu-emacs@gnu.org; Thu, 09 Jan 2020 16:03:39 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:34173) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipexu-0003mo-GU for bug-gnu-emacs@gnu.org; Thu, 09 Jan 2020 16:03:38 -0500 Received: by mail-wr1-x434.google.com with SMTP id t2so8980324wrr.1 for ; Thu, 09 Jan 2020 13:03:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=tkxJM6NdjOflEeTcfa82oJD8TlgWVV7vkhc2cjji5RU=; b=Jcj9DRS63DHTnwqhicvL73/j+YVhE0psQ6Og9Patd3vEF6NbruBU1PVqx4BMDPmGPc QhbMDZnvLtNL3W/Rt+7+qhFhVCzQYsGOiP1qHgrEc7bVEkvpXFYYqXnOKm1h3wpxrOzz hwEhH1vYzFtWwTivW8tGqwf3jhrpz699Z7rh+LUBE5sHB3FodK9DI7fBoJ7/ET9Ix61k sAdOTI+wc21EEZ53dCfkjarjZB6IMPmIFDxWDlW1H4RHQ7BLEoILmApapCKbQrI++ooa LU0llY6d2TjNnQf3BP8Kk3nUZjz3xi2V3vmzLbg7+v8mDKXCx6Xetu7YqNX39qAIA4Jr 39Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=tkxJM6NdjOflEeTcfa82oJD8TlgWVV7vkhc2cjji5RU=; b=jnxvIpkwCmJkZUG+DTxMrN5LfMAnjscP1XHFcJCPaqk/iyg9uJiiljU+QUev3c32Ig MTI/ZlOQiAaitzc1Z8gg/FsaFI1+HzXKWedih1/C3LWuMEFP8JHgesA6rUK5MA8sVADn jhmzvs6kV7KuFJNrvFL6KEFmAWDAMzyJP1ub19dQaPEPOY6BFOqUAwfBUqwNMGINyeuX E2DwWYS/uvYe57QTsgEgLir2eJVRwVQGVYMoH/1aWC9LjyTYbLX0rW9To5I/RB3DgHl5 MNQlQ7NrGXtNetbwHPxYDVj3HMPUqsy1Ej6/63/Ap6OqUniLCTtqzDkQwGTiP0H+CO9k KDJw== X-Gm-Message-State: APjAAAWnvsgKd8/PpsN1zt5M5UTG1ypCLVl4jADhFkWtxsmOZJigT4JC 7Y5NqKOd9GhPrnOC/tRq8giU93AN X-Google-Smtp-Source: APXvYqx9xuxWSoZzEDjrGl8x8M5xNAvMgpE3FkWH9A1ePgS7xnXkekJRGZYW7nPDZl1aoeiDMX9+Dg== X-Received: by 2002:a5d:6a02:: with SMTP id m2mr12409551wru.52.1578603816472; Thu, 09 Jan 2020 13:03:36 -0800 (PST) Received: from calancha-pc.dy.bbexcite.jp ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id t1sm4205513wma.43.2020.01.09.13.03.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2020 13:03:35 -0800 (PST) From: Tino Calancha To: bug-gnu-emacs@gnu.org Subject: 27.0.60; copy-file interactive VS from lisp disagreement Date: Thu, 09 Jan 2020 22:03:19 +0100 Message-ID: <87eew8z6js.fsf@calancha-pc.dy.bbexcite.jp> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::434 X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit 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.3 (--) Observed a disagreement when calling `copy-file' interactively VS calling it from Lisp. This is a recipe: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; emacs -Q: $ touch /tmp/foo M-x copy-file RET /tmp/foo RET ~/ RET ;; Received prompt: ;; File /home/calancha already exists; copy to it anyway? (y or n) ;; In the other hand, the following works, i.e., it creates ~/foo M-: (copy-file "/tmp/foo" "~/") => nil ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Reproduced w/ Emacs 26-27; with Emacs 25, the interactive call creates ~/foo as expected. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In GNU Emacs 27.0.60 (build 30, x86_64-pc-linux-gnu, GTK+ Version 3.24.5) of 2020-01-09 built on calancha-pc.dy.bbexcite.jp Repository revision: 58412402959d8f88e230f95c5fc7de072e115140 Repository branch: emacs-27 System Description: Debian GNU/Linux 10 (buster) Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. funcall-interactively: File already exists: /home/calancha nil Mark set Configured features: XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD PDUMPER LCMS2 GMP Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Dired by name Minor modes in effect: tooltip-mode: t global-eldoc-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 auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs text-property-search time-date subr-x seq mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils dired dired-loaddefs term/xterm xterm byte-opt gv bytecomp byte-compile cconv tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type 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 elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar 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 dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 53485 9324) (symbols 48 6097 1) (strings 32 15475 1668) (string-bytes 1 503791) (vectors 16 7253) (vector-slots 8 77927 8490) (floats 8 22 306) (intervals 56 2921 0) (buffers 1000 12)) From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 10 02:54:56 2020 Received: (at 39057) by debbugs.gnu.org; 10 Jan 2020 07:54:56 +0000 Received: from localhost ([127.0.0.1]:53627 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ipp8C-0004TW-60 for submit@debbugs.gnu.org; Fri, 10 Jan 2020 02:54:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43994) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ipp89-0004TF-UL for 39057@debbugs.gnu.org; Fri, 10 Jan 2020 02:54:54 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:42807) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ipp84-0007xh-Ko; Fri, 10 Jan 2020 02:54:48 -0500 Received: from [176.228.60.248] (port=3865 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ipp83-00024n-PY; Fri, 10 Jan 2020 02:54:48 -0500 Date: Fri, 10 Jan 2020 09:54:46 +0200 Message-Id: <837e1zagqh.fsf@gnu.org> From: Eli Zaretskii To: Tino Calancha In-reply-to: <87eew8z6js.fsf@calancha-pc.dy.bbexcite.jp> (message from Tino Calancha on Thu, 09 Jan 2020 22:03:19 +0100) Subject: Re: bug#39057: 27.0.60; copy-file interactive VS from lisp disagreement References: <87eew8z6js.fsf@calancha-pc.dy.bbexcite.jp> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39057 Cc: 39057@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 (---) > From: Tino Calancha > Date: Thu, 09 Jan 2020 22:03:19 +0100 > > Observed a disagreement when calling `copy-file' interactively VS calling > it from Lisp. > > This is a recipe: > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > emacs -Q: > $ touch /tmp/foo > M-x copy-file RET /tmp/foo RET ~/ RET > ;; Received prompt: > ;; File /home/calancha already exists; copy to it anyway? (y or n) I cannot reproduce this, so there must be more here than meets the eye, like whether /tmp/foo existed before the 'touch' command (and if so, what kind of file is it and what are its attributes), the contents of your home directory that could have something to do with this, etc. So please step through the code and tell where it fails and why. Alternatively, try reproducing this in a cleaner environment (a home directory and /tmp could have a lot of files), and see if something changes then. Or maybe you didn't actually type the slash in "~/" when invoking the command interactively? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 10 06:56:14 2020 Received: (at 39057) by debbugs.gnu.org; 10 Jan 2020 11:56:15 +0000 Received: from localhost ([127.0.0.1]:53732 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ipsti-00020w-MT for submit@debbugs.gnu.org; Fri, 10 Jan 2020 06:56:14 -0500 Received: from mail-wr1-f48.google.com ([209.85.221.48]:39367) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ipstg-00020j-Gd for 39057@debbugs.gnu.org; Fri, 10 Jan 2020 06:56:12 -0500 Received: by mail-wr1-f48.google.com with SMTP id y11so1537228wrt.6 for <39057@debbugs.gnu.org>; Fri, 10 Jan 2020 03:56:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=JoezD2FJLSrsj4yqzisPAdlJpxpTfiJhITDFM0M6CKM=; b=U+d5EDA7BvJ9a8N3LX1pi+6BFObo43/O+Nxin299OF4wZzQohh9rIevfBzhNl6mbqO bPQ2r+I0vix4cOCtAqCHFUlYN3TTbNN4nS3uvfVeren4xRgUe+z+jhCR0+6N84zWqoy2 RADTpvFB3vC+EKJ7Gd+AmS6niY5axnwqVZFkde0R6R+LE5beu5cuOqfOqGWCfaQ7ZBl+ rbDQHjf9wqP6CXArdzrdqHyx0qBVRdAn9ePlBcoBgZUQyku2OnNYPgEHDZd9KB2Pc7dO vCB6TBXxRqg8y376ErB06hfsx14Sfcz/kr4xkqS4BChabWVNTqYmdz2DLscora9+hZiF XDcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=JoezD2FJLSrsj4yqzisPAdlJpxpTfiJhITDFM0M6CKM=; b=GsKLGKszkUOHhplcvA/cI4GBkfxzOo7hvQPS6LjhnI9q2hlVwgeh1r1ebJLYAHRd5N 0Jj5NdrQgCk7EllCWgJLID9tROaYzkYxKJoI6OLqZSuMiETshbXDGNZF/sz3xckcP77h FfGfch80nRlPvcWmdx1TTt23Gw5MWrR6NQ936J/R1RmCKFj44DfDxif4O8alBsaP/s1v cb57v4uBc/DVx0Cl9Z/xvIuNeJTI5lrKF2fUutHcpuVCiCQ3HBq8uRhRDM5WKYOxwQfW avU44aTJJXwJcnIGik7twO7hCXl4/T74BYoGOBLgFG8QIZTtxHZsbTXsnnOERQhAEW3P MQCA== X-Gm-Message-State: APjAAAXQ4BTioZv2LpsnJThnSKC+KQKrkxGZRd67KTG9b2znJclJpwgO Kv9lEpASRHZovfU9pEEXAh4= X-Google-Smtp-Source: APXvYqwE2jnvjF7PPNLThOGLFmPmVTCONj/pdzZszCaEx12kkSoKorsNiHWz2zBQ926n/mmqVO70ZQ== X-Received: by 2002:a5d:4d0e:: with SMTP id z14mr3086697wrt.208.1578657366292; Fri, 10 Jan 2020 03:56:06 -0800 (PST) Received: from dhcp154.suse.cz (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id g9sm1962402wro.67.2020.01.10.03.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2020 03:56:05 -0800 (PST) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Fri, 10 Jan 2020 12:55:59 +0100 (CET) X-X-Sender: calancha@dhcp154.suse.cz To: Eli Zaretskii Subject: Re: bug#39057: 27.0.60; copy-file interactive VS from lisp disagreement In-Reply-To: <837e1zagqh.fsf@gnu.org> Message-ID: References: <87eew8z6js.fsf@calancha-pc.dy.bbexcite.jp> <837e1zagqh.fsf@gnu.org> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: 1.1 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > I cannot reproduce this, so there must be more here than meets the > eye > So please step through the code and tell where it fails and why. It seems NEWNAME, i.e., the second argument seeing by `copy-file' might be different when called interactively; this is true even if the user introduces the same value. Content analysis details: (1.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: repl.it] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tino.calancha[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.48 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.48 listed in wl.mailspike.net] 1.1 MALFORMED_FREEMAIL Bad headers on message from free email service X-Debbugs-Envelope-To: 39057 Cc: 39057@debbugs.gnu.org, Tino Calancha 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: -1.0 (-) > I cannot reproduce this, so there must be more here than meets the > eye > So please step through the code and tell where it fails and why. It seems NEWNAME, i.e., the second argument seeing by `copy-file' might be different when called interactively; this is true even if the user introduces the same value. I have printed out newname before the line newname = expand_cp_target (file, newname); at src/fileio.c I) M-: (copy-file "/tmp/foo" "~/") RET ;; it shows "~/" as expected II) M-x: copy-file RET /tmp/foo RET ~/ RET ;; it shows "~" (the '/' is missing) Apparentely, this was unnoticed because before Emacs 26 we were using predicate `file-directory-p` M-: (file-directory-p "~") RET => t After commit 'Fix race with rename-file etc. with dir NEWNAME' (01c885f21f343045783eb9ad1ff5f9b83d6cd789) we use `directory-name-p`, and the issue is revealed. (directory-name-p "~") => nil Since you cannot reproduce the issue, it might be platform dependent. I am able to reproduce it in this nice site, which runs Emacs 26.3 in a linux machine: https://repl.it/languages/elisp M-! touch /tmp/foo RET M-x copy-file RET /tmp/foo RET RET ;; received prompt ;; FILE /home/runner already exists; copy to it anyway? (yes or no) ;; Eval following forms from the *ielm* buffer (file-exists-p "~/foo") RET => nil (copy-file "/tmp/foo" "~/") => nil (file-exists-p "~/foo") RET => t From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 10 08:48:11 2020 Received: (at 39057) by debbugs.gnu.org; 10 Jan 2020 13:48:12 +0000 Received: from localhost ([127.0.0.1]:53800 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ipue3-0006hM-Jk for submit@debbugs.gnu.org; Fri, 10 Jan 2020 08:48:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47134) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ipue2-0006h7-57 for 39057@debbugs.gnu.org; Fri, 10 Jan 2020 08:48:10 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58576) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ipudw-0000B6-U3; Fri, 10 Jan 2020 08:48:04 -0500 Received: from [176.228.60.248] (port=1772 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ipudw-0004KD-0K; Fri, 10 Jan 2020 08:48:04 -0500 Date: Fri, 10 Jan 2020 15:48:02 +0200 Message-Id: <83wo9z8lt9.fsf@gnu.org> From: Eli Zaretskii To: Tino Calancha In-reply-to: (message from Tino Calancha on Fri, 10 Jan 2020 12:55:59 +0100 (CET)) Subject: Re: bug#39057: 27.0.60; copy-file interactive VS from lisp disagreement References: <87eew8z6js.fsf@calancha-pc.dy.bbexcite.jp> <837e1zagqh.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39057 Cc: 39057@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 (---) > From: Tino Calancha > Date: Fri, 10 Jan 2020 12:55:59 +0100 (CET) > cc: Tino Calancha , 39057@debbugs.gnu.org > > > I cannot reproduce this, so there must be more here than meets the > > eye > > So please step through the code and tell where it fails and why. > > It seems NEWNAME, i.e., the second argument seeing by `copy-file' might be different > when called interactively; this is true even if the user introduces the > same value. > > I have printed out newname before the line > newname = expand_cp_target (file, newname); > at src/fileio.c > > I) > M-: (copy-file "/tmp/foo" "~/") RET > ;; it shows "~/" as expected > > II) > M-x: copy-file RET /tmp/foo RET ~/ RET > ;; it shows "~" (the '/' is missing) Why would it be missing? which code removes it, if you typed it? > Since you cannot reproduce the issue, it might be platform dependent. > I am able to reproduce it in this nice site, which runs Emacs 26.3 in a linux machine: > https://repl.it/languages/elisp I couldn't reproduce on GNU/Linux either. > M-! touch /tmp/foo RET > M-x copy-file RET /tmp/foo RET RET > ;; received prompt > ;; FILE /home/runner already exists; copy to it anyway? (yes or no) This is a different use case. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 10 09:12:46 2020 Received: (at 39057) by debbugs.gnu.org; 10 Jan 2020 14:12:46 +0000 Received: from localhost ([127.0.0.1]:53817 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ipv1q-0007Qw-9Q for submit@debbugs.gnu.org; Fri, 10 Jan 2020 09:12:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49073) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ipv1o-0007Qk-SA for 39057@debbugs.gnu.org; Fri, 10 Jan 2020 09:12:45 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58805) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ipv1j-0006mK-GS; Fri, 10 Jan 2020 09:12:39 -0500 Received: from [176.228.60.248] (port=3262 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ipv1i-0000qN-4n; Fri, 10 Jan 2020 09:12:38 -0500 Date: Fri, 10 Jan 2020 16:12:37 +0200 Message-Id: <83v9pj8koa.fsf@gnu.org> From: Eli Zaretskii To: tino.calancha@gmail.com, Stefan Monnier In-reply-to: <83wo9z8lt9.fsf@gnu.org> (message from Eli Zaretskii on Fri, 10 Jan 2020 15:48:02 +0200) Subject: Re: bug#39057: 27.0.60; copy-file interactive VS from lisp disagreement References: <87eew8z6js.fsf@calancha-pc.dy.bbexcite.jp> <837e1zagqh.fsf@gnu.org> <83wo9z8lt9.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39057 Cc: 39057@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 (---) > Date: Fri, 10 Jan 2020 15:48:02 +0200 > From: Eli Zaretskii > Cc: 39057@debbugs.gnu.org > > > I have printed out newname before the line > > newname = expand_cp_target (file, newname); > > at src/fileio.c > > > > I) > > M-: (copy-file "/tmp/foo" "~/") RET > > ;; it shows "~/" as expected > > > > II) > > M-x: copy-file RET /tmp/foo RET ~/ RET > > ;; it shows "~" (the '/' is missing) > > Why would it be missing? which code removes it, if you typed it? Answering myself: this is a problem with completion routines: when the user types a file name that is exactly identical to the default (or just presses RET, which is the same), then the completion code in read-file-name-internal returns a value that has the trailing slash stripped. And we now require a trailing slash to recognize NEWNAME as a directory. Maybe Stefan can help us out here. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 13 13:37:33 2020 Received: (at 39057) by debbugs.gnu.org; 13 Jan 2020 18:37:33 +0000 Received: from localhost ([127.0.0.1]:60052 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ir4aj-000656-Kt for submit@debbugs.gnu.org; Mon, 13 Jan 2020 13:37:33 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:45820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ir4ai-00064t-GD for 39057@debbugs.gnu.org; Mon, 13 Jan 2020 13:37:32 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C261181F8E; Mon, 13 Jan 2020 13:37:26 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 312C88118C; Mon, 13 Jan 2020 13:37:25 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1578940645; bh=zSO737Z7cxnBJRlGw8Rc5pIoW198lQC/Te4C5MpfhXc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Jzk2l8h//mWbG7XvruHf2Fmx4AfwYz2ON5+nx9J/72bn+/+eS0cHnICpG8BBd+9up QIRnvdxscwkQuSryXgn68QBU3MURu8/GM+SNul/0d9MxSVhzzlWqSbd0mVkhIpzhYe 668FrjkgaOoaJ9cFs/SvhykuCa3zNCfOTQHSTufzEKhsTuzaF76yu7gy9nED4nQH0/ T9zgS9jMs8yjx9ukzqWL78ZOvC1kg31Y1NWijXegfY6NpLRwYXFky/DOpaAPpDtpd9 6TcxC29NQXCXhmyR6UL/3dEckLVPZbfJ1HG+lc/I41TQFPe/53fyQl/4ytz1Uor3PA JXdNw+50eFSmw== Received: from alfajor (modemcable157.163-203-24.mc.videotron.ca [24.203.163.157]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id EBF15120676; Mon, 13 Jan 2020 13:37:24 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#39057: 27.0.60; copy-file interactive VS from lisp disagreement Message-ID: References: <87eew8z6js.fsf@calancha-pc.dy.bbexcite.jp> <837e1zagqh.fsf@gnu.org> <83wo9z8lt9.fsf@gnu.org> <83v9pj8koa.fsf@gnu.org> Date: Mon, 13 Jan 2020 13:37:22 -0500 In-Reply-To: <83v9pj8koa.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 10 Jan 2020 16:12:37 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.111 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39057 Cc: 39057@debbugs.gnu.org, tino.calancha@gmail.com 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 (---) > Maybe Stefan can help us out here. I'll take a look at it ASAP, Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 15 15:35:55 2020 Received: (at 39057) by debbugs.gnu.org; 15 Jan 2020 20:35:55 +0000 Received: from localhost ([127.0.0.1]:35680 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1irpOJ-00039p-Lg for submit@debbugs.gnu.org; Wed, 15 Jan 2020 15:35:55 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:36604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1irpOE-00039V-Bi for 39057@debbugs.gnu.org; Wed, 15 Jan 2020 15:35:50 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id EC6DB44DE52; Wed, 15 Jan 2020 15:35:40 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 4B8A844DE2E; Wed, 15 Jan 2020 15:35:39 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1579120539; bh=y1b0AN8fgPlF12kFPANe5Q+KZilUIlslvxe2KgAMV3w=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=ZLVFbDYVA+S7vjHCXHFbIiXJd2DWV2ML5xWRF7lohRYtqyz4P38xYPvwxmG6XyGFT 5D1CxnEYuVVPBVXrPFGFR4o0urGLo1iKgGGVEEdjMcR89RofPbMkRx7PDGqnc6Z4tf NHrUvavGtlg8OydzVSFA5Dj7zXdaulgZra0zjWZ5icDH/+VGlhpQ7iCXmX0C7v7JIP HLgVMjfllrp9h+TMYZj+1KLYh2apPCmRK1yEK5KxdttXl7qMwpYWSyv6mnNs8YupoU POvjHiWxwUOZsJ0FvAgbbJvm3KW9rqhbdxiO28LJp7BdVXL+CW8/HMMmpsmbZ4XFhZ In+RLQzWgYUBw== Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 110671203C3; Wed, 15 Jan 2020 15:35:39 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#39057: 27.0.60; copy-file interactive VS from lisp disagreement Message-ID: References: <87eew8z6js.fsf@calancha-pc.dy.bbexcite.jp> <837e1zagqh.fsf@gnu.org> <83wo9z8lt9.fsf@gnu.org> <83v9pj8koa.fsf@gnu.org> Date: Wed, 15 Jan 2020 15:35:37 -0500 In-Reply-To: <83v9pj8koa.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 10 Jan 2020 16:12:37 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.077 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39057 Cc: 39057@debbugs.gnu.org, tino.calancha@gmail.com 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 (---) > Answering myself: this is a problem with completion routines: when the > user types a file name that is exactly identical to the default (or > just presses RET, which is the same), then the completion code in > read-file-name-internal returns a value that has the trailing slash > stripped. And we now require a trailing slash to recognize NEWNAME as > a directory. The problem seems to be linked to the value "" passed as `initial` to `read-file-name`, it doesn't show up with a nil value for `initial`. It seems to come from the following lines at the beginning of read-file-name-default: (unless default-filename (setq default-filename (if initial (expand-file-name initial dir) buffer-file-name))) because: M-: (expand-file-name "" "/tmp/") => "/tmp" `copy-file` uses a "" argument via the `G` interactive code: case 'F': /* Possibly nonexistent file name. */ args[i] = read_file_name (Qnil, Qnil, Qnil, Qnil); break; case 'G': /* Possibly nonexistent file name, default to directory alone. */ args[i] = read_file_name (Qnil, Qnil, empty_unibyte_string, Qnil); break; IOW it uses `G` since otherwise hitting just RET would return the `buffer-file-name` rather than the `default-directory`. I propose the patch below. Stefan diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 4a33d61afc..e12f7b1156 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3027,8 +3027,13 @@ read-file-name-default (unless dir (setq dir (or default-directory "~/"))) (unless (file-name-absolute-p dir) (setq dir (expand-file-name dir))) (unless default-filename - (setq default-filename (if initial (expand-file-name initial dir) - buffer-file-name))) + (setq default-filename + (cond + ((null initial) buffer-file-name) + ;; Special-case "" because (expand-file-name "" "/tmp/") returns + ;; "/tmp" rather than "/tmp/" (bug#39057). + ((equal "" initial) dir) + (t (expand-file-name initial dir))))) ;; If dir starts with user's homedir, change that to ~. (setq dir (abbreviate-file-name dir)) ;; Likewise for default-filename. From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 16 09:31:25 2020 Received: (at 39057) by debbugs.gnu.org; 16 Jan 2020 14:31:25 +0000 Received: from localhost ([127.0.0.1]:36952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1is6B7-0004ew-Gi for submit@debbugs.gnu.org; Thu, 16 Jan 2020 09:31:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43446) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1is6B2-0004eh-J0 for 39057@debbugs.gnu.org; Thu, 16 Jan 2020 09:31:20 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56909) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1is6Ax-0008QX-7H; Thu, 16 Jan 2020 09:31:11 -0500 Received: from [176.228.60.248] (port=4783 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1is6At-0001B3-SW; Thu, 16 Jan 2020 09:31:08 -0500 Date: Thu, 16 Jan 2020 16:31:25 +0200 Message-Id: <8336cf4gn6.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-reply-to: (message from Stefan Monnier on Wed, 15 Jan 2020 15:35:37 -0500) Subject: Re: bug#39057: 27.0.60; copy-file interactive VS from lisp disagreement References: <87eew8z6js.fsf@calancha-pc.dy.bbexcite.jp> <837e1zagqh.fsf@gnu.org> <83wo9z8lt9.fsf@gnu.org> <83v9pj8koa.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39057 Cc: 39057@debbugs.gnu.org, tino.calancha@gmail.com 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 (---) > From: Stefan Monnier > Cc: tino.calancha@gmail.com, 39057@debbugs.gnu.org > Date: Wed, 15 Jan 2020 15:35:37 -0500 > > IOW it uses `G` since otherwise hitting just RET would return the > `buffer-file-name` rather than the `default-directory`. > > I propose the patch below. LGTM, please install on the emacs-27 branch, and thanks. From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 16 10:20:50 2020 Received: (at 39057-done) by debbugs.gnu.org; 16 Jan 2020 15:20:50 +0000 Received: from localhost ([127.0.0.1]:38257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1is6ww-0008Dq-Nd for submit@debbugs.gnu.org; Thu, 16 Jan 2020 10:20:50 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:34247) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1is6wr-0008DX-46 for 39057-done@debbugs.gnu.org; Thu, 16 Jan 2020 10:20:45 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C08CC100DE1; Thu, 16 Jan 2020 10:20:35 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 065E210033A; Thu, 16 Jan 2020 10:20:34 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1579188034; bh=ij5fVzqPrdXJLCYws+1+Z5vtk7Q3FV/U1HaOR0KWgC8=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=nr19EVJN8P9KMS2qGq67HPLswCXQVIaEHVZOwPBEeIpahme4FEjAQMLs/4fUg3y0N nZa9DrGPBqevcBMyXotPL8wWfcjqY5ka7d7EfGn+gUDuoG/zwioyUOGp/6WPYFI5Pp YOY9v3ZxE9/3+DdOVpdLi422d7S4/UKD+pEV08UFQdrzs9Fr88oBpK3bAU+NRbp72N p5k5pQwMPr+geAhEBrQgguwV1pAo41iCkY/N5H/Higz6FM/rMWxXKwnMbIWb2/MTpw a70r/iV33OSe1riUsrDzDxQytSTlUCtaBub/SYnozu4c4NM1spYGFCzIGIjq/Rxq0d G5+Qw5AwK1xhA== Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D5E30120C32; Thu, 16 Jan 2020 10:20:33 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#39057: 27.0.60; copy-file interactive VS from lisp disagreement Message-ID: References: <87eew8z6js.fsf@calancha-pc.dy.bbexcite.jp> <837e1zagqh.fsf@gnu.org> <83wo9z8lt9.fsf@gnu.org> <83v9pj8koa.fsf@gnu.org> <8336cf4gn6.fsf@gnu.org> Date: Thu, 16 Jan 2020 10:20:32 -0500 In-Reply-To: <8336cf4gn6.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 16 Jan 2020 16:31:25 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.002 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39057-done Cc: 39057-done@debbugs.gnu.org, tino.calancha@gmail.com 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 (---) > LGTM, please install on the emacs-27 branch, and thanks. OK, done, Stefan From unknown Sat Aug 16 23:45:39 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 14 Feb 2020 12:24:07 +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