r1255 - in trunk/BOOK: chapter01 chapter06

robert at linuxfromscratch.org robert at linuxfromscratch.org
Mon Oct 22 15:33:56 PDT 2007


Author: robert
Date: 2007-10-22 16:33:56 -0600 (Mon, 22 Oct 2007)
New Revision: 1255

Modified:
   trunk/BOOK/chapter01/changelog.xml
   trunk/BOOK/chapter06/vim.xml
Log:
Added optional command to set Vim swap files read-only by owner. Added note for the Vim 'set dir=' option for a dedicated swap file directory

Modified: trunk/BOOK/chapter01/changelog.xml
===================================================================
--- trunk/BOOK/chapter01/changelog.xml	2007-10-22 06:24:23 UTC (rev 1254)
+++ trunk/BOOK/chapter01/changelog.xml	2007-10-22 22:33:56 UTC (rev 1255)
@@ -52,6 +52,11 @@
       <para>October 22, 2007</para>
       <itemizedlist>
         <listitem>
+          <para>[robert] - Added optional command to set Vim swap files
+          read-only by owner. Added note for the Vim 'set dir=' option for
+          a dedicated swap file directory.</para>
+        </listitem>
+        <listitem>
           <para>[robert] - Added temporary file notes for Findutils/updatedb
           chap6.</para>
         </listitem>

Modified: trunk/BOOK/chapter06/vim.xml
===================================================================
--- trunk/BOOK/chapter06/vim.xml	2007-10-22 06:24:23 UTC (rev 1254)
+++ trunk/BOOK/chapter06/vim.xml	2007-10-22 22:33:56 UTC (rev 1255)
@@ -45,6 +45,14 @@
 
 <screen role="hardened_tmp"><userinput>patch -Np1 -i ../&vim-hardened_tmp-patch;</userinput></screen>
 
+    <para>By default Vim uses the file permissions of the original file for
+    the Vim swap file, minus group and other write and execute permission.
+    If you would like more parnoid permissions, the following command will
+    remove this behavior so 0600 permissions are used with swap files, so
+    they're readable only by the owner:</para>
+
+<screen><userinput>sed -e 's/(st.st_mode & 0644) | //' -i.orig src/fileio.c</userinput></screen>
+
     <para>One of Vim's functions is programed to intentionally overflow
     because the length is unknown. SSP and _FORTIFY_SOURCE will not allow
     this function to work. There is a mailing list thread about this here:
@@ -190,6 +198,17 @@
     gives the highlighting a better color scheme for use on the black
     background of these programs.</para>
 
+    <para>The <parameter>set dir=</parameter> setting tells Vim where to place
+    swap files. By default these files are in the same directory as the file
+    being edited, if it's writtable, then <envar>$HOME</envar>/tmp, if it
+    exists, then <filename class="directory">/var/tmp</filename>. This can
+    result in a lot of clutter on the file system. You may want to set this
+    to a dedicated directory, such as
+    <parameter>set dir=/var/cache/vim</parameter> with 1777 permissions, or
+    <parameter>set dir=~/.vim_tmp</parameter>, in the
+    <filename>/etc/vimrc</filename> global config file. This directory must
+    exist in advance because Vim will not create it.</para>
+
     <para>Documentation for other available options can be obtained by
     running the following command:</para>
 




More information about the hlfs-book mailing list