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

Looking for a volunteer to fix find_file_in_path()

Expand Messages
  • Bram Moolenaar
    Fellow Vim developers, We have had quite a few bugs in the find_file_in_path() code. Now the problem is that when the current directory path contains ** then
    Message 1 of 6 , Feb 5, 2012
    • 0 Attachment
      Fellow Vim developers,

      We have had quite a few bugs in the find_file_in_path() code.
      Now the problem is that when the current directory path contains "**"
      then ":cd" fails, because it tries to expand "**" instead of taking in
      literally.

      This code is complicated and includes a few hacks and workarounds.
      E.g., it uses EW_NOTWILD to try both matches with wildcards and without.
      It is about time it is rewritten.

      This includes the code under vim_findfile_init() and vim_findfile().

      Anyone who likes a challenge?

      --
      hundred-and-one symptoms of being an internet addict:
      29. Your phone bill comes to your doorstep in a box.

      /// Bram Moolenaar -- Bram@... -- 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
    • Nazri Ramliy
      ... [challenge snipped] I d like to report that the behavior does not exist outside of $HOME: $ cd /tmp $ mkdir -p **/xxx/yyy $ cd ** $ vim -u NONE ... It
      Message 2 of 6 , Feb 7, 2012
      • 0 Attachment
        On Mon, Feb 6, 2012 at 5:18 AM, Bram Moolenaar <Bram@...> wrote:
        > We have had quite a few bugs in the find_file_in_path() code.
        > Now the problem is that when the current directory path contains "**"
        > then ":cd" fails, because it tries to expand "**" instead of taking in
        > literally.

        [challenge snipped]

        I'd like to report that the behavior does not exist outside of $HOME:

        $ cd /tmp
        $ mkdir -p '**/xxx/yyy'
        $ cd '**'
        $ vim -u NONE
        :cd yyy

        It worked fine.

        When done in $HOME - replace "cd /tmp" with "cd $HOME" in the script
        above - the problem appears: after ":cd yyy" vim seems to be in a busy
        loop. After hitting Ctrl+C it shows the error

        E344: Can't find directory"xxx" in cdpath
        E472: Command failed

        My vim version:

        VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jan 26 2012 13:14:36)
        Included patches: 1-401

        So maybe the fix might be simpler than a full rewrite?

        Nazri.

        --
        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
      • Nazri Ramliy
        ... One more detail: The bug is triggered only when ** is right under $HOME. It does not appear for this case: cd $HOME $ mkdir -p a/**/xxx/yyy $ cd a/**
        Message 3 of 6 , Feb 7, 2012
        • 0 Attachment
          On Wed, Feb 8, 2012 at 9:59 AM, Nazri Ramliy <ayiehere@...> wrote:
          > I'd like to report that the behavior does not exist outside of $HOME:

          One more detail:

          The bug is triggered only when '**' is right under $HOME.

          It does not appear for this case:

          cd $HOME
          $ mkdir -p 'a/**/xxx/yyy'
          $ cd 'a/**'
          $ vim -u NONE
          :cd xxx <-- works fine

          Nazri.

          --
          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
        • Nazri Ramliy
          ... But strangely: $ cd $HOME $ mkdir -p tmp/**/xxx/yyy $ cd tmp/** $ vim -u NONE ... Nazri -- You received this message from the vim_dev maillist. Do
          Message 4 of 6 , Feb 7, 2012
          • 0 Attachment
            On Wed, Feb 8, 2012 at 11:50 AM, Nazri Ramliy <ayiehere@...> wrote:
            > On Wed, Feb 8, 2012 at 9:59 AM, Nazri Ramliy <ayiehere@...> wrote:
            >> I'd like to report that the behavior does not exist outside of $HOME:
            >
            > One more detail:
            >
            > The bug is triggered only when '**' is right under $HOME.
            >
            > It does not appear for this case:
            >
            >  cd $HOME
            >  $ mkdir -p 'a/**/xxx/yyy'
            >  $ cd 'a/**'
            >  $ vim -u NONE
            >  :cd xxx  <-- works fine

            But strangely:

            $ cd $HOME
            $ mkdir -p 'tmp/**/xxx/yyy'
            $ cd 'tmp/**'
            $ vim -u NONE
            :cd xxx <-- gives error???

            Nazri

            --
            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
          • Nazri Ramliy
            ... #!/bin/sh base=$HOME/foo # works fine #base=$HOME/bar # works fine #base=$HOME/t # works fine #base=$HOME/tmp # Error! #base=$HOME # Error!
            Message 5 of 6 , Feb 7, 2012
            • 0 Attachment
              On Wed, Feb 8, 2012 at 11:59 AM, Nazri Ramliy <ayiehere@...> wrote:
              > On Wed, Feb 8, 2012 at 11:50 AM, Nazri Ramliy <ayiehere@...> wrote:
              >> On Wed, Feb 8, 2012 at 9:59 AM, Nazri Ramliy <ayiehere@...> wrote:
              >>> I'd like to report that the behavior does not exist outside of $HOME:
              >>
              >> One more detail:
              >>
              >> The bug is triggered only when '**' is right under $HOME.
              >>
              >> It does not appear for this case:
              >>
              >>  cd $HOME
              >>  $ mkdir -p 'a/**/xxx/yyy'
              >>  $ cd 'a/**'
              >>  $ vim -u NONE
              >>  :cd xxx  <-- works fine
              >
              > But strangely:
              >
              >  $ cd $HOME
              >  $ mkdir -p 'tmp/**/xxx/yyy'
              >  $ cd 'tmp/**'
              >  $ vim -u NONE
              >  :cd xxx  <-- gives error???
              >
              > Nazri

              Here's a little shell script that I use to test this behavior:

              --->8---
              #!/bin/sh
              base=$HOME/foo # works fine
              #base=$HOME/bar # works fine
              #base=$HOME/t # works fine
              #base=$HOME/tmp # Error!
              #base=$HOME # Error!
              mkdir -p $base/'**/xxx/yyy'
              cd $base/'**'
              vim -u NONE -c 'cd xxx' -c pwd
              ---8<---

              Nazri
              (Careful with the scissors!)

              --
              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
            • Nazri Ramliy
              ... Ah sorry for the noise. The problems exists irrespective of $CWD. It s just that in my /tmp there are not that many files compared to in my $HOME so when
              Message 6 of 6 , Feb 7, 2012
              • 0 Attachment
                On Wed, Feb 8, 2012 at 12:06 PM, Nazri Ramliy <ayiehere@...> wrote:
                >> But strangely:
                >>
                >>  $ cd $HOME
                >>  $ mkdir -p 'tmp/**/xxx/yyy'
                >>  $ cd 'tmp/**'
                >>  $ vim -u NONE
                >>  :cd xxx  <-- gives error???

                Ah sorry for the noise. The problems exists irrespective of $CWD. It's
                just that in my /tmp there are not that many files compared to in my
                $HOME so when run from /tmp the problem is not as obvious as when run
                in $HOME.

                Nazri

                --
                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
              Your message has been successfully submitted and would be delivered to recipients shortly.