To: vim_dev@googlegroups.com Subject: Patch 8.2.0273 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0273 Problem: MS-Windows uninstall may delete wrong batch file. Solution: Add specific marker in the generated batch file. (Ken Takata, closes #5654) Files: src/Make_mvc.mak, src/dosinst.c, src/dosinst.h, src/uninstall.c *** ../vim-8.2.0272/src/Make_mvc.mak 2020-02-14 13:21:55.642197064 +0100 --- src/Make_mvc.mak 2020-02-17 22:50:46.361550933 +0100 *************** *** 1359,1365 **** $(OUTDIR): if not exist $(OUTDIR)/nul mkdir $(OUTDIR) ! CFLAGS_INST = /nologo -DNDEBUG -DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) $(CFLAGS_DEPR) install.exe: dosinst.c dosinst.h version.h $(CC) $(CFLAGS_INST) dosinst.c kernel32.lib shell32.lib \ --- 1359,1365 ---- $(OUTDIR): if not exist $(OUTDIR)/nul mkdir $(OUTDIR) ! CFLAGS_INST = /nologo /O2 -DNDEBUG -DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) $(CFLAGS_DEPR) install.exe: dosinst.c dosinst.h version.h $(CC) $(CFLAGS_INST) dosinst.c kernel32.lib shell32.lib \ *** ../vim-8.2.0272/src/dosinst.c 2019-12-01 20:57:04.000000000 +0100 --- src/dosinst.c 2020-02-17 22:50:46.361550933 +0100 *************** *** 841,846 **** --- 841,847 ---- fprintf(fd, "@echo off\n"); fprintf(fd, "rem -- Run Vim --\n"); + fprintf(fd, VIMBAT_UNINSTKEY "\n"); fprintf(fd, "\n"); fprintf(fd, "setlocal\n"); *** ../vim-8.2.0272/src/dosinst.h 2020-02-12 21:15:37.543497435 +0100 --- src/dosinst.h 2020-02-17 22:50:46.361550933 +0100 *************** *** 354,359 **** --- 354,362 ---- "vimtutor.bat", "vimtutor.bat", ""}, }; + /* Uninstall key for vim.bat, etc. */ + #define VIMBAT_UNINSTKEY "rem # uninstall key: " VIM_VERSION_NODOT " #" + #define ICON_COUNT 3 char *(icon_names[ICON_COUNT]) = {"gVim " VIM_VERSION_SHORT, *** ../vim-8.2.0272/src/uninstall.c 2020-02-09 14:27:15.975648787 +0100 --- src/uninstall.c 2020-02-17 22:50:46.361550933 +0100 *************** *** 200,207 **** { FILE *fd; char line[BUFSIZE]; ! char *p; ! int ver_len = strlen(VIM_VERSION_NODOT); int found = FALSE; fd = fopen(path, "r"); --- 200,206 ---- { FILE *fd; char line[BUFSIZE]; ! int key_len = strlen(VIMBAT_UNINSTKEY); int found = FALSE; fd = fopen(path, "r"); *************** *** 209,225 **** { while (fgets(line, sizeof(line), fd) != NULL) { ! for (p = line; *p != 0; ++p) ! // don't accept "vim60an" when looking for "vim60". ! if (strnicmp(p, VIM_VERSION_NODOT, ver_len) == 0 ! && !isdigit(p[ver_len]) ! && !isalpha(p[ver_len])) ! { ! found = TRUE; ! break; ! } ! if (found) break; } fclose(fd); } --- 208,218 ---- { while (fgets(line, sizeof(line), fd) != NULL) { ! if (strncmp(line, VIMBAT_UNINSTKEY, key_len) == 0) ! { ! found = TRUE; break; + } } fclose(fd); } *** ../vim-8.2.0272/src/version.c 2020-02-17 22:39:32.072004567 +0100 --- src/version.c 2020-02-17 22:52:08.005260093 +0100 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 273, /**/ -- From "know your smileys": (:-# Said something he shouldn't have /// 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 ///