diff options
| author | Eli Zaretskii | 2013-11-04 19:30:33 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-11-04 19:30:33 +0200 |
| commit | d0065ff1244871c9eb40420b88fc89f9f008b587 (patch) | |
| tree | a869fa565b559c7b0a9390fd6045d7d827d001ec /src/lread.c | |
| parent | 7397c58760779a3aa83ff58164455761d77cd642 (diff) | |
| download | emacs-d0065ff1244871c9eb40420b88fc89f9f008b587.tar.gz emacs-d0065ff1244871c9eb40420b88fc89f9f008b587.zip | |
Fix bug #15260 with building and installing Emacs in non-ASCII directories.
src/xdisp.c (message3_nolog, message_with_string): Encode the string
before writing it to the terminal in a non-interactive session.
src/lread.c (openp): If both FILENAME and SUFFIX are unibyte, make
sure we concatenate them into a unibyte string.
src/fileio.c (make_temp_name): Encode PREFIX, and decode the
resulting temporary name before returning it to the caller.
(Fexpand_file_name): If NAME is pure-ASCII and DEFAULT_DIRECTORY
is a unibyte string, convert NAME to a unibyte string to ensure
that the result is also a unibyte string.
src/emacs.c (init_cmdargs): Use build_unibyte_string to make sure we
create unibyte strings from default paths and directory/file
names.
src/coding.h (ENCODE_FILE): Do not attempt to encode a unibyte
string.
src/callproc.c (init_callproc): Use build_unibyte_string to make
sure we create unibyte strings from default paths and
directory/file names.
src/buffer.c (init_buffer): Don't store default-directory of
*scratch* in multibyte form. The original problem which led to
that is described in
http://lists.gnu.org/archive/html/emacs-pretest-bug/2004-11/msg00532.html,
but it was solved long ago.
lisp/startup.el (normal-top-level): Move setting eol-mnemonic-unix,
eol-mnemonic-mac, eol-mnemonic-dos, and also setup of the locale
environment and decoding all of the default-directory's to here
from command-line.
(command-line): Decode also argv[0].
lisp/loadup.el: Error out if default-directory is a multibyte string
when we are dumping.
lisp/Makefile.in (emacs): Don't set LC_ALL=C.
leim/Makefile.in (RUN_EMACS): Don't set LC_ALL=C.
configure.ac: Don't disallow builds in non-ASCII directories.
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/lread.c b/src/lread.c index b42ac5908e9..618b0cadb53 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1500,7 +1500,8 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | |||
| 1500 | for (tail = NILP (suffixes) ? list1 (empty_unibyte_string) : suffixes; | 1500 | for (tail = NILP (suffixes) ? list1 (empty_unibyte_string) : suffixes; |
| 1501 | CONSP (tail); tail = XCDR (tail)) | 1501 | CONSP (tail); tail = XCDR (tail)) |
| 1502 | { | 1502 | { |
| 1503 | ptrdiff_t fnlen, lsuffix = SBYTES (XCAR (tail)); | 1503 | Lisp_Object suffix = XCAR (tail); |
| 1504 | ptrdiff_t fnlen, lsuffix = SBYTES (suffix); | ||
| 1504 | Lisp_Object handler; | 1505 | Lisp_Object handler; |
| 1505 | 1506 | ||
| 1506 | /* Concatenate path element/specified name with the suffix. | 1507 | /* Concatenate path element/specified name with the suffix. |
| @@ -1511,7 +1512,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | |||
| 1511 | ? 2 : 0); | 1512 | ? 2 : 0); |
| 1512 | fnlen = SBYTES (filename) - prefixlen; | 1513 | fnlen = SBYTES (filename) - prefixlen; |
| 1513 | memcpy (fn, SDATA (filename) + prefixlen, fnlen); | 1514 | memcpy (fn, SDATA (filename) + prefixlen, fnlen); |
| 1514 | memcpy (fn + fnlen, SDATA (XCAR (tail)), lsuffix + 1); | 1515 | memcpy (fn + fnlen, SDATA (suffix), lsuffix + 1); |
| 1515 | fnlen += lsuffix; | 1516 | fnlen += lsuffix; |
| 1516 | /* Check that the file exists and is not a directory. */ | 1517 | /* Check that the file exists and is not a directory. */ |
| 1517 | /* We used to only check for handlers on non-absolute file names: | 1518 | /* We used to only check for handlers on non-absolute file names: |
| @@ -1521,7 +1522,18 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | |||
| 1521 | handler = Ffind_file_name_handler (filename, Qfile_exists_p); | 1522 | handler = Ffind_file_name_handler (filename, Qfile_exists_p); |
| 1522 | It's not clear why that was the case and it breaks things like | 1523 | It's not clear why that was the case and it breaks things like |
| 1523 | (load "/bar.el") where the file is actually "/bar.el.gz". */ | 1524 | (load "/bar.el") where the file is actually "/bar.el.gz". */ |
| 1524 | string = make_string (fn, fnlen); | 1525 | /* make_string has its own ideas on when to return a unibyte |
| 1526 | string and when a multibyte string, but we know better. | ||
| 1527 | We must have a unibyte string when dumping, since | ||
| 1528 | file-name encoding is shaky at best at that time, and in | ||
| 1529 | particular default-file-name-coding-system is reset | ||
| 1530 | several times during loadup. We therefore don't want to | ||
| 1531 | encode the file before passing it to file I/O library | ||
| 1532 | functions. */ | ||
| 1533 | if (!STRING_MULTIBYTE (filename) && !STRING_MULTIBYTE (suffix)) | ||
| 1534 | string = make_unibyte_string (fn, fnlen); | ||
| 1535 | else | ||
| 1536 | string = make_string (fn, fnlen); | ||
| 1525 | handler = Ffind_file_name_handler (string, Qfile_exists_p); | 1537 | handler = Ffind_file_name_handler (string, Qfile_exists_p); |
| 1526 | if ((!NILP (handler) || !NILP (predicate)) && !NATNUMP (predicate)) | 1538 | if ((!NILP (handler) || !NILP (predicate)) && !NATNUMP (predicate)) |
| 1527 | { | 1539 | { |