diff options
| author | Eli Zaretskii | 2016-12-27 10:12:06 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2016-12-27 10:12:06 +0200 |
| commit | 5d8bb89f0fa7d5f2824a914ce2b7c3841112c7a1 (patch) | |
| tree | 5b6030eedaf3b7ac5ca78d2bbe48e65a635f1f76 /src | |
| parent | 34b30c1ca4ff2f01bf716542d3dc85ef300df75a (diff) | |
| download | emacs-5d8bb89f0fa7d5f2824a914ce2b7c3841112c7a1.tar.gz emacs-5d8bb89f0fa7d5f2824a914ce2b7c3841112c7a1.zip | |
Fix expand-file-name on DOS_NT systems when /: escaping is used
* src/fileio.c (Fexpand_file_name) [DOS_NT]: Don't expand "~" in
file names escaped by "/:". Don't recursively expand
default-directory escaped with "/:" which is not followed by a
drive spec. (Bug#25183)
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c index 3ba85b2b903..1a744e02e28 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -884,6 +884,11 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 884 | /* Detect MSDOS file names with drive specifiers. */ | 884 | /* Detect MSDOS file names with drive specifiers. */ |
| 885 | && ! (IS_DRIVE (o[0]) && IS_DEVICE_SEP (o[1]) | 885 | && ! (IS_DRIVE (o[0]) && IS_DEVICE_SEP (o[1]) |
| 886 | && IS_DIRECTORY_SEP (o[2])) | 886 | && IS_DIRECTORY_SEP (o[2])) |
| 887 | /* Detect escaped file names without drive spec after "/:". | ||
| 888 | These should not be recursively expanded, to avoid | ||
| 889 | including the default directory twice in the expanded | ||
| 890 | result. */ | ||
| 891 | && ! (o[0] == '/' && o[1] == ':') | ||
| 887 | #ifdef WINDOWSNT | 892 | #ifdef WINDOWSNT |
| 888 | /* Detect Windows file names in UNC format. */ | 893 | /* Detect Windows file names in UNC format. */ |
| 889 | && ! (IS_DIRECTORY_SEP (o[0]) && IS_DIRECTORY_SEP (o[1])) | 894 | && ! (IS_DIRECTORY_SEP (o[0]) && IS_DIRECTORY_SEP (o[1])) |
| @@ -1064,7 +1069,11 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 1064 | 1069 | ||
| 1065 | newdir = newdirlim = 0; | 1070 | newdir = newdirlim = 0; |
| 1066 | 1071 | ||
| 1067 | if (nm[0] == '~') /* prefix ~ */ | 1072 | if (nm[0] == '~' /* prefix ~ */ |
| 1073 | #ifdef DOS_NT | ||
| 1074 | && !is_escaped /* don't expand ~ in escaped file names */ | ||
| 1075 | #endif | ||
| 1076 | ) | ||
| 1068 | { | 1077 | { |
| 1069 | if (IS_DIRECTORY_SEP (nm[1]) | 1078 | if (IS_DIRECTORY_SEP (nm[1]) |
| 1070 | || nm[1] == 0) /* ~ by itself */ | 1079 | || nm[1] == 0) /* ~ by itself */ |