GNU bug report logs -
#24441
24.5; rename directory in dired to change case
Previous Next
Reported by: Brady Trainor <brady <at> bradyt.com>
Date: Thu, 15 Sep 2016 04:01:02 UTC
Severity: normal
Merged with 22300
Found in versions 24.5, 25.1.50
Fixed in version 26.1
Done: Ken Brown <kbrown <at> cornell.edu>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24441 in the body.
You can then email your comments to 24441 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Thu, 15 Sep 2016 04:01:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Brady Trainor <brady <at> bradyt.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 15 Sep 2016 04:01:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
If I have a directory `a', and try to rename it `A' in dired, it errors.
`(file-error Renaming Invalid argument /tmp/a /tmp/A/a)'.
In GNU Emacs 24.5.1 (x86_64-apple-darwin15.6.0, NS apple-appkit-1404.47)
of 2016-08-15 on heeere.PK5001Z
Windowing system distributor `Apple', version 10.3.1404
Configured using:
`configure --disable-dependency-tracking --disable-silent-rules
--enable-locallisppath=/usr/local/share/emacs/site-lisp
--infodir=/usr/local/Cellar/emacs/24.5/share/info/emacs
--prefix=/usr/local/Cellar/emacs/24.5 --without-x --with-xml2
--without-dbus --with-gnutls --with-rsvg --with-ns
--disable-ns-self-contained'
Important settings:
value of $LC_ALL: en_US.UTF-8
value of $LC_CTYPE: en_US.UTF-8
value of $LANG: en_US.UTF-8
locale-coding-system: nil
Major mode: Dired
Minor modes in effect:
global-auto-revert-mode: t
shell-dirtrack-mode: t
TeX-PDF-mode: t
evil-escape-mode: t
global-undo-tree-mode: t
gdb-many-windows: t
yas-global-mode: t
yas-minor-mode: t
dired-hide-details-mode: t
override-global-mode: t
winner-mode: t
tooltip-mode: t
electric-indent-mode: t
mouse-wheel-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
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
(file-error Renaming Invalid argument /Users/iam/my-learning-resources/x /Users/iam/my-learning-resources/X/x)
Quit
Delete x (y or n) y
Deleting...done
x -> X
Quit
Making completion list...
Quit
Making completion list...
Load-path shadows:
/Users/iam/.emacs.d/elpa/helm-20160409.357/helm-multi-match hides /Users/iam/.emacs.d/elpa/helm-core-20160407.2135/helm-multi-match
/Users/iam/.emacs.d/elpa/color-theme-solarized-20160219.924/solarized-theme hides /Users/iam/.emacs.d/elpa/solarized-theme-1.2.2/solarized-theme
/Users/iam/.emacs.d/elpa/circe-20160119.11/tracking hides /Users/iam/.emacs.d/elpa/tracking-20151129.319/tracking
/Users/iam/.emacs.d/elpa/circe-20160119.11/shorten hides /Users/iam/.emacs.d/elpa/tracking-20151129.319/shorten
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-xact hides /usr/local/share/emacs/site-lisp/ledger/ledger-xact
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-texi hides /usr/local/share/emacs/site-lisp/ledger/ledger-texi
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-test hides /usr/local/share/emacs/site-lisp/ledger/ledger-test
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-state hides /usr/local/share/emacs/site-lisp/ledger/ledger-state
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-sort hides /usr/local/share/emacs/site-lisp/ledger/ledger-sort
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-schedule hides /usr/local/share/emacs/site-lisp/ledger/ledger-schedule
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-report hides /usr/local/share/emacs/site-lisp/ledger/ledger-report
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-regex hides /usr/local/share/emacs/site-lisp/ledger/ledger-regex
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-reconcile hides /usr/local/share/emacs/site-lisp/ledger/ledger-reconcile
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-post hides /usr/local/share/emacs/site-lisp/ledger/ledger-post
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-occur hides /usr/local/share/emacs/site-lisp/ledger/ledger-occur
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-navigate hides /usr/local/share/emacs/site-lisp/ledger/ledger-navigate
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-mode hides /usr/local/share/emacs/site-lisp/ledger/ledger-mode
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-init hides /usr/local/share/emacs/site-lisp/ledger/ledger-init
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-fonts hides /usr/local/share/emacs/site-lisp/ledger/ledger-fonts
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-fontify hides /usr/local/share/emacs/site-lisp/ledger/ledger-fontify
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-exec hides /usr/local/share/emacs/site-lisp/ledger/ledger-exec
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-context hides /usr/local/share/emacs/site-lisp/ledger/ledger-context
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-complete hides /usr/local/share/emacs/site-lisp/ledger/ledger-complete
/Users/iam/.emacs.d/elpa/ledger-mode-20160111.1834/ledger-commodities hides /usr/local/share/emacs/site-lisp/ledger/ledger-commodities
Features:
(shadow sort mail-extr emacsbug message idna rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils misearch
multi-isearch wdired dired-aux pdf-outline pdf-links pdf-isearch
let-alist pdf-misc imenu face-remap lisp-mnt finder-inf doc-view
tramp-cache tramp-sh tramp tramp-compat tramp-loaddefs trampver
helm-bookmark helm-net browse-url xml url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
url-parse auth-source gnus-util mm-util mail-prsvr password-cache
url-vars mailcap helm-adaptive helm-info helm-plugin helm-utils
helm-types helm-help helm helm-source eieio eieio-core helm-multi-match
helm-lib server paren autorevert filenotify bracketed-paste shm
shm-debug shm-manipulation shm-nav shm-yank-kill shm-type shm-constraint
shm-edit-string shm-insert-del shm-languages shm-stack shm-indent
shm-simple-indent shm-slot shm-layout shm-ast shm-overlays shm-in
shm-node shm-ast-documentation shm-customizations shm-evaporate
shm-macros outshine outorg rainbow-delimiters evil-leader dropdown-list
graphviz-dot-mode org-protocol ob-sh shell ob-scheme ob-python ob-org
ob-makefile ob-ledger ob-latex ob-js ob-C cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs org
org-macro org-footnote org-pcomplete org-list org-faces org-entities
time-date org-version ob-emacs-lisp org-loaddefs find-func cal-menu
calendar cal-loaddefs ob-haskell ob ob-tangle ob-ref ob-lob ob-table
ob-exp org-src ob-keys ob-comint ob-core ob-eval org-compat org-macs
weechat-complete pcomplete weechat-button weechat weechat-color
weechat-relay weechat-core s ucs-normalize tex crm evil-escape evil
evil-integration undo-tree diff evil-maps evil-commands
evil-command-window evil-types evil-search evil-ex evil-macros
evil-repeat evil-states evil-core evil-common thingatpt rect
evil-digraphs evil-vars gdb-mi bindat json gud haskell-snippets
yasnippet nlinum linum exec-path-from-shell haskell-mode
haskell-indentation haskell-string haskell-sort-imports haskell-lexeme
rx haskell-align-imports haskell-compat haskell-complete-module noutline
outline flymake etags dabbrev haskell-customize bookmark+ bookmark+-key
derived dired-x dired bookmark+-1 bookmark+-bmu help-mode bookmark+-lit
autoinsert pdf-tools compile comint ansi-color cus-edit cus-start
cus-load wid-edit pdf-view mule-util bookmark pp jka-compr pdf-cache
pdf-info tq pdf-util byte-opt advice format-spec image-mode use-package
diminish bytecomp byte-compile cl-extra cconv bind-key easy-mmode
tex-site help-fns cl-macs cl gv info easymenu package epg-config
windmove winner ring edmacro kmacro cl-loaddefs cl-lib tooltip electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer 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 make-network-process
cocoa ns multi-tty emacs)
Memory information:
((conses 16 636015 31930)
(symbols 48 50457 0)
(miscs 40 746 1251)
(strings 32 123811 14666)
(string-bytes 1 14700604)
(vectors 16 68251)
(vector-slots 8 1104614 23015)
(floats 8 3927 904)
(intervals 56 2724 0)
(buffers 960 38))
--
Brady
Brady Trainor
brady <at> bradyt.com
206-898-4124
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Thu, 15 Sep 2016 09:06:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 24441 <at> debbugs.gnu.org (full text, mbox):
Thanks for your report.
On Thu, 14 Sep 2016, Brady Trainor wrote:
>If I have a directory `a', and try to rename it `A' in dired, it errors.
>`(file-error Renaming Invalid argument /tmp/a /tmp/A/a)'.
How did you try to rename it? What exact commands did you input?
In Dired i would do this operation using `R' or `wdired' as follows:
I)
emacs -Q -r
M-: (dired temporary-file-directory) RET
+ a RET
R A RET
II)
emacs -Q -r
M-: (dired temporary-file-directory) RET
+ b RET
C-x C-q M-u C-c C-c
I have tried both in emacs-24.5.1 and they works as expected.
Could you check if I), II) work for you?
Tino
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Thu, 15 Sep 2016 09:29:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 24441 <at> debbugs.gnu.org (full text, mbox):
On Sep 15 2016, Brady Trainor <brady <at> bradyt.com> wrote:
> If I have a directory `a', and try to rename it `A' in dired, it errors.
>
> `(file-error Renaming Invalid argument /tmp/a /tmp/A/a)'.
That's because your filesystem is case-insensitve, thus /tmp/A already
exists.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Thu, 15 Sep 2016 13:44:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 24441 <at> debbugs.gnu.org (full text, mbox):
> > If I have a directory `a', and try to rename it `A' in dired, it errors.
> > `(file-error Renaming Invalid argument /tmp/a /tmp/A/a)'.
>
> That's because your filesystem is case-insensitve, thus /tmp/A already
> exists.
FWIW, MS Windows is case-insensitive, but it nevertheless shows
files and directories using both uppercase and lowercase letters.
And it lets you rename "aa" to "AA", "Aa", etc. The fact that
the file already exists does not prevent you from renaming it
to use different letter case.
And for MS Windows, at least, Emacs supports this as well,
including using Dired.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Thu, 15 Sep 2016 14:33:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 24441 <at> debbugs.gnu.org (full text, mbox):
> From: Andreas Schwab <schwab <at> suse.de>
> Date: Thu, 15 Sep 2016 11:28:25 +0200
> Cc: 24441 <at> debbugs.gnu.org
>
> On Sep 15 2016, Brady Trainor <brady <at> bradyt.com> wrote:
>
> > If I have a directory `a', and try to rename it `A' in dired, it errors.
> >
> > `(file-error Renaming Invalid argument /tmp/a /tmp/A/a)'.
>
> That's because your filesystem is case-insensitve, thus /tmp/A already
> exists.
Right. This is a duplicate of bug#22300. As explained there, patches
are welcome to introduce a run-time test for case-sensitivity of the
underlying filesystem, which then could enable on Darwin the same code
as we already use on MS-Windows.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Thu, 15 Sep 2016 14:50:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 24441 <at> debbugs.gnu.org (full text, mbox):
> Date: Thu, 15 Sep 2016 06:43:21 -0700 (PDT)
> From: Drew Adams <drew.adams <at> oracle.com>
> Cc: 24441 <at> debbugs.gnu.org
>
> FWIW, MS Windows is case-insensitive, but it nevertheless shows
> files and directories using both uppercase and lowercase letters.
> And it lets you rename "aa" to "AA", "Aa", etc. The fact that
> the file already exists does not prevent you from renaming it
> to use different letter case.
That's because we have special code for that, which is only compiled
in the Windows build.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Thu, 15 Sep 2016 14:58:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 24441 <at> debbugs.gnu.org (full text, mbox):
>>>> If I have a directory `a', and try to rename it `A' in dired, it errors.
>>>> `(file-error Renaming Invalid argument /tmp/a /tmp/A/a)'.
>>>
>>> That's because your filesystem is case-insensitve, thus /tmp/A already
>>> exists.
> >
> > FWIW, MS Windows is case-insensitive, but it nevertheless shows
> > files and directories using both uppercase and lowercase letters.
> > And it lets you rename "aa" to "AA", "Aa", etc. The fact that
> > the file already exists does not prevent you from renaming it
> > to use different letter case.
>
> That's because we have special code for that, which is only compiled
> in the Windows build.
OK. And good.
My point was that it is not necessarily the case that, for Emacs,
_just because_ a filesystem is case-insensitive, you cannot
rename a file to the same name but with a different letter case.
It is also the case that, for MS Windows at least, you can do
such renaming outside Emacs (with Windows Explorer, for instance).
Some other OS might not allow for such renaming. But for at least
some OSes such renaming is possible, including for Emacs.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Thu, 15 Sep 2016 15:21:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 24441 <at> debbugs.gnu.org (full text, mbox):
> Date: Thu, 15 Sep 2016 07:57:40 -0700 (PDT)
> From: Drew Adams <drew.adams <at> oracle.com>
> Cc: schwab <at> suse.de, brady <at> bradyt.com, 24441 <at> debbugs.gnu.org
>
> My point was that it is not necessarily the case that, for Emacs,
> _just because_ a filesystem is case-insensitive, you cannot
> rename a file to the same name but with a different letter case.
See the bug I pointed to, where John explained that OS X filesystems
can be either case-sensitive or case-insensitive. Unlike on Windows,
Emacs cannot assume file names are always case-insensitive, so a
run-time test is needed, and someone needs to write the code to do it.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Thu, 15 Sep 2016 16:03:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 24441 <at> debbugs.gnu.org (full text, mbox):
On 9/15/2016 11:20 AM, Eli Zaretskii wrote:
>> Date: Thu, 15 Sep 2016 07:57:40 -0700 (PDT)
>> From: Drew Adams <drew.adams <at> oracle.com>
>> Cc: schwab <at> suse.de, brady <at> bradyt.com, 24441 <at> debbugs.gnu.org
>>
>> My point was that it is not necessarily the case that, for Emacs,
>> _just because_ a filesystem is case-insensitive, you cannot
>> rename a file to the same name but with a different letter case.
>
> See the bug I pointed to, where John explained that OS X filesystems
> can be either case-sensitive or case-insensitive.
FWIW, this is also true on Cygwin:
https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-casesensitive
Ken
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Thu, 15 Sep 2016 16:37:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 24441 <at> debbugs.gnu.org (full text, mbox):
> Cc: 24441 <at> debbugs.gnu.org, schwab <at> suse.de, brady <at> bradyt.com
> From: Ken Brown <kbrown <at> cornell.edu>
> Date: Thu, 15 Sep 2016 12:03:08 -0400
>
> > See the bug I pointed to, where John explained that OS X filesystems
> > can be either case-sensitive or case-insensitive.
>
> FWIW, this is also true on Cygwin:
>
>
> https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-casesensitive
I was under the impression that most or all Cygwin users do use
case-sensitive file names. Otherwise, quite a few packages that come
from Posix platforms will not work or mysteriously fail.
But if that's not the reality, then yes, a patch to add a run-time
test for Cygwin will also be welcome.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Thu, 10 Nov 2016 22:26:01 GMT)
Full text and
rfc822 format available.
Message #35 received at 24441 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 9/15/2016 12:36 PM, Eli Zaretskii wrote:
>> Cc: 24441 <at> debbugs.gnu.org, schwab <at> suse.de, brady <at> bradyt.com
>> From: Ken Brown <kbrown <at> cornell.edu>
>> Date: Thu, 15 Sep 2016 12:03:08 -0400
>>
>>> See the bug I pointed to, where John explained that OS X filesystems
>>> can be either case-sensitive or case-insensitive.
>>
>> FWIW, this is also true on Cygwin:
>>
>>
>> https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-casesensitive
>
> I was under the impression that most or all Cygwin users do use
> case-sensitive file names.
I don't know for sure, but I would guess the opposite, simply because
using case-sensitivity requires reading the documentation and changing a
registry entry.
> But if that's not the reality, then yes, a patch to add a run-time
> test for Cygwin will also be welcome.
The attached patch attempts to do this for both Cygwin and OS X. I
don't have access to an OS X system, so someone else will have to test
the OS X part.
Ken
[0001-Check-case-sensitivity-when-renaming-files.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Fri, 11 Nov 2016 01:44:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 24441 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 11/10/2016 5:25 PM, Ken Brown wrote:
> The attached patch attempts to do this for both Cygwin and OS X. I
> don't have access to an OS X system, so someone else will have to test
> the OS X part.
Here's a simpler version.
Ken
[0001-Check-case-sensitivity-when-renaming-files.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Fri, 11 Nov 2016 08:28:01 GMT)
Full text and
rfc822 format available.
Message #41 received at 24441 <at> debbugs.gnu.org (full text, mbox):
> Cc: 24441 <at> debbugs.gnu.org, schwab <at> suse.de, brady <at> bradyt.com
> From: Ken Brown <kbrown <at> cornell.edu>
> Date: Thu, 10 Nov 2016 20:42:53 -0500
>
> On 11/10/2016 5:25 PM, Ken Brown wrote:
> > The attached patch attempts to do this for both Cygwin and OS X. I
> > don't have access to an OS X system, so someone else will have to test
> > the OS X part.
>
> Here's a simpler version.
Thanks, please see a few comments below.
> + (if (and (file-name-case-insensitive-p
> + (expand-file-name (car fn-list)))
You shouldn't need to expand-file-name here, as all primitives do that
internally. (Yours didn't, but that's a mistake, see below.)
> +/* Filesystems are case-sensitive on all supported systems except
> + MS-Windows, MS-DOS, Cygwin, and OS X. They are always
> + case-insensitive on the first two, but they may or may not be
> + case-insensitive on Cygwin and OS X. The following function
> + attempts to provide a runtime test on those two systems. If the
> + test is not conclusive, we assume case-insensitivity on Cygwin and
> + case-sensitivity on OS X. */
> +static bool
> +file_name_case_insensitive_p (const char *filename)
What about filesystems mounted on Posix hosts, like Samba, NFS-mounted
Windows volumes, etc. -- do those behave as case-sensitive or not? If
the latter, can that be detected? Just asking, this shouldn't hold
the patch, unless incorporating that is easy (or you feel like it even
if it isn't ;-).
> +DEFUN ("file-name-case-insensitive-p", Ffile_name_case_insensitive_p,
> + Sfile_name_case_insensitive_p, 1, 1, 0,
> + doc: /* Return t if file FILENAME is on a case-insensitive filesystem.
> +The arg must be a string. */)
> + (Lisp_Object filename)
> +{
> + CHECK_STRING (filename);
> + return file_name_case_insensitive_p (SSDATA (filename)) ? Qt : Qnil;
> +}
This "needs work"™. First, it should call expand-file-name, as all
file-related primitives do. Second, it should see if there's a file
handler for this operation, and if so, call it instead (Michael,
please take note ;-). Finally, it should run the expanded file name
through ENCODE_FILE before it calls file_name_case_insensitive_p, and
pass to the latter the result of the encoding, otherwise the call to
getattrlist will most certainly fail in some cases.
> DEFUN ("rename-file", Frename_file, Srename_file, 2, 3,
> "fRename file: \nGRename %s to file: \np",
> doc: /* Rename FILE as NEWNAME. Both args must be strings.
> @@ -2250,12 +2301,11 @@ This is what happens in interactive use with M-x. */)
> file = Fexpand_file_name (file, Qnil);
>
> if ((!NILP (Ffile_directory_p (newname)))
> -#ifdef DOS_NT
> - /* If the file names are identical but for the case,
> - don't attempt to move directory to itself. */
> - && (NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname))))
> -#endif
> - )
> + /* If the filesystem is case-insensitive and the file names are
> + identical but for the case, don't attempt to move directory
> + to itself. */
> + && (NILP (Ffile_name_case_insensitive_p (file))
> + || NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname)))))
This should call file_name_case_insensitive_p, and pass it the encoded
file names. That's because the file handlers for rename-file were
already called, so we are now sure the file doesn't have any handlers.
> @@ -2276,14 +2326,12 @@ This is what happens in interactive use with M-x. */)
> encoded_file = ENCODE_FILE (file);
> encoded_newname = ENCODE_FILE (newname);
>
> -#ifdef DOS_NT
> - /* If the file names are identical but for the case, don't ask for
> - confirmation: they simply want to change the letter-case of the
> - file name. */
> - if (NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname))))
> -#endif
> - if (NILP (ok_if_already_exists)
> - || INTEGERP (ok_if_already_exists))
> + /* If the filesystem is case-insensitive and the file names are
> + identical but for the case, don't ask for confirmation: they
> + simply want to change the letter-case of the file name. */
> + if ((NILP (Ffile_name_case_insensitive_p (file))
Likewise here.
Finally, please provide a NEWS entry for the new primitive and its
documentation in the ELisp manual.
Thanks again for working on this.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Fri, 11 Nov 2016 16:25:02 GMT)
Full text and
rfc822 format available.
Message #44 received at 24441 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
Hi Eli,
>> +/* Filesystems are case-sensitive on all supported systems except
>> + MS-Windows, MS-DOS, Cygwin, and OS X. They are always
>> + case-insensitive on the first two, but they may or may not be
>> + case-insensitive on Cygwin and OS X. The following function
>> + attempts to provide a runtime test on those two systems. If the
>> + test is not conclusive, we assume case-insensitivity on Cygwin and
>> + case-sensitivity on OS X. */
>> +static bool
>> +file_name_case_insensitive_p (const char *filename)
>
> What about filesystems mounted on Posix hosts, like Samba, NFS-mounted
> Windows volumes, etc. -- do those behave as case-sensitive or not? If
> the latter, can that be detected? Just asking, this shouldn't hold
> the patch, unless incorporating that is easy (or you feel like it even
> if it isn't ;-).
>
>> +DEFUN ("file-name-case-insensitive-p", Ffile_name_case_insensitive_p,
>> + Sfile_name_case_insensitive_p, 1, 1, 0,
>> + doc: /* Return t if file FILENAME is on a case-insensitive filesystem.
>> +The arg must be a string. */)
>> + (Lisp_Object filename)
>> +{
>> + CHECK_STRING (filename);
>> + return file_name_case_insensitive_p (SSDATA (filename)) ? Qt : Qnil;
>> +}
>
> This "needs work"™. First, it should call expand-file-name, as all
> file-related primitives do. Second, it should see if there's a file
> handler for this operation, and if so, call it instead (Michael,
> please take note ;-).
The same comment as for mounted fileystems is also valid for remote
files. Remote smb files could be or could be not case sensitive. The
same for remote files on Darwin macOS systems. I don't know whether this
could be detected automatically.
Furthermore, there are also other file name handlers in game. Think
about ange-ftp (ftp connections), think about url-handler-mode (http
connections and friends). One cannot know, whether the remote side is
case sensitive, or not.
In case it cannot be detected trustworthy, one could use default
assumptions depending on what the remote side is running. And a user
should be able to overwrite this assumption by setting a
connection-local variable for a remote machine, like
`case-insensitive-p'. Tramp and the orther file name handlers would take
this instead of its own heuristic, if this variable exists.
> Thanks again for working on this.
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Fri, 11 Nov 2016 21:43:01 GMT)
Full text and
rfc822 format available.
Message #47 received at 24441 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 11/11/2016 3:27 AM, Eli Zaretskii wrote:
> Thanks, please see a few comments below.
>
>> + (if (and (file-name-case-insensitive-p
>> + (expand-file-name (car fn-list)))
>
> You shouldn't need to expand-file-name here, as all primitives do that
> internally. (Yours didn't, but that's a mistake, see below.)
Fixed.
> What about filesystems mounted on Posix hosts, like Samba, NFS-mounted
> Windows volumes, etc. -- do those behave as case-sensitive or not? If
> the latter, can that be detected? Just asking, this shouldn't hold
> the patch, unless incorporating that is easy (or you feel like it even
> if it isn't ;-).
I don't have an immediate idea, but I added a "FIXME" comment and will
think about it.
>> +DEFUN ("file-name-case-insensitive-p", Ffile_name_case_insensitive_p,
>> + Sfile_name_case_insensitive_p, 1, 1, 0,
>> + doc: /* Return t if file FILENAME is on a case-insensitive filesystem.
>> +The arg must be a string. */)
>> + (Lisp_Object filename)
>> +{
>> + CHECK_STRING (filename);
>> + return file_name_case_insensitive_p (SSDATA (filename)) ? Qt : Qnil;
>> +}
>
> This "needs work"™. First, it should call expand-file-name, as all
> file-related primitives do. Second, it should see if there's a file
> handler for this operation, and if so, call it instead (Michael,
> please take note ;-). Finally, it should run the expanded file name
> through ENCODE_FILE before it calls file_name_case_insensitive_p, and
> pass to the latter the result of the encoding, otherwise the call to
> getattrlist will most certainly fail in some cases.
Fixed.
>> DEFUN ("rename-file", Frename_file, Srename_file, 2, 3,
>> "fRename file: \nGRename %s to file: \np",
>> doc: /* Rename FILE as NEWNAME. Both args must be strings.
>> @@ -2250,12 +2301,11 @@ This is what happens in interactive use with M-x. */)
>> file = Fexpand_file_name (file, Qnil);
>>
>> if ((!NILP (Ffile_directory_p (newname)))
>> -#ifdef DOS_NT
>> - /* If the file names are identical but for the case,
>> - don't attempt to move directory to itself. */
>> - && (NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname))))
>> -#endif
>> - )
>> + /* If the filesystem is case-insensitive and the file names are
>> + identical but for the case, don't attempt to move directory
>> + to itself. */
>> + && (NILP (Ffile_name_case_insensitive_p (file))
>> + || NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname)))))
>
> This should call file_name_case_insensitive_p, and pass it the encoded
> file names. That's because the file handlers for rename-file were
> already called, so we are now sure the file doesn't have any handlers.
Actually, the handlers haven't been called yet at this point in the
code, so I left this one alone.
>> @@ -2276,14 +2326,12 @@ This is what happens in interactive use with M-x. */)
>> encoded_file = ENCODE_FILE (file);
>> encoded_newname = ENCODE_FILE (newname);
>>
>> -#ifdef DOS_NT
>> - /* If the file names are identical but for the case, don't ask for
>> - confirmation: they simply want to change the letter-case of the
>> - file name. */
>> - if (NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname))))
>> -#endif
>> - if (NILP (ok_if_already_exists)
>> - || INTEGERP (ok_if_already_exists))
>> + /* If the filesystem is case-insensitive and the file names are
>> + identical but for the case, don't ask for confirmation: they
>> + simply want to change the letter-case of the file name. */
>> + if ((NILP (Ffile_name_case_insensitive_p (file))
>
> Likewise here.
Fixed.
> Finally, please provide a NEWS entry for the new primitive and its
> documentation in the ELisp manual.
Done, but I'm not sure I found the best place for it in the manual.
Thanks for the review. Revised patch attached.
Ken
[0001-Check-case-sensitivity-when-renaming-files.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Sat, 12 Nov 2016 07:30:02 GMT)
Full text and
rfc822 format available.
Message #50 received at 24441 <at> debbugs.gnu.org (full text, mbox):
> Cc: 24441 <at> debbugs.gnu.org, schwab <at> suse.de, brady <at> bradyt.com
> From: Ken Brown <kbrown <at> cornell.edu>
> Date: Fri, 11 Nov 2016 16:42:13 -0500
>
> > Finally, please provide a NEWS entry for the new primitive and its
> > documentation in the ELisp manual.
>
> Done, but I'm not sure I found the best place for it in the manual.
The text is OK, but I think a better place is in the node "Truenames",
as that's where we document file-equal-p. To put your description in
a proper context, perhaps precede it with a sentence such as
"Sometimes file names or their parts need to be compared as strings,
in which case it's important to know whether the underlying filesystem
is case-insensitive."
> Thanks for the review. Revised patch attached.
LGTM, thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Sun, 13 Nov 2016 13:16:02 GMT)
Full text and
rfc822 format available.
Message #53 received at 24441 <at> debbugs.gnu.org (full text, mbox):
unarchive 22300
merge 24441 22300
thanks
On 11/12/2016 2:29 AM, Eli Zaretskii wrote:
>> Cc: 24441 <at> debbugs.gnu.org, schwab <at> suse.de, brady <at> bradyt.com
>> From: Ken Brown <kbrown <at> cornell.edu>
>> Date: Fri, 11 Nov 2016 16:42:13 -0500
>> Thanks for the review. Revised patch attached.
>
> LGTM, thanks.
I've pushed it to master. I'll leave the bug open until someone
confirms that this works on OS X.
Ken
Forcibly Merged 22300 24441.
Request was from
Ken Brown <kbrown <at> cornell.edu>
to
control <at> debbugs.gnu.org
.
(Sun, 13 Nov 2016 13:27:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Mon, 14 Nov 2016 20:34:01 GMT)
Full text and
rfc822 format available.
Message #58 received at 24441 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Three comments about that fix.
1. Emacs seems to conflate whether a file system is case-sensitive, and
whether it is case-preserving. Darwin pathconf distinguishes between
_PC_CASE_SENSITIVE and _PC_CASE_PRESERVING. For example, perhaps the
following code in dired-do-create-files:
(if (and (file-name-case-insensitive-p (car fn-list))
(eq op-symbol 'move)
dired-one-file
should also check whether (car fn-list) is on a case-preserving file
system (if not, there's no point going ahead, as the user can't change
the case anyway). I suppose this would require adding a Lisp predicate
for _PC_CASE_PRESERVING. (Possibly the MS-Windows code already deals
with this, and Cygwin and macOS are currently broken.)
2. From my reading of the Apple documentation, the code taken from that
circa-2007 website should have problems on some file systems. It does
not match what Wine does in a similar situation.
3. Nowadays, I hope pathconf works on Apple; that's simpler. If not, I
think the Wine approach should be better. So I installed the attached
patch to try to do that. If you have access to a case-insensitive file
system on macOS, please try it out as-is, or compiled with
-DDARWIN_OS_CASE_SENSITIVE_FIXME=1 or
-DDARWIN_OS_CASE_SENSITIVE_FIXME=2, and let me know how it works.
[0001-Improve-case-insensitive-checks-Bug-24441.patch (application/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Tue, 15 Nov 2016 20:00:02 GMT)
Full text and
rfc822 format available.
Message #61 received at 24441 <at> debbugs.gnu.org (full text, mbox):
Ken Brown <kbrown <at> cornell.edu> writes:
> I've pushed it to master. I'll leave the bug open until someone
> confirms that this works on OS X.
I've committed a patch to Tramp, implementing a handler. For the smb
method, it always returns t; for all other methods a runtime test is
performed (and the result is cached).
Implementing a connection-local variable in order to let the user
configure this is still open; will do next days.
> Ken
Best regards, Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Tue, 15 Nov 2016 20:00:04 GMT)
Full text and
rfc822 format available.
Message #64 received at 24441 <at> debbugs.gnu.org (full text, mbox):
On 11/14/2016 3:33 PM, Paul Eggert wrote:
> 1. Emacs seems to conflate whether a file system is case-sensitive, and
> whether it is case-preserving. Darwin pathconf distinguishes between
> _PC_CASE_SENSITIVE and _PC_CASE_PRESERVING. For example, perhaps the
> following code in dired-do-create-files:
>
> (if (and (file-name-case-insensitive-p (car fn-list))
> (eq op-symbol 'move)
> dired-one-file
>
> should also check whether (car fn-list) is on a case-preserving file
> system (if not, there's no point going ahead, as the user can't change
> the case anyway). I suppose this would require adding a Lisp predicate
> for _PC_CASE_PRESERVING. (Possibly the MS-Windows code already deals
> with this, and Cygwin and macOS are currently broken.)
I'm not aware of any reported problems on non-case-preserving
filesystems. Unless someone reports such a problem, my inclination is
to leave things as they are.
Ken
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Tue, 15 Nov 2016 20:32:02 GMT)
Full text and
rfc822 format available.
Message #67 received at 24441 <at> debbugs.gnu.org (full text, mbox):
> Cc: 24441 <at> debbugs.gnu.org, Brady Trainor <brady <at> bradyt.com>,
> Eli Zaretskii <eliz <at> gnu.org>, Andreas Schwab <schwab <at> suse.de>,
> Keith David Bershatsky <esq <at> lawlist.com>,
> Michael Albinus <michael.albinus <at> gmx.de>
> From: Ken Brown <kbrown <at> cornell.edu>
> Date: Tue, 15 Nov 2016 14:59:12 -0500
>
> On 11/14/2016 3:33 PM, Paul Eggert wrote:
> > 1. Emacs seems to conflate whether a file system is case-sensitive, and
> > whether it is case-preserving. Darwin pathconf distinguishes between
> > _PC_CASE_SENSITIVE and _PC_CASE_PRESERVING. For example, perhaps the
> > following code in dired-do-create-files:
> >
> > (if (and (file-name-case-insensitive-p (car fn-list))
> > (eq op-symbol 'move)
> > dired-one-file
> >
> > should also check whether (car fn-list) is on a case-preserving file
> > system (if not, there's no point going ahead, as the user can't change
> > the case anyway). I suppose this would require adding a Lisp predicate
> > for _PC_CASE_PRESERVING. (Possibly the MS-Windows code already deals
> > with this, and Cygwin and macOS are currently broken.)
>
> I'm not aware of any reported problems on non-case-preserving
> filesystems. Unless someone reports such a problem, my inclination is
> to leave things as they are.
The only case that I know of where a filesystem is case-insensitive,
but not case-preserving, is that of DOS FAT16 filesystems, and the
MSDOS port of Emacs already considers renaming a file in such a case
as a no-op that should not trigger an error. So I think we can safely
ignore this hypothetical situation until someone actually describes
it.
Reply sent
to
Ken Brown <kbrown <at> cornell.edu>
:
You have taken responsibility.
(Wed, 30 Nov 2016 22:24:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Brady Trainor <brady <at> bradyt.com>
:
bug acknowledged by developer.
(Wed, 30 Nov 2016 22:24:02 GMT)
Full text and
rfc822 format available.
Message #72 received at 24441-done <at> debbugs.gnu.org (full text, mbox):
Version: 26.1
There's been no further comment, so I'm closing this bug.
Ken
Reply sent
to
Ken Brown <kbrown <at> cornell.edu>
:
You have taken responsibility.
(Wed, 30 Nov 2016 22:24:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Keith David Bershatsky <esq <at> lawlist.com>
:
bug acknowledged by developer.
(Wed, 30 Nov 2016 22:24:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 29 Dec 2016 12:24:03 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Paul Eggert <eggert <at> cs.ucla.edu>
to
control <at> debbugs.gnu.org
.
(Sun, 21 May 2017 05:59:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24441
; Package
emacs
.
(Sun, 21 May 2017 06:18:02 GMT)
Full text and
rfc822 format available.
Message #84 received at 24441 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
As mentioned in the thread containing this message:
http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00521.html
the DARWIN_OS_CASE_SENSITIVE_FIXME code was getting in the way of maintenance,
and doesn't seem to be working or needed or used. I attempted to get it to work
in the first attached patch (untested), and then removed it as described in the
second attached patch. If that code ever turns out to be useful someone can
revert the second patch and give my attempt a whirl.
As I understand it, the original bug was fixed last year; this email is merely
about trying to make the fix easier to maintain.
[0001-Narrow-DARWIN_OS_CASE_SENSITIVE_FIXME-to-1-choice.patch (text/x-patch, attachment)]
[0002-Remove-DARWIN_OS_CASE_SENSITIVE_FIXME-code.patch (text/x-patch, attachment)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 18 Jun 2017 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 59 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.