Browse code

vim: Fix system() call in vimrc for custom shell

For custom login shell, any invocation of "call system()" failed
because system() used login shell to invoke commands. Some custom
login shells may not have capability to invoke other commands.

Change-Id: Ie0262e966d673f600ac0a5ad0d350981c5284ae5
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6620
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Tapas Kundu <tkundu@vmware.com>

dweepadvani authored on 2019/01/30 11:05:33
Showing 1 changed files
... ...
@@ -3,7 +3,7 @@
3 3
 Summary:        Text editor
4 4
 Name:           vim
5 5
 Version:        8.0.0533
6
-Release:        5%{?dist}
6
+Release:        6%{?dist}
7 7
 License:        Charityware
8 8
 URL:            http://www.vim.org
9 9
 Group:          Applications/Editors
... ...
@@ -35,6 +35,7 @@ echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
35 35
     --prefix=%{_prefix} \
36 36
     --enable-multibyte
37 37
 make VERBOSE=1 %{?_smp_mflags}
38
+
38 39
 %install
39 40
 #cd %{_builddir}/%{name}74
40 41
 make DESTDIR=%{buildroot} install
... ...
@@ -43,6 +44,7 @@ install -vdm 755 %{buildroot}/etc
43 43
 cat > %{buildroot}/etc/vimrc << "EOF"
44 44
 " Begin /etc/vimrc
45 45
 
46
+set shell=/bin/bash
46 47
 set nocompatible
47 48
 set backspace=2
48 49
 set ruler
... ...
@@ -72,6 +74,14 @@ EOF
72 72
 sed -i '/source test_recover.vim/d' src/testdir/test_alot.vim
73 73
 make test
74 74
 
75
+%post
76
+if ! sed -n -e '0,/[[:space:]]*call[[:space:]]\+system\>/p' %{_sysconfdir}/vimrc | \
77
+     grep -q '^[[:space:]]*set[[:space:]]\+shell=/bin/bash'
78
+then
79
+    sed -i -e 's#^\([[:space:]]*\)\(call[[:space:]]\+system.*\)$#\1set shell=/bin/bash\n\1\2#g' \
80
+        %{_sysconfdir}/vimrc
81
+fi
82
+
75 83
 %files extra
76 84
 %defattr(-,root,root)
77 85
 %{_bindir}/vimtutor
... ...
@@ -89,7 +99,6 @@ make test
89 89
 %{_datarootdir}/icons/locolor/32x32/apps/gvim.png
90 90
 %{_datarootdir}/vim/vim80/defaults.vim
91 91
 %{_datarootdir}/vim/vim80/pack/dist/opt/*
92
-
93 92
 %{_datarootdir}/vim/vim80/compiler/*
94 93
 %{_datarootdir}/vim/vim80/delmenu.vim
95 94
 %{_datarootdir}/vim/vim80/evim.vim
... ...
@@ -163,7 +172,6 @@ make test
163 163
 %{_datarootdir}/vim/vim80/colors/desert.vim
164 164
 %{_datarootdir}/vim/vim80/syntax/syntax.vim
165 165
 %{_datarootdir}/vim/vim80/rgb.txt
166
-
167 166
 %{_bindir}/ex
168 167
 %{_bindir}/vi
169 168
 %{_bindir}/view
... ...
@@ -173,6 +181,8 @@ make test
173 173
 %{_bindir}/vimdiff
174 174
 
175 175
 %changelog
176
+*   Tue Jan 29 2019 Dweep Advani <dadvani@vmware.com> 8.0.0533-6
177
+-   Fixed swap file creation error for custom login shell
176 178
 *   Thu Jul 12 2018 Tapas Kundu <tkundu@vmware.com> 8.0.0533-5
177 179
 -   Fix for CVE-2017-1000382
178 180
 *   Tue Jul 10 2018 Tapas Kundu <tkundu@vmware.com> 8.0.0533-4