Loading ...
Sorry, an error occurred while loading the content.

72905Re: Bug: Erroneous "Cannot create directory" in "mkdir('foo/bar/', 'p')"

Expand Messages
  • David Barnett
    Aug 21, 2013
    • 0 Attachment
      Yep, your patch fixes the symptom, both for 'foo/' and 'foo//'. Better your workaround in vim than my workaround in vimscript!

      (BTW, the indentation in the patch looked a little screwy.)

      David


      On Wed, Aug 21, 2013 at 8:41 AM, LCD 47 <lcd047@...> wrote:
      On 21 August 2013, Marius Gedminas <marius@...> wrote:
      > On Wed, Aug 21, 2013 at 01:56:31PM +0300, LCD 47 wrote:
      > > On 20 August 2013, David Barnett <daviebdawg@...> wrote:
      > > > Ensure ./foo doesn't exist, and do
      > > >   :call mkdir('foo/bar/', 'p')
      > > >
      > > > Vim gives you an error:
      > > >   E739: Cannot create directory: foo/bar/
      > > > but the directory was created just fine.
      > > >
      > > > Dropping the trailing slash works without error:
      > > >   :call mkdir('foo/bar', 'p')
      > >
      > >     Please try the patch below.  It kills the trailing slash, which
      > > seems pretty awkward for a fix.
      >
      >
      > > diff -r ae6c19fb32e1 src/eval.c
      > > --- a/src/eval.c    Wed Aug 14 17:45:29 2013 +0200
      > > +++ b/src/eval.c    Wed Aug 21 13:49:19 2013 +0300
      > > @@ -14284,6 +14284,7 @@
      > >      typval_T       *rettv;
      > >  {
      > >      char_u *dir;
      > > +    char_u *p;
      > >      char_u buf[NUMBUFLEN];
      > >      int            prot = 0755;
      > >
      > > @@ -14292,6 +14293,13 @@
      > >     return;
      > >
      > >      dir = get_tv_string_buf(&argvars[0], buf);
      > > +    p = gettail(dir);
      > > +    if (!*p)
      > > +    {
      > > +   p = gettail_sep(dir);
      > > +   *p = 0;
      > > +    }
      > > +
      >
      > What about :call mkdir('foo/bar//', 'p')?
      [...]

          It should work just as well.  Have you actually tried the patch?

          /lcd

      --
      --
      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

      ---
      You received this message because you are subscribed to a topic in the Google Groups "vim_dev" group.
      To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_dev/rFT67RzKMfU/unsubscribe.
      To unsubscribe from this group and all its topics, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.

      --
      --
      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
       
      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 9 messages in this topic