To: vim_dev@googlegroups.com Subject: Patch 8.0.1554 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1554 Problem: Custom plugins loaded with --clean. Solution: Do not include the home directory in 'runtimepath'. Files: src/option.c, src/main.c, src/proto/option.pro, src/structs.h, src/os_unix.h, src/os_amiga.h, src/os_dos.h, src/os_mac.h, runtime/doc/starting.txt *** ../vim-8.0.1553/src/option.c 2018-02-22 21:06:44.554819184 +0100 --- src/option.c 2018-03-01 21:53:01.829791881 +0100 *************** *** 3345,3353 **** * Initialize the options, first part. * * Called only once from main(), just after creating the first buffer. */ void ! set_init_1(void) { char_u *p; int opt_idx; --- 3345,3354 ---- * Initialize the options, first part. * * Called only once from main(), just after creating the first buffer. + * If "clean_arg" is TRUE Vim was started with --clean. */ void ! set_init_1(int clean_arg) { char_u *p; int opt_idx; *************** *** 3554,3559 **** --- 3555,3578 ---- */ set_options_default(0); + #ifdef CLEAN_RUNTIMEPATH + if (clean_arg) + { + opt_idx = findoption((char_u *)"runtimepath"); + if (opt_idx >= 0) + { + options[opt_idx].def_val[VI_DEFAULT] = (char_u *)CLEAN_RUNTIMEPATH; + p_rtp = (char_u *)CLEAN_RUNTIMEPATH; + } + opt_idx = findoption((char_u *)"packpath"); + if (opt_idx >= 0) + { + options[opt_idx].def_val[VI_DEFAULT] = (char_u *)CLEAN_RUNTIMEPATH; + p_pp = (char_u *)CLEAN_RUNTIMEPATH; + } + } + #endif + #ifdef FEAT_GUI if (found_reverse_arg) set_option_value((char_u *)"bg", 0L, (char_u *)"dark", 0); *** ../vim-8.0.1553/src/main.c 2018-02-10 18:45:21.064822187 +0100 --- src/main.c 2018-02-28 23:19:30.887153608 +0100 *************** *** 158,175 **** #ifdef STARTUPTIME /* Need to find "--startuptime" before actually parsing arguments. */ ! for (i = 1; i < argc; ++i) ! { ! if (STRICMP(argv[i], "--startuptime") == 0 && i + 1 < argc) { time_fd = mch_fopen(argv[i + 1], "a"); TIME_MSG("--- VIM STARTING ---"); break; } - } #endif starttime = time(NULL); common_init(¶ms); #ifdef FEAT_CLIENTSERVER --- 158,182 ---- #ifdef STARTUPTIME /* Need to find "--startuptime" before actually parsing arguments. */ ! for (i = 1; i < argc - 1; ++i) ! if (STRICMP(argv[i], "--startuptime") == 0) { time_fd = mch_fopen(argv[i + 1], "a"); TIME_MSG("--- VIM STARTING ---"); break; } #endif starttime = time(NULL); + #ifdef CLEAN_RUNTIMEPATH + /* Need to find "--clean" before actually parsing arguments. */ + for (i = 1; i < argc; ++i) + if (STRICMP(argv[i], "--clean") == 0) + { + params.clean = TRUE; + break; + } + #endif common_init(¶ms); #ifdef FEAT_CLIENTSERVER *************** *** 1024,1030 **** * First find out the home directory, needed to expand "~" in options. */ init_homedir(); /* find real value of $HOME */ ! set_init_1(); TIME_MSG("inits 1"); #ifdef FEAT_EVAL --- 1031,1037 ---- * First find out the home directory, needed to expand "~" in options. */ init_homedir(); /* find real value of $HOME */ ! set_init_1(paramp->clean); TIME_MSG("inits 1"); #ifdef FEAT_EVAL *************** *** 1903,1908 **** --- 1910,1916 ---- else if (STRNICMP(argv[0] + argv_idx, "clean", 5) == 0) { parmp->use_vimrc = (char_u *)"DEFAULTS"; + parmp->clean = TRUE; set_option_value((char_u *)"vif", 0L, (char_u *)"NONE", 0); } else if (STRNICMP(argv[0] + argv_idx, "literal", 7) == 0) *** ../vim-8.0.1553/src/proto/option.pro 2017-07-23 22:50:47.263173163 +0200 --- src/proto/option.pro 2018-02-28 23:07:48.247684600 +0100 *************** *** 1,5 **** /* option.c */ ! void set_init_1(void); void set_string_default(char *name, char_u *val); void set_number_default(char *name, long val); void free_all_options(void); --- 1,5 ---- /* option.c */ ! void set_init_1(int clean_arg); void set_string_default(char *name, char_u *val); void set_number_default(char *name, long val); void free_all_options(void); *** ../vim-8.0.1553/src/structs.h 2018-02-27 14:38:58.657004752 +0100 --- src/structs.h 2018-02-28 23:09:57.238857648 +0100 *************** *** 3333,3338 **** --- 3333,3339 ---- int evim_mode; /* started as "evim" */ char_u *use_vimrc; /* vimrc from -u argument */ + int clean; /* --clean argument */ int n_commands; /* no. of commands from + or -c */ char_u *commands[MAX_ARG_CMDS]; /* commands from + or -c arg. */ *** ../vim-8.0.1553/src/os_unix.h 2017-01-26 21:36:29.606733209 +0100 --- src/os_unix.h 2018-02-28 23:12:59.325690246 +0100 *************** *** 366,376 **** --- 366,379 ---- #ifdef VMS # define DFLT_RUNTIMEPATH "sys$login:vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,sys$login:vimfiles/after" + # define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" #else # ifdef RUNTIME_GLOBAL # define DFLT_RUNTIMEPATH "~/.vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after,~/.vim/after" + # define CLEAN_RUNTIMEPATH RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after" # else # define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after" + # define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" # endif #endif *** ../vim-8.0.1553/src/os_amiga.h 2016-08-29 22:42:20.000000000 +0200 --- src/os_amiga.h 2018-03-01 21:49:24.151263409 +0100 *************** *** 43,48 **** --- 43,51 ---- #ifndef DFLT_RUNTIMEPATH # define DFLT_RUNTIMEPATH "home:vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,home:vimfiles/after" #endif + #ifndef CLEAN_RUNTIMEPATH + # define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" + #endif #ifndef BASENAMELEN # define BASENAMELEN 26 /* Amiga */ *** ../vim-8.0.1553/src/os_dos.h 2016-08-29 22:42:20.000000000 +0200 --- src/os_dos.h 2018-03-01 21:50:03.074999734 +0100 *************** *** 125,130 **** --- 125,131 ---- #define DFLT_ERRORFILE "errors.err" #define DFLT_RUNTIMEPATH "$HOME/vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/vimfiles/after" + #define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" #define CASE_INSENSITIVE_FILENAME /* ignore case when comparing file names */ #define SPACE_IN_FILENAME *** ../vim-8.0.1553/src/os_mac.h 2017-10-28 21:08:38.991456926 +0200 --- src/os_mac.h 2018-03-01 21:50:36.662772402 +0100 *************** *** 215,220 **** --- 215,223 ---- #ifndef DFLT_RUNTIMEPATH # define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after" #endif + #ifndef CLEAN_RUNTIMEPATH + # define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" + #endif /* * Macintosh has plenty of memory, use large buffers *** ../vim-8.0.1553/runtime/doc/starting.txt 2017-07-15 19:22:33.638179943 +0200 --- runtime/doc/starting.txt 2018-03-01 21:47:29.300042889 +0100 *************** *** 514,519 **** --- 516,522 ---- - the |defaults.vim| script is loaded, which implies 'nocompatible': use Vim defaults - no viminfo file is read or written + - the home directory is excluded from 'runtimepath' *-x* -x Use encryption to read/write files. Will prompt for a key, which is then stored in the 'key' option. All writes will *** ../vim-8.0.1553/src/version.c 2018-02-27 21:08:48.276512979 +0100 --- src/version.c 2018-03-01 21:46:48.656319273 +0100 *************** *** 780,781 **** --- 780,783 ---- { /* Add new patch number below this line */ + /**/ + 1554, /**/ -- FATAL ERROR! SYSTEM HALTED! - Press any key to continue doing nothing. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///