Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
'backupcopy' and Windows Vista symbolic links
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  16 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ben Fritz  
View profile  
 More options Jul 6 2011, 11:56 pm
From: Ben Fritz <fritzophre...@gmail.com>
Date: Wed, 6 Jul 2011 20:56:16 -0700 (PDT)
Local: Wed, Jul 6 2011 11:56 pm
Subject: 'backupcopy' and Windows Vista symbolic links
:help 'backupcopy' indicates that the default value of "auto" should
Do The Right Thing when the file is really a symbolic link:

        The "auto" value is the middle way: When Vim sees that renaming file
        is possible without side effects (the attributes can be passed on and
        the file is not a link) that is used.  When problems are expected, a
        copy will be made.

I confirm that my 'backupcopy' is set to "auto", but when writing to a
symbolic link in Windows Vista, the link gets destroyed.

The following "fixes" the problem:

    " for some reason, backupcopy=auto doesn't work on Windows to keep
    " symbolic links. I use these in my vimfiles directory to override
some
    " runtime files which I really edit in the vim source repository.
    autocmd BufWritePre ~/vimfiles/* set backupcopy=yes
    autocmd BufWritePost ~/vimfiles/* set backupcopy&

I don't think this ought to be necessary. Am I missing something? If
not, this looks like a bug. But, I cannot imagine I'm the first person
to notice this.

Note, I was lead to this solution (in a roundabout way) from here:

http://superuser.com/questions/193872/vim-destroys-symbolic-links-und...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bram Moolenaar  
View profile  
 More options Jul 7 2011, 7:34 am
From: Bram Moolenaar <B...@Moolenaar.net>
Date: Thu, 07 Jul 2011 13:34:12 +0200
Local: Thurs, Jul 7 2011 7:34 am
Subject: Re: 'backupcopy' and Windows Vista symbolic links

There is the mch_is_linked() function which is supposed to detect links
on a file.  I don't know why it doesn't work in this situation.  Are you
using a recent version of Vim?

--
hundred-and-one symptoms of being an internet addict:
253. You wait for a slow loading web page before going to the toilet.

 /// 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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Benjamin Fritz  
View profile  
 More options Jul 7 2011, 11:01 am
From: Benjamin Fritz <fritzophre...@gmail.com>
Date: Thu, 7 Jul 2011 10:01:34 -0500
Local: Thurs, Jul 7 2011 11:01 am
Subject: Re: 'backupcopy' and Windows Vista symbolic links

Yes, the "Vim without Cream" install for 7.3.206. I'm not running as
administrator, but required admin access to create the links. That
doesn't affect anything, does it? I can try again from the admin
account later if it might.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Craig Barkhouse  
View profile  
 More options Jul 20 2011, 3:54 pm
From: Craig Barkhouse <crai...@microsoft.com>
Date: Wed, 20 Jul 2011 19:54:09 +0000
Local: Wed, Jul 20 2011 3:54 pm
Subject: RE: 'backupcopy' and Windows Vista symbolic links

The mch_is_linked() function in os_win32.c only checks if there is more than one hard link (i.e. name) for the file.  It doesn't check if the file is a symbolic link.  By contrast the Unix code does check if the file is a symbolic link.

Sounds like a TODO item.

Craig


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Pope  
View profile  
 More options Mar 14 2012, 9:33 pm
From: David Pope <d.e.p...@gmail.com>
Date: Wed, 14 Mar 2012 18:33:20 -0700 (PDT)
Local: Wed, Mar 14 2012 9:33 pm
Subject: Re: 'backupcopy' and Windows Vista symbolic links

On Wednesday, July 20, 2011 3:54:09 PM UTC-4, Craig Barkhouse wrote:
> The mch_is_linked() function in os_win32.c only checks if there is more than one hard link (i.e. name) for the file.  It doesn't check if the file is a symbolic link.  By contrast the Unix code does check if the file is a symbolic link.

> Sounds like a TODO item.

Hello all, did this ever get turned into a TODO item?  I've encountered this myself (I'm syncing all my vim configuration across machines using Dropbox, with symbolic links for .vim/, .vimrc, and .gvimrc).

I see in the latest Mercurial code that mch_is_linked() still only checks for hard links.  If it's not already in someone's TODO bucket I can work on a fix.  The APIs are straightforward in the versions of Windows that support symlinks; I suspect more of the work will be in figuring out how to get that support into vim without breaking binary compatibility on older systems.  Would the maintainers be interested in seeing a patch for this?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bram Moolenaar  
View profile  
 More options Mar 15 2012, 3:28 pm
From: Bram Moolenaar <B...@Moolenaar.net>
Date: Thu, 15 Mar 2012 20:28:03 +0100
Local: Thurs, Mar 15 2012 3:28 pm
Subject: Re: 'backupcopy' and Windows Vista symbolic links

A patch definitely helps.  And a way to reproduce the problem.

--
hundred-and-one symptoms of being an internet addict:
194. Your business cards contain your e-mail and home page address.

 /// 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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Benjamin Fritz  
View profile  
 More options Mar 15 2012, 5:02 pm
From: Benjamin Fritz <fritzophre...@gmail.com>
Date: Thu, 15 Mar 2012 16:02:05 -0500
Local: Thurs, Mar 15 2012 5:02 pm
Subject: Re: 'backupcopy' and Windows Vista symbolic links

Reproduction is easy.

1. Create a symbolic link on Windows. (e.g. mklink link_path target_path)
2. open the file in Vim
3. write the file from Vim

The symbolic link has been destroyed, now it's a "real" file separate
from the file it was originally linked to.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Pope  
View profile  
 More options Mar 21 2012, 2:27 am
From: David Pope <d.e.p...@gmail.com>
Date: Wed, 21 Mar 2012 02:27:36 -0400
Local: Wed, Mar 21 2012 2:27 am
Subject: [Patch] Re: 'backupcopy' and Windows Vista symbolic links

On Thu, Mar 15, 2012 at 5:02 PM, Benjamin Fritz <fritzophre...@gmail.com>wrote:

Here's my first shot at a patch that fixes the "can't save to symlinks" bug
on Windows.  It augments the Windows version of mch_is_linked() to also
return TRUE if the file is a symbolic link, so the delete-then-move pattern
is avoided and the symlink is preserved.

The patch also addresses a separate bug I encountered while fixing the
above.  If you set nowritebackup on Windows, and then save a file that you
opened via a symbolic link, the readonly attribute gets set.

The cause was that the Windows version of mch_getperm() was returning
Windows FILE_ATTRIBUTE_* flags instead of the Unix-style flags in mode_t,
which was then later passed unchanged to the CRT open() function (which
expects mode_t flags).

For a normal (non-symlink, non-whatever) file, this just happened to be
FILE_ATTRIBUTE_NORMAL (0200, 0x80), which maps to the Unix S_IWUSR.  By
sheer chance, this meant that normal files correctly received write
permission, i.e. no readonly flag.

For a symlink, FILE_ATTRIBUTE_NORMAL is not set; for example, the symlink I
was testing against returned FILE_ATTRIBUTE_ARCHIVE (040, 0x20) and
FILE_ATTRIBUTE_REPARSE_POINT (02000, 0x400).  By the time these made it
back to create(), it appeared as though we wanted no write permissions,
i.e. set the readonly flag.

The patch changes os_win32.c so that all code outside of the file deals
with mode_t flags, while os_win32.c itself deals with FILE_ATTRIBUTE_*
flags.  There are a couple of new internal helper functions for this.

This is my first patch, so I'm sure I messed up somewhere; feedback is
welcome.  Sorry if the above is too wordy, this was a fun one to diagnose.
 ;)

Caveats:
  * I have no way to test Win98, can someone help?  There is lots of Win98
fallback code in os_win32.c (to use non-Unicode functions when FEAT_MBYTE
is defined).
  * I added win32_* signatures to os_win32.pro for the new internal
functions; I'm not sure if the *.pro files are intended mainly for function
exports, or just to avoid having to make forward declarations (as I've done
here).
  * I'm using a couple of CRT functions that weren't in use before; I don't
know if it's reasonable to assume that they work as expected on all the old
platforms that are required.

----
David Pope

  symlinkfix.diff
11K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Pope  
View profile  
 More options Mar 24 2012, 12:35 am
From: David Pope <d.e.p...@gmail.com>
Date: Sat, 24 Mar 2012 00:35:18 -0400
Local: Sat, Mar 24 2012 12:35 am
Subject: Re: [Patch] Re: 'backupcopy' and Windows Vista symbolic links

Hello Bram, Benjamin, and all,

Is there any feedback on this patch, or on the way the fix was presented?
 As I said earlier, I'm new to vim development so I'm all ears.  :)  Is
there someone I need to direct this patch toward, e.g. someone who deals
primarily with the Windows version of vim, to get it vetted/updated for
mainline inclusion?

Thanks,
----
David Pope


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Benjamin Fritz  
View profile  
 More options Mar 26 2012, 11:00 am
From: Benjamin Fritz <fritzophre...@gmail.com>
Date: Mon, 26 Mar 2012 10:00:44 -0500
Local: Mon, Mar 26 2012 11:00 am
Subject: Re: [Patch] Re: 'backupcopy' and Windows Vista symbolic links

On Fri, Mar 23, 2012 at 11:35 PM, David Pope <d.e.p...@gmail.com> wrote:

> Is there any feedback on this patch, or on the way the fix was presented?
>  As I said earlier, I'm new to vim development so I'm all ears.  :)  Is
> there someone I need to direct this patch toward, e.g. someone who deals
> primarily with the Windows version of vim, to get it vetted/updated for
> mainline inclusion?

I'd like to test, but currently the only computers I use are stuck on
Windows XP and I'm not able to. The machine I was using at the time I
originally encountered the issue was a dual-boot Windows Vista/Ubuntu
machine, which now has a bad motherboard.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Pope  
View profile   Translate to Translated (View Original)
 More options Mar 29 2012, 1:52 am
From: David Pope <d.e.p...@gmail.com>
Date: Thu, 29 Mar 2012 01:52:49 -0400
Local: Thurs, Mar 29 2012 1:52 am
Subject: Re: [Patch] Re: 'backupcopy' and Windows Vista symbolic links

On Mon, Mar 26, 2012 at 11:00 AM, Benjamin Fritz <fritzophre...@gmail.com>wrote:

> I'd like to test, but currently the only computers I use are stuck on
> Windows XP and I'm not able to. The machine I was using at the time I
> originally encountered the issue was a dual-boot Windows Vista/Ubuntu
> machine, which now has a bad motherboard.

Thanks, any help is appreciated.  I have updated the patch with some
further fixes (it broke a common pattern for calling mch_getperms to check
for file existence).  The latest patch is available in my fork at github:
https://code.google.com/r/depope-vim/ .  Should I continue posting patches
here in vim_dev or is github considered better?

-- Dave


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Fritz  
View profile  
 More options Mar 29 2012, 10:30 am
From: Ben Fritz <fritzophre...@gmail.com>
Date: Thu, 29 Mar 2012 07:30:10 -0700 (PDT)
Local: Thurs, Mar 29 2012 10:30 am
Subject: Re: [Patch] Re: 'backupcopy' and Windows Vista symbolic links

On Thursday, March 29, 2012 12:52:49 AM UTC-5, David Pope wrote:
> Thanks, any help is appreciated.  I have updated the patch with some further
> fixes (it broke a common pattern for calling mch_getperms to check for file
> existence).  The latest patch is available in my fork at github:
> https://code.google.<WBR>com/r/depope-vim/ .  Should I continue posting
> patches here in vim_dev or is github considered better?

That's not github, by the way :-)

It can be nice to pull from a real repository, but some people (me included) would prefer to put experimental patches into a patch queue with mq. I like this option better because Bram doesn't pull from clones, he just uses the patches (or at least this is the case for the "official" repository, obviously I don't know what his personal clones might look like). So, if I pull a bunch of changes on the default branch into my clone, that history never gets pulled in and either I will need to strip it or let some extra head just dangle.

So if you want to commit to a clone, that's good, and you should share it...but certainly continue posting patches on vim_dev. I wonder if there's a good way to share patch queues related to a project? That might be an even better way.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Pope  
View profile  
 More options Mar 29 2012, 10:43 am
From: David Pope <d.e.p...@gmail.com>
Date: Thu, 29 Mar 2012 10:43:34 -0400
Local: Thurs, Mar 29 2012 10:43 am
Subject: Re: [Patch] Re: 'backupcopy' and Windows Vista symbolic links

On Thu, Mar 29, 2012 at 10:30 AM, Ben Fritz <fritzophre...@gmail.com> wrote:

> That's not github, by the way :-)

oops :)

> It can be nice to pull from a real repository, but some people (me
> included) would prefer to put experimental patches into a patch queue with
> mq. I like this option better because Bram doesn't pull from clones, he
> just uses the patches (or at least this is the case for the "official"
> repository, obviously I don't know what his personal clones might look
> like). So, if I pull a bunch of changes on the default branch into my
> clone, that history never gets pulled in and either I will need to strip it
> or let some extra head just dangle.

So if you want to commit to a clone, that's good, and you should share

> it...but certainly continue posting patches on vim_dev. I wonder if there's
> a good way to share patch queues related to a project? That might be an
> even better way.

Good point; I haven't used the mq extension before, so I'll go figure it
out, along with its implied workflows.  I'll probably have questions after
that.  ;)

Thanks,
-- Dave


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Halliday  
View profile  
 More options Aug 22 2012, 3:29 pm
From: Ian Halliday <ianwjhalli...@gmail.com>
Date: Wed, 22 Aug 2012 12:29:47 -0700 (PDT)
Local: Wed, Aug 22 2012 3:29 pm
Subject: Re: [Patch] Re: 'backupcopy' and Windows Vista symbolic links

What ever happened to this patch?

I just ran into this problem for a second time in the last year, having forgotten how to fix it since last time, had to look everything up again.  A fix in the main branch would be great to have.

Ian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ken Takata  
View profile  
 More options Aug 24 2012, 11:41 pm
From: Ken Takata <ken...@csc.jp>
Date: Fri, 24 Aug 2012 20:41:45 -0700 (PDT)
Local: Fri, Aug 24 2012 11:41 pm
Subject: Re: [Patch] Re: 'backupcopy' and Windows Vista symbolic links

Hi,

2012/08/23 Thu 4:29:47 UTC+9 Ian Halliday:

> I just ran into this problem for a second time in the last year, having forgotten how to fix it since last time, had to look everything up again.  A fix in the main branch would be great to have.

Good timing. I also found this problem a few days ago.
I tried to write my own patch but it didn't work well. :-<

Then I found your post and tried David's patch.
It seems that the patch works well but I found a little problem.
This is an updated patch.
https://gist.github.com/3436380

The differences from David's patch are:
 1. Fix memory leakage in win32_file_is_symbolic_link().
 2. Use mch_stat() to implement mch_getperm().
    (His implementation on Google Code does not support multibyte characters.)
 3. Add support for "breakhardlink" and "breaksymlink".
 4. Change the name of some functions.

Best regards,
Ken Takata


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ken Takata  
View profile  
 More options Sep 24 2012, 11:45 am
From: Ken Takata <ken...@csc.jp>
Date: Mon, 24 Sep 2012 08:45:10 -0700 (PDT)
Local: Mon, Sep 24 2012 11:45 am
Subject: Re: [Patch] Re: 'backupcopy' and Windows Vista symbolic links

Hi,

2012/08/25 Sat 12:41:45 UTC+9 Ken Takata:

> Then I found your post and tried David's patch.
> It seems that the patch works well but I found a little problem.
> This is an updated patch.
> https://gist.github.com/3436380

> The differences from David's patch are:
>  1. Fix memory leakage in win32_file_is_symbolic_link().
>  2. Use mch_stat() to implement mch_getperm().
>     (His implementation on Google Code does not support multibyte characters.)
>  3. Add support for "breakhardlink" and "breaksymlink".
>  4. Change the name of some functions.

I have updated the patch.

 1. fix mch_remove() to support multibyte file name again.
 2. fix return value of win32_setattrs().
 3. add some comments.

Best regards,
Ken Takata

  symlinkfix-update.diff
9K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »