Subject: bug#55123: 29.0.50; archive-copy-file overwrites zip file in same dir

From: Петров Андрей <[email-masked]>
Date: Tue, 26 Apr 2022 10:36:03 +0000

Hello, team!

Try the following test:
1. start `emacs -Q`
2. create a file 2.txt with any content and save it. Consifer we are in
   ~/1/ directory.
3. zip the file:
   M-! zip 1.zip 2.txt [RET]
4. open resulting zip archive with dired
6. find 2.txt inside and archive-copy-file it into the same directory
   (the prompt is "Copy 2.txt to: ~/1/"):
   C [RET]
   now Emacs tries to overwrite the 1.zip archive instead of creating
   2.txt file in the same directory. 

If you specify file name or other directory (either with file name or
not) the file will be saved under name "2.txt". But when you specify the
same directory without file name the zip archive will be overwritten
regardless of correct prompt message.

Best regards, Andrey Petrov.

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.31, cairo version 1.17.4)
 of 2022-02-27 built on pva-msi
Repository revision: 2fdc7d504477198334c7de75c46585d1bcf19c40
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Arch Linux

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
WEBP X11 XDBE XIM XPM GTK3 ZLIB

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

Major mode: Zip-Archive

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-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
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr shortdoc help-fns radix-tree help-mode emacsbug
message mailcap yank-media rmc puny dired dired-loaddefs rfc822 mml
mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util
text-property-search seq gv byte-opt bytecomp byte-compile cconv
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils time-date subr-x cl-loaddefs cl-lib arc-mode archive-mode
shell pcomplete comint ansi-color ring cyril-util 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 keymap hashtable-print-readable backquote threads
dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 57004 10758)
 (symbols 48 6663 1)
 (strings 32 19515 1844)
 (string-bytes 1 613128)
 (vectors 16 12862)
 (vector-slots 8 176800 17627)
 (floats 8 64 23)
 (intervals 56 276 0)
 (buffers 992 14))