home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.1.129 < prev    next >
Encoding:
Internet Message Format  |  2002-07-20  |  5.9 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.129
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.1.129
  11. Problem:    On Solaris editing "file/" and then "file" results in using the
  12.         same buffer.  (Jim Battle)
  13. Solution:   Before using stat(), check that there is no illegal trailing
  14.         slash.
  15. Files:        src/auto/configure, src/config.h.in, src/configure.in,
  16.         src/macros.h src/misc2.c, src/proto/misc2.pro
  17.  
  18.  
  19. *** ../vim61.128/src/auto/configure    Sun Jun 23 14:29:26 2002
  20. --- src/auto/configure    Sun Jun 30 16:29:09 2002
  21. ***************
  22. *** 5953,5964 ****
  23.   fi
  24.   rm -f conftest*
  25.   
  26.   echo $ac_n "checking for iconv_open()""... $ac_c" 1>&6
  27. ! echo "configure:5913: checking for iconv_open()" >&5
  28.   save_LIBS="$LIBS"
  29.   LIBS="$LIBS -liconv"
  30.   cat > conftest.$ac_ext <<EOF
  31. ! #line 5917 "configure"
  32.   #include "confdefs.h"
  33.   
  34.   #ifdef HAVE_ICONV_H
  35. --- 5953,5992 ----
  36.   fi
  37.   rm -f conftest*
  38.   
  39. + echo $ac_n "checking whether stat() ignores a trailing slash""... $ac_c" 1>&6
  40. + echo "configure:5958: checking whether stat() ignores a trailing slash" >&5
  41. + if test "$cross_compiling" = yes; then
  42. +   { echo "configure: error: failed to compile test program" 1>&2; exit 1; }
  43. + else
  44. +   cat > conftest.$ac_ext <<EOF
  45. + #line 5963 "configure"
  46. + #include "confdefs.h"
  47. + #include <sys/types.h>
  48. + #include <sys/stat.h>
  49. + main() {struct stat st;  exit(stat("configure/", &st) != 0); }
  50. + EOF
  51. + if { (eval echo configure:5969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  52. + then
  53. +   echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
  54. + #define STAT_IGNORES_SLASH 1
  55. + EOF
  56. + else
  57. +   echo "configure: failed program was:" >&5
  58. +   cat conftest.$ac_ext >&5
  59. +   rm -fr conftest*
  60. +   echo "$ac_t""no" 1>&6
  61. + fi
  62. + rm -fr conftest*
  63. + fi
  64.   echo $ac_n "checking for iconv_open()""... $ac_c" 1>&6
  65. ! echo "configure:5986: checking for iconv_open()" >&5
  66.   save_LIBS="$LIBS"
  67.   LIBS="$LIBS -liconv"
  68.   cat > conftest.$ac_ext <<EOF
  69. ! #line 5990 "configure"
  70.   #include "confdefs.h"
  71.   
  72.   #ifdef HAVE_ICONV_H
  73. *** ../vim61.128/src/config.h.in    Sat Jun  8 19:05:54 2002
  74. --- src/config.h.in    Sun Jun 30 16:13:30 2002
  75. ***************
  76. *** 128,133 ****
  77. --- 116,124 ----
  78.   
  79.   /* Define if touuper/tolower only work on lower/upercase characters */
  80.   #undef BROKEN_TOUPPER
  81. + /* Define if stat() ignores a trailing slash */
  82. + #undef STAT_IGNORES_SLASH
  83.   
  84.   /* Define if tgetstr() has a second argument that is (char *) */
  85.   #undef TGETSTR_CHAR_P
  86. *** ../vim61.128/src/configure.in    Sun Jun 23 14:29:26 2002
  87. --- src/configure.in    Sun Jun 30 16:29:05 2002
  88. ***************
  89. *** 1761,1766 ****
  90. --- 1761,1774 ----
  91.       AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ST_BLKSIZE),
  92.       AC_MSG_RESULT(no))
  93.   
  94. + AC_MSG_CHECKING(whether stat() ignores a trailing slash)
  95. + AC_TRY_RUN(
  96. + [#include <sys/types.h>
  97. + #include <sys/stat.h>
  98. + main() {struct stat st;  exit(stat("configure/", &st) != 0); }],
  99. +     AC_MSG_RESULT(yes); AC_DEFINE(STAT_IGNORES_SLASH),
  100. +     AC_MSG_RESULT(no), AC_MSG_ERROR(failed to compile test program))
  101.   dnl Link with iconv for charset translation, if not found without library.
  102.   dnl check for iconv() requires including iconv.h
  103.   dnl Add "-liconv" when possible; Solaris has iconv but use GNU iconv when it
  104. *** ../vim61.128/src/macros.h    Tue Jan  1 20:52:19 2002
  105. --- src/macros.h    Sat Jul 13 14:48:26 2002
  106. ***************
  107. *** 145,151 ****
  108.   # ifdef MSWIN    /* has it's own mch_stat() function */
  109.   #  define mch_stat(n, p)    vim_stat((n), (p))
  110.   # else
  111. ! #  define mch_stat(n, p)    stat((n), (p))
  112.   # endif
  113.   #endif
  114.   
  115. --- 145,157 ----
  116.   # ifdef MSWIN    /* has it's own mch_stat() function */
  117.   #  define mch_stat(n, p)    vim_stat((n), (p))
  118.   # else
  119. ! #  ifdef STAT_IGNORES_SLASH
  120. !     /* On Solaris stat() accepts "file/" as if it was "file".  Return -1 if
  121. !      * the name ends in "/" and it's not a directory. */
  122. ! #   define mch_stat(n, p)    (illegal_slash(n) ? -1 : stat((n), (p)))
  123. ! #  else
  124. ! #   define mch_stat(n, p)    stat((n), (p))
  125. ! #  endif
  126.   # endif
  127.   #endif
  128.   
  129. *** ../vim61.128/src/misc2.c    Thu May 16 22:15:58 2002
  130. --- src/misc2.c    Sat Jul 13 14:55:56 2002
  131. ***************
  132. *** 2648,2653 ****
  133. --- 2648,2673 ----
  134.   }
  135.   #endif
  136.   
  137. + #if defined(STAT_IGNORES_SLASH) || defined(PROTO)
  138. + /*
  139. +  * Check if "name" ends in a slash and is not a directory.
  140. +  * Used for systems where stat() ignores a trailing slash on a file name.
  141. +  * The Vim code assumes a trailing slash is only ignored for a directory.
  142. +  */
  143. +     int
  144. + illegal_slash(name)
  145. +     char *name;
  146. + {
  147. +     if (name[0] == NUL)
  148. +     return FALSE;        /* no file name is not illegal */
  149. +     if (name[strlen(name) - 1] != '/')
  150. +     return FALSE;        /* no trailing slash */
  151. +     if (mch_isdir(name))
  152. +     return FALSE;        /* trailing slash for a directory */
  153. +     return TRUE;
  154. + }
  155. + #endif
  156.   #if defined(CURSOR_SHAPE) || defined(PROTO)
  157.   
  158.   /*
  159. *** ../vim61.128/src/proto/misc2.pro    Fri Mar 22 21:41:16 2002
  160. --- src/proto/misc2.pro    Sat Jul 13 14:56:05 2002
  161. ***************
  162. *** 66,71 ****
  163. --- 66,72 ----
  164.   int call_shell __ARGS((char_u *cmd, int opt));
  165.   int get_real_state __ARGS((void));
  166.   int vim_chdirfile __ARGS((char_u *fname));
  167. + int illegal_slash __ARGS((char *name));
  168.   char_u *parse_shape_opt __ARGS((int what));
  169.   int get_shape_idx __ARGS((int mouse));
  170.   void update_mouseshape __ARGS((int shape_idx));
  171. *** ../vim61.128/src/version.c    Sun Jul 14 16:37:14 2002
  172. --- src/version.c    Sun Jul 21 20:25:29 2002
  173. ***************
  174. *** 608,609 ****
  175. --- 608,611 ----
  176.   {   /* Add new patch number below this line */
  177. + /**/
  178. +     129,
  179.   /**/
  180.  
  181. -- 
  182. hundred-and-one symptoms of being an internet addict:
  183. 11. You find yourself typing "com" after every period when using a word
  184.     processor.com
  185.  
  186.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  187. ///   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   \\\
  188. \\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
  189.  \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
  190.