Patch 7.3.070

2010-12-02 Fir de Conversatie Bram Moolenaar

Patch 7.3.070
Problem:Can set environment variables in the sandbox, could be abused.
Solution:   Disallow it.
Files:  src/eval.c


*** ../vim-7.3.069/src/eval.c   2010-11-10 20:31:24.0 +0100
--- src/eval.c  2010-12-02 14:42:31.0 +0100
***
*** 2326,2332 
else if (endchars != NULL
  vim_strchr(endchars, *skipwhite(arg)) == NULL)
EMSG(_(e_letunexp));
!   else
{
c1 = name[len];
name[len] = NUL;
--- 2326,2332 
else if (endchars != NULL
  vim_strchr(endchars, *skipwhite(arg)) == NULL)
EMSG(_(e_letunexp));
!   else if (!check_secure())
{
c1 = name[len];
name[len] = NUL;
*** ../vim-7.3.069/src/version.c2010-11-24 18:48:08.0 +0100
--- src/version.c   2010-12-02 14:46:44.0 +0100
***
*** 716,717 
--- 716,719 
  {   /* Add new patch number below this line */
+ /**/
+ 70,
  /**/

-- 
The only way the average employee can speak to an executive is by taking a
second job as a golf caddie.
(Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- b...@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///

-- 
You received this message from the vim_dev maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Patch 7.3.072

2010-12-02 Fir de Conversatie Bram Moolenaar

Patch 7.3.072
Problem:Can't complete file names while ignoring case.
Solution:   Add 'wildignorecase'.
Files:  src/ex_docmd.c, src/ex_getln.c, src/misc1.c, src/option.c,
src/option.h, src/vim.h, runtime/doc/options.txt


*** ../vim-7.3.071/src/ex_docmd.c   2010-11-24 15:50:54.0 +0100
--- src/ex_docmd.c  2010-12-02 15:58:10.0 +0100
***
*** 4524,4535 
else /* n == 2 */
{
expand_Txpc;
  
ExpandInit(xpc);
xpc.xp_context = EXPAND_FILES;
p = ExpandOne(xpc, eap-arg, NULL,
!   WILD_LIST_NOTFOUND|WILD_ADD_SLASH,
!  WILD_EXPAND_FREE);
if (p == NULL)
return FAIL;
}
--- 4524,4537 
else /* n == 2 */
{
expand_Txpc;
+   int options = WILD_LIST_NOTFOUND|WILD_ADD_SLASH;
  
ExpandInit(xpc);
xpc.xp_context = EXPAND_FILES;
+   if (p_wic)
+   options += WILD_ICASE;
p = ExpandOne(xpc, eap-arg, NULL,
!  options, WILD_EXPAND_FREE);
if (p == NULL)
return FAIL;
}
*** ../vim-7.3.071/src/ex_getln.c   2010-11-16 14:05:48.0 +0100
--- src/ex_getln.c  2010-11-28 15:07:49.0 +0100
***
*** 3339,3348 
p2 = NULL;
else
{
p2 = ExpandOne(xp, p1,
 vim_strnsave(ccline.cmdbuff[i], xp-xp_pattern_len),
!   WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE
! |options, type);
vim_free(p1);
/* longest match: make sure it is not shorter, happens with :help */
if (p2 != NULL  type == WILD_LONGEST)
--- 3339,3352 
p2 = NULL;
else
{
+   int use_options = options |
+   WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE;
+ 
+   if (p_wic)
+   use_options += WILD_ICASE;
p2 = ExpandOne(xp, p1,
 vim_strnsave(ccline.cmdbuff[i], xp-xp_pattern_len),
!  use_options, type);
vim_free(p1);
/* longest match: make sure it is not shorter, happens with :help */
if (p2 != NULL  type == WILD_LONGEST)
***
*** 3428,3433 
--- 3432,3438 
   * options = WILD_KEEP_ALL:   don't remove 'wildignore' entries
   * options = WILD_SILENT: don't print warning messages
   * options = WILD_ESCAPE: put backslash before special chars
+  * options = WILD_ICASE:  ignore case for files
   *
   * The variables xp-xp_context and xp-xp_backslash must have been set!
   */
***
*** 4361,4366 
--- 4366,4372 
  char_u***matches; /* return: array of pointers to matches */
  {
  char_u*file_str = NULL;
+ int   options = WILD_ADD_SLASH|WILD_SILENT;
  
  if (xp-xp_context == EXPAND_UNSUCCESSFUL)
  {
***
*** 4379,4387 
  if (file_str == NULL)
return EXPAND_UNSUCCESSFUL;
  
  /* find all files that match the description */
! if (ExpandFromContext(xp, file_str, matchcount, matches,
! WILD_ADD_SLASH|WILD_SILENT) == FAIL)
  {
*matchcount = 0;
*matches = NULL;
--- 4385,4395 
  if (file_str == NULL)
return EXPAND_UNSUCCESSFUL;
  
+ if (p_wic)
+   options += WILD_ICASE;
+ 
  /* find all files that match the description */
! if (ExpandFromContext(xp, file_str, matchcount, matches, options) == FAIL)
  {
*matchcount = 0;
*matches = NULL;
***
*** 4433,4439 
  char_u*pat;
  int   *num_file;
  char_u***file;
! int   options;
  {
  #ifdef FEAT_CMDL_COMPL
  regmatch_Tregmatch;
--- 4441,4447 
  char_u*pat;
  int   *num_file;
  char_u***file;
! int   options;  /* EW_ flags */
  {
  #ifdef FEAT_CMDL_COMPL
  regmatch_Tregmatch;
***
*** 4487,4492 
--- 4495,4503 
flags |= (EW_FILE | EW_PATH);
else
flags = (flags | EW_DIR)  ~EW_FILE;
+   if (options  WILD_ICASE)
+   flags |= EW_ICASE;
+ 
/* Expand wildcards, supporting %:h and the like. */
ret = expand_wildcards_eval(pat, num_file, file, flags);
if (free_pat)
*** ../vim-7.3.071/src/misc1.c  2010-08-16 21:46:12.0 +0200
--- src/misc1.c 2010-11-28 15:02:57.0 

Re: Patch 7.3.072

2010-12-02 Fir de Conversatie Peter Odding

Patch 7.3.072
Problem:Can't complete file names while ignoring case.
Solution:   Add 'wildignorecase'.


Thanks for this patch Bram. This is one of the few things I've missed 
every day since I started using Vim some years ago. I just recompiled to 
try the patch and it works great!


 - Peter

--
You received this message from the vim_dev maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Patch 7.3.073

2010-12-02 Fir de Conversatie Bram Moolenaar

Patch 7.3.073
Problem:Double free memory when netbeans command follows DETACH.
Solution:   Only free the node when owned. (Xavier de Gaye)
Files:  src/netbeans.c


*** ../vim-7.3.072/src/netbeans.c   2010-11-16 15:48:57.0 +0100
--- src/netbeans.c  2010-12-02 16:59:11.0 +0100
***
*** 643,648 
--- 643,649 
  {
  char_u*p;
  queue_T   *node;
+ int   own_node;
  
  while (head.next != NULL  head.next != head)
  {
***
*** 681,700 
*p++ = NUL;
if (*p == NUL)
{
head.next = node-next;
node-next-prev = node-prev;
}
  
/* now, parse and execute the commands */
nb_parse_cmd(node-buffer);
  
!   if (*p == NUL)
{
/* buffer finished, dispose of the node and buffer */
vim_free(node-buffer);
vim_free(node);
}
!   else
{
/* more follows, move to the start */
STRMOVE(node-buffer, p);
--- 682,706 
*p++ = NUL;
if (*p == NUL)
{
+   own_node = TRUE;
head.next = node-next;
node-next-prev = node-prev;
}
+   else
+   own_node = FALSE;
  
/* now, parse and execute the commands */
nb_parse_cmd(node-buffer);
  
!   if (own_node)
{
/* buffer finished, dispose of the node and buffer */
vim_free(node-buffer);
vim_free(node);
}
!   /* Check that head wasn't changed under our fingers, e.g. when a
!* DETACH command was handled. */
!   else if (head.next == node)
{
/* more follows, move to the start */
STRMOVE(node-buffer, p);
*** ../vim-7.3.072/src/version.c2010-12-02 16:01:23.0 +0100
--- src/version.c   2010-12-02 17:00:29.0 +0100
***
*** 716,717 
--- 716,719 
  {   /* Add new patch number below this line */
+ /**/
+ 73,
  /**/

-- 
If the Universe is constantly expanding, why can't I ever find a parking space?

 /// Bram Moolenaar -- b...@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///

-- 
You received this message from the vim_dev maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: Regex \%V question

2010-12-02 Fir de Conversatie Christian Brabandt
On Thu, December 2, 2010 5:13 pm, Bram Moolenaar wrote:
 Christian, did you do any more work on this patch?

(There is another problem. Take a word, say test, visually select
it and then search for \%Vtest\%V. It won't match, because \%V
needs to match at the same cell as the t. And this doesn't work.

Effectively, \%V needs to match after the last column of the visually
selected region. But then, 'hls' will be off by one cell, which isn't
right either.)

So, no I didn't work on this anymore because I am too scared of the RE
code ;(

regards,
Christian

-- 
You received this message from the vim_dev maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Patch 7.3.074

2010-12-02 Fir de Conversatie Bram Moolenaar

Patch 7.3.074
Problem:Can't use the + register like * for yank and put.
Solution:   Add unnamedplus to the 'clipboard' option. (Ivan Krasilnikov)
Files:  runtime/doc/options.txt, src/eval.c, src/globals.h, src/ops.c,
src/option.c


*** ../vim-7.3.073/runtime/doc/options.txt  2010-12-02 16:01:23.0 
+0100
--- runtime/doc/options.txt 2010-12-02 21:22:48.0 +0100
***
*** 1434,1439 
--- 1434,1448 
explicitly accessed using the * notation.  Also see
|gui-clipboard|.
  
+   unnamedplus A variant of unnamed flag which uses the clipboard
+   register '+' (|quoteplus|) instead of register '*' for
+   all operations except yank.  Yank shall copy the text
+   into register '+' and also into '*' when unnamed is
+   included.
+   Only available with the |+x11| feature.
+   Availability can be checked with: 
+   if has('unnamedplus')
+ 
autoselect  Works like the 'a' flag in 'guioptions': If present,
then whenever Visual mode is started, or the Visual
area extended, Vim tries to become the owner of the
*** ../vim-7.3.073/src/eval.c   2010-12-02 14:47:56.0 +0100
--- src/eval.c  2010-12-02 17:30:23.0 +0100
***
*** 12135,12140 
--- 12139,12147 
  #ifdef FEAT_TOOLBAR
toolbar,
  #endif
+ #if defined(FEAT_CLIPBOARD)  defined(FEAT_X11)
+   unnamedplus,
+ #endif
  #ifdef FEAT_USR_CMDS
user-commands,/* was accidentally included in 5.4 */
user_commands,
*** ../vim-7.3.073/src/globals.h2010-11-24 14:28:53.0 +0100
--- src/globals.h   2010-12-02 20:07:42.0 +0100
***
*** 512,518 
  #  define clip_plus clip_star /* there is only one clipboard */
  #  define ONE_CLIPBOARD
  # endif
! EXTERN intclip_unnamed INIT(= FALSE);
  EXTERN intclip_autoselect INIT(= FALSE);
  EXTERN intclip_autoselectml INIT(= FALSE);
  EXTERN intclip_html INIT(= FALSE);
--- 512,522 
  #  define clip_plus clip_star /* there is only one clipboard */
  #  define ONE_CLIPBOARD
  # endif
! 
! #define CLIP_UNNAMED  1
! #define CLIP_UNNAMED_PLUS 2
! EXTERN intclip_unnamed INIT(= 0); /* above two values or'ed */
! 
  EXTERN intclip_autoselect INIT(= FALSE);
  EXTERN intclip_autoselectml INIT(= FALSE);
  EXTERN intclip_html INIT(= FALSE);
*** ../vim-7.3.073/src/ops.c2010-11-24 14:28:53.0 +0100
--- src/ops.c   2010-12-02 21:33:04.0 +0100
***
*** 1584,1592 
  adjust_clip_reg(rp)
  int   *rp;
  {
! /* If no reg. specified, and unnamed is in 'clipboard', use '*' reg. */
! if (*rp == 0  clip_unnamed)
!   *rp = '*';
  if (!clip_star.available  *rp == '*')
*rp = 0;
  if (!clip_plus.available  *rp == '+')
--- 1584,1594 
  adjust_clip_reg(rp)
  int   *rp;
  {
! /* If no reg. specified, and unnamed or unnamedplus is in 'clipboard',
!  * use '*' or '+' reg, respectively. unnamedplus prevails. */
! if (*rp == 0  clip_unnamed != 0)
!   *rp = ((clip_unnamed  CLIP_UNNAMED_PLUS)  clip_plus.available)
! ? '+' : '*';
  if (!clip_star.available  *rp == '*')
*rp = 0;
  if (!clip_plus.available  *rp == '+')
***
*** 2842,2847 
--- 2844,2850 
  char_u*p;
  char_u*pnew;
  struct block_def  bd;
+ int   did_star = FALSE;
  
/* check for read-only register */
  if (oap-regname != 0  !valid_yank_reg(oap-regname, TRUE))
***
*** 3115,3121 
   */
  if (clip_star.available
 (curr == (y_regs[STAR_REGISTER])
!   || (!deleting  oap-regname == 0  clip_unnamed)))
  {
if (curr != (y_regs[STAR_REGISTER]))
/* Copy the text from register 0 to the clipboard register. */
--- 3118,3125 
   */
  if (clip_star.available
 (curr == (y_regs[STAR_REGISTER])
!   || (!deleting  oap-regname == 0
!   (clip_unnamed  CLIP_UNNAMED
  {
if (curr != (y_regs[STAR_REGISTER]))
/* Copy the text from register 0 to the clipboard register. */
***
*** 3123,3128 
--- 3127,3133 
  
clip_own_selection(clip_star);
clip_gen_set_selection(clip_star);
+   did_star = TRUE;
  }
  
  # ifdef FEAT_X11
***
*** 3130,3141 
   * If we were yanking to the '+' register, send result to selection.
   * Also copy to the '*' register, in case auto-select is off.
   */
! else if (clip_plus.available  curr == 

[patch] fix stack corruption in vim/src/gui_riscos.c

2010-12-02 Fir de Conversatie Dominique Pellé
Hi

Running cppcheck static analyzer on vim/src/gui_riscos.c gives
the following warnings:

$ cppcheck gui_riscos.c
Checking gui_riscos.c...
[gui_riscos.c:1764] - [gui_riscos.c:2291]: (error) Array
'front_block[10]' index 20 out of bounds
[gui_riscos.c:1764] - [gui_riscos.c:2293]: (error) Array
'front_block[10]' index 28 out of bounds

gui_riscos.c:

  1757 if (button  0x444)
  1758 {
!!1759 int front_block[10];
  1760 /* Dragging with Select - bring window to front first */
  1761 front_block[0] = gui.window_handle;
  1762 swi(Wimp_GetWindowState, 0, front_block);
  1763 front_block[7] = -1;
!!1764 ro_open_main(front_block);
  1765 }

  
  2284 void
  2285 ro_open_main(block)
  2286 int *block;
  2287 {
  2288 int toggle_size;
  2289
  2290 /* Find out if the user clicked on the toggle size icon. */
!!2291 block[20] = block[0];
  2292 swi(Wimp_GetWindowState, 0, block + 20);
  2293 toggle_size = block[28]  (1  19);

ro_open_main() is called at line 1764 with buffer 'front_block'
which is 10-int large.  But the first thing that ro_open_main() does
is setting block[20] which is thus corrupting the stack.

Attached patch fixes it by making front_block size 64 int instead
of 10 int (just as other places where ro_open_main() is called).

ro_open_main() and other functions could also be static since
they are only used within gui_riscos.c but I leave that as it is
since I don't have riscos to verify.

Regards
-- Dominique

-- 
You received this message from the vim_dev maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff -r d94c32250814 src/gui_riscos.c
--- a/src/gui_riscos.c	Thu Dec 02 21:44:40 2010 +0100
+++ b/src/gui_riscos.c	Thu Dec 02 22:50:20 2010 +0100
@@ -1756,7 +1756,7 @@
 
 	if (button  0x444)
 	{
-	int	front_block[10];
+	int	front_block[64];
 	/* Dragging with Select - bring window to front first */
 	front_block[0] = gui.window_handle;
 	swi(Wimp_GetWindowState, 0, front_block);
@@ -1874,7 +1874,7 @@
 
 if (ro_dragging == DRAG_RESIZE_WINDOW)
 {
-	/* Resizeing the main window. */
+	/* Resizing the main window. */
 	block[2] = y;
 	block[3] = x;
 	ro_open_main(block);
@@ -2651,7 +2651,7 @@
 long_u	length;
 
 block[0] = 48;			/* Size of block. */
-block[3] = 0;			/* Orinial message. */
+block[3] = 0;			/* Original message. */
 block[4] = 0x10;			/* Data request. */
 block[5] = gui.window_handle;
 block[6] = RO_LOAD_CLIPBOARD;	/* Internal handle. */


Re: [PATCH] fix man page viewing with man-db

2010-12-02 Fir de Conversatie Matt Wozniski
2010/11/29 Bram Moolenaar b...@moolenaar.net:

 Pádraig wrote:
     Ensure vim is not recursively invoked (man-db does this)
     when doing ctrl-[ on a man page reference

Shouldn't that be ctrl-] ?

-- 
You received this message from the vim_dev maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Issue with mksession and drag and drop

2010-12-02 Fir de Conversatie Phil
Hello,

I see something which seems to be a bug but I would like to discuss it
here. Indeed, I do not find bugtracker and I'm not sure my issue is
really a bug.

There comes a time when I choose to open a file by using drag  drop
of
a file into Vim windows. When I do that, the file replaces the current
one and a new entry is present on :ls result. When I need to forget
this
file, I do :bw on it to erase completely the buffer. Next, if I create
a
vim session, using :mksession and if I load it to a new vim instance
with :source command, the buffer I previously erased is still loaded
in
buffer list.

I checked the file produced by :mksession and the file opened by drag

drop is present near the arg command. So, it is in the arglist and
that
is the reason why I see it in my session script. Is it the normal
behaviour? When this script is loaded, a buffer is generated for this
file and I can see it in :ls list.

I see the same problem at home on Debian and at work on Windows XP (I
use gVim both places).

Please, forgive potential english mistakes, this is not my native
tongue.

Regards,

--
Philippe

-- 
You received this message from the vim_dev maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php