]> git.eshelyaron.com Git - emacs.git/commit
Fix recently-introduced expand-file-name bug
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 27 Aug 2020 21:46:52 +0000 (14:46 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 27 Aug 2020 21:49:38 +0000 (14:49 -0700)
commit0bbc84630f12e848e19c39dce01f3d14559bf70b
tree8c2e252c0ea6ef65667f4df46c468ef2f0b50bc6
parent1153b238aef5a48bbecd5a58cd6a14dae9ec1d2f
Fix recently-introduced expand-file-name bug

The bug was that (expand-file-name "~") returned something
like "/home/eggert/" instead of "/home/eggert".
Problem reported by Mattias Engdegård (Bug#26911#27).
* src/fileio.c (Fexpand_file_name): When concatenating NEWDIR to
NM, instead of stripping trailing slashes from NEWDIR (which can
turn non-symlinks into symlinks), strip leading slashes from NM.
This also simplifies the code by removing no-longer-needed DOS_NT
special-casing.  Also, remove an unnecessary ‘target[length] = 0;’
as that byte will be overwritten by the next memcpy anyway.
* test/src/fileio-tests.el (fileio-tests--HOME-trailing-slash):
New test.
src/fileio.c
test/src/fileio-tests.el