diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/lread.c | 28 |
2 files changed, 31 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ac9864f9f95..2aa0e157afe 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-08-17 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * lread.c (Fload) [DOS_NT]: If `openp' returns -2, but the file | ||
| 4 | has no `load' handler, try opening the file locally. (Bug#9311) | ||
| 5 | |||
| 1 | 2011-08-16 Ken Brown <kbrown@cornell.edu> | 6 | 2011-08-16 Ken Brown <kbrown@cornell.edu> |
| 2 | 7 | ||
| 3 | * gmalloc.c: Expand comment. | 8 | * gmalloc.c: Expand comment. |
diff --git a/src/lread.c b/src/lread.c index 78ff195e990..6d1a7b102d7 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1124,6 +1124,22 @@ Return t if the file exists and loads successfully. */) | |||
| 1124 | handler = Ffind_file_name_handler (found, Qload); | 1124 | handler = Ffind_file_name_handler (found, Qload); |
| 1125 | if (! NILP (handler)) | 1125 | if (! NILP (handler)) |
| 1126 | return call5 (handler, Qload, found, noerror, nomessage, Qt); | 1126 | return call5 (handler, Qload, found, noerror, nomessage, Qt); |
| 1127 | #ifdef DOS_NT | ||
| 1128 | /* Tramp has to deal with semi-broken packages that prepend | ||
| 1129 | drive letters to remote files. For that reason, Tramp | ||
| 1130 | catches file operations that test for file existence, which | ||
| 1131 | makes openp think X:/foo.elc files are remote. However, | ||
| 1132 | Tramp does not catch `load' operations for such files, so we | ||
| 1133 | end up with a nil as the `load' handler above. If we would | ||
| 1134 | continue with fd = -2, we will behave wrongly, and in | ||
| 1135 | particular try reading a .elc file in the "rt" mode instead | ||
| 1136 | of "rb". See bug #9311 for the results. To work around | ||
| 1137 | this, we try to open the file locally, and go with that if it | ||
| 1138 | succeeds. */ | ||
| 1139 | fd = emacs_open (SSDATA (ENCODE_FILE (found)), O_RDONLY, 0); | ||
| 1140 | if (fd == -1) | ||
| 1141 | fd = -2; | ||
| 1142 | #endif | ||
| 1127 | } | 1143 | } |
| 1128 | 1144 | ||
| 1129 | /* Check if we're stuck in a recursive load cycle. | 1145 | /* Check if we're stuck in a recursive load cycle. |
| @@ -1247,9 +1263,17 @@ Return t if the file exists and loads successfully. */) | |||
| 1247 | GCPRO3 (file, found, hist_file_name); | 1263 | GCPRO3 (file, found, hist_file_name); |
| 1248 | 1264 | ||
| 1249 | #ifdef WINDOWSNT | 1265 | #ifdef WINDOWSNT |
| 1250 | emacs_close (fd); | ||
| 1251 | efound = ENCODE_FILE (found); | 1266 | efound = ENCODE_FILE (found); |
| 1252 | stream = fopen (SSDATA (efound), fmode); | 1267 | /* If we somehow got here with fd == -2, meaning the file is deemed |
| 1268 | to be remote, don't even try to reopen the file locally; just | ||
| 1269 | force a failure instead. */ | ||
| 1270 | if (fd >= 0) | ||
| 1271 | { | ||
| 1272 | emacs_close (fd); | ||
| 1273 | stream = fopen (SSDATA (efound), fmode); | ||
| 1274 | } | ||
| 1275 | else | ||
| 1276 | stream = NULL; | ||
| 1253 | #else /* not WINDOWSNT */ | 1277 | #else /* not WINDOWSNT */ |
| 1254 | stream = fdopen (fd, fmode); | 1278 | stream = fdopen (fd, fmode); |
| 1255 | #endif /* not WINDOWSNT */ | 1279 | #endif /* not WINDOWSNT */ |