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

Bug: bad symlink handling on windows.

Expand Messages
  • Ian Kelling
    It seems by default, vim overwrites windows symlinks with a copy of the file on save. This is instead of following the symlink and writing to the correct
    Message 1 of 4 , Nov 4, 2009
    View Source
    • 0 Attachment
      It seems by default, vim overwrites windows symlinks with a copy of
      the file on save. This is instead of following the symlink and writing
      to the correct location.

      I have some setting in my .vimrc (not sure which one) that slightly
      alters this behavior. It writes to the symlinked location, but makes
      the file read-only, and then opening the file again in a new vim
      instance, and doing wq! destroys the symlink again like in the first
      case. For reference, this is for symlinks made in cmd.exe with "mklink
      target source"

      Any ideas about this? If there is no workaround, any suggestions on
      where to look in the code to make a fix?

      - Ian
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Bram Moolenaar
      ... How do you create such a symbolic link? What version of Vim are you using? A Cygwin version perhaps? -- bashian roulette: $ ((RANDOM%6)) || rm -rf ~ ///
      Message 2 of 4 , Nov 4, 2009
      View Source
      • 0 Attachment
        Ian Kelling wrote:

        > It seems by default, vim overwrites windows symlinks with a copy of
        > the file on save. This is instead of following the symlink and writing
        > to the correct location.
        >
        > I have some setting in my .vimrc (not sure which one) that slightly
        > alters this behavior. It writes to the symlinked location, but makes
        > the file read-only, and then opening the file again in a new vim
        > instance, and doing wq! destroys the symlink again like in the first
        > case. For reference, this is for symlinks made in cmd.exe with "mklink
        > target source"
        >
        > Any ideas about this? If there is no workaround, any suggestions on
        > where to look in the code to make a fix?

        How do you create such a symbolic link?

        What version of Vim are you using? A Cygwin version perhaps?

        --
        bashian roulette:
        $ ((RANDOM%6)) || rm -rf ~

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ download, build and distribute -- http://www.A-A-P.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Ian Kelling
        This is with 7.2 windows version downloaded from vim.org. I mentioned how to make the symlink in the original message, but to be more explicit: run cmd.exe,
        Message 3 of 4 , Nov 4, 2009
        View Source
        • 0 Attachment
          This is with 7.2 windows version downloaded from vim.org. I mentioned
          how to make the symlink in the original message, but to be more
          explicit: run cmd.exe, aka the windows command line interpreter. Then
          run the command: "mklink target source", where target is the link you
          are creating and source is the file it links to. Not sure if this
          works on xp, but definitly vista or later. To see more about that
          command, run "mklink /?"

          On Nov 4, 2:56 pm, Bram Moolenaar <B...@...> wrote:
          > Ian Kelling wrote:
          > > It seems by default, vim overwrites windows symlinks with a copy of
          > > the file on save. This is instead of following the symlink and writing
          > > to the correct location.
          >
          > > I have some setting in my .vimrc (not sure which one) that slightly
          > > alters this behavior. It writes to the symlinked location, but makes
          > > the file read-only, and then opening the file again in a new vim
          > > instance, and doing wq! destroys the symlink again like in the first
          > > case. For reference, this is for symlinks made in cmd.exe with "mklink
          > > target source"
          >
          > > Any ideas about this? If there is no workaround, any suggestions on
          > > where to look in the code to make a fix?
          >
          > How do you create such a symbolic link?
          >
          > What version of Vim are you using?  A Cygwin version perhaps?
          >
          > --
          > bashian roulette:
          > $ ((RANDOM%6)) || rm -rf ~
          >
          >  /// Bram Moolenaar -- B...@... --http://www.Moolenaar.net  \\\
          > ///        sponsor Vim, vote for features --http://www.Vim.org/sponsor/\\\
          > \\\        download, build and distribute --http://www.A-A-P.org       ///
          >  \\\            help me help AIDS victims --http://ICCF-Holland.org   ///
          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_dev" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Bram Moolenaar
          ... I found a page mentioning that mklink is new in Vista. I don t have Vista (and no plans getting it), so perhaps someone else can dive into what happens in
          Message 4 of 4 , Nov 5, 2009
          View Source
          • 0 Attachment
            Ian Kelling wrote:

            > This is with 7.2 windows version downloaded from vim.org. I mentioned
            > how to make the symlink in the original message, but to be more
            > explicit: run cmd.exe, aka the windows command line interpreter. Then
            > run the command: "mklink target source", where target is the link you
            > are creating and source is the file it links to. Not sure if this
            > works on xp, but definitly vista or later. To see more about that
            > command, run "mklink /?"

            I found a page mentioning that mklink is new in Vista.

            I don't have Vista (and no plans getting it), so perhaps someone else
            can dive into what happens in Vim when opening a symbolic link. Vim can
            handle other types of links, thus it should be a matter of detecting
            that a symbolic link is being used.

            --
            Yesterday, all my deadlines seemed so far away
            now it looks as though it's freeze in four days
            oh I believe in cvs..
            [ CVS log "Beatles style" for FreeBSD ports/INDEX, Satoshi Asami ]

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            \\\ download, build and distribute -- http://www.A-A-P.org ///
            \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_dev" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          Your message has been successfully submitted and would be delivered to recipients shortly.