diff options
| author | Paul Eggert | 2018-11-13 09:29:14 -0800 |
|---|---|---|
| committer | Paul Eggert | 2018-11-13 09:32:50 -0800 |
| commit | 900276502fbb4dcabdabc5d7d24b4bc5645f2cf3 (patch) | |
| tree | 4d6c17f5b3cea0f4d5dfbc7243eb6495269a7e56 /test/src/fileio-tests.el | |
| parent | ce1fb157e840fd292c3db4632831c4514a663890 (diff) | |
| download | emacs-900276502fbb4dcabdabc5d7d24b4bc5645f2cf3.tar.gz emacs-900276502fbb4dcabdabc5d7d24b4bc5645f2cf3.zip | |
Act like POSIX sh if $HOME is relative
POSIX says sh ~/foo should act like $HOME/foo even if $HOME is
relative, so be consistent with that (Bug#33255).
* admin/merge-gnulib (GNULIB_MODULES): Add dosname.
* src/buffer.c (init_buffer): Use emacs_wd to get
initial working directory with slash appended if needed.
(default-directory): Say it must be absolute.
* src/emacs.c (emacs_wd): New global variable.
(init_cmdargs): Dir arg is now char const *.
(main): Set emacs_wd.
* src/emacs.c (main) [NS_IMPL_COCOA]:
* src/fileio.c (Fexpand_file_name):
Use get_homedir instead of egetenv ("HOME").
* src/fileio.c: Include dosname.h, for IS_ABSOLUTE_FILE_NAME.
(splice_dir_file, get_homedir): New functions.
* src/xrdb.c (gethomedir): Remove. All callers changed
to use get_homedir and splice_dir_file.
* test/src/fileio-tests.el (fileio-tests--relative-HOME): New test.
Diffstat (limited to 'test/src/fileio-tests.el')
| -rw-r--r-- | test/src/fileio-tests.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index 5d12685fa19..b7b78bbda09 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el | |||
| @@ -95,3 +95,11 @@ Also check that an encoding error can appear in a symlink." | |||
| 95 | (should (equal (file-name-as-directory "d:/abc/") "d:/abc/")) | 95 | (should (equal (file-name-as-directory "d:/abc/") "d:/abc/")) |
| 96 | (should (equal (file-name-as-directory "D:\\abc/") "d:/abc/")) | 96 | (should (equal (file-name-as-directory "D:\\abc/") "d:/abc/")) |
| 97 | (should (equal (file-name-as-directory "D:/abc//") "d:/abc//"))) | 97 | (should (equal (file-name-as-directory "D:/abc//") "d:/abc//"))) |
| 98 | |||
| 99 | (ert-deftest fileio-tests--relative-HOME () | ||
| 100 | "Test that expand-file-name works even when HOME is relative." | ||
| 101 | (let ((old-home (getenv "HOME"))) | ||
| 102 | (setenv "HOME" "a/b/c") | ||
| 103 | (should (equal (expand-file-name "~/foo") | ||
| 104 | (expand-file-name "a/b/c/foo"))) | ||
| 105 | (setenv "HOME" old-home))) | ||