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

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

Expand Messages
  • LCD 47
    Aug 21, 2013
    • 0 Attachment
      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.

      /lcd


      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;
      + }
      +
      if (argvars[1].v_type != VAR_UNKNOWN)
      {
      if (argvars[2].v_type != VAR_UNKNOWN)
      @@ -14299,7 +14307,7 @@
      if (prot != -1 && STRCMP(get_tv_string(&argvars[1]), "p") == 0)
      mkdir_recurse(dir, prot);
      }
      - rettv->vval.v_number = prot != -1 ? vim_mkdir_emsg(dir, prot) : 0;
      + rettv->vval.v_number = prot != -1 ? vim_mkdir_emsg(dir, prot) : FAIL;
      }
      #endif


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