public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Matt D." <codespunk@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Native symbolic link behavior is broken and makes backups using Cygwin command line tools impossible
Date: Mon, 4 Jan 2021 05:36:35 -0500	[thread overview]
Message-ID: <CAC+X2=L2tCUSUYreh2oTSt33Zn295Boru6eAPfkckksKXnB4vQ@mail.gmail.com> (raw)
In-Reply-To: <1d853aa0-4cbe-b92c-8d9f-53fc72371a7b@SystematicSw.ab.ca>

Did you try any of my test cases? This can't and doesn't work for the
reasons I outlined in my previous message:

$ cp -av folder_a/a folder_b/
'folder_a/a' -> 'folder_b/a'
cp: cannot create symbolic link 'folder_b/a': No such file or directory

$ cp -dv folder_a/a folder_b/
'folder_a/a' -> 'folder_b/a'
cp: cannot create symbolic link 'folder_b/a': No such file or directory

$ cp -Pv folder_a/a folder_b/
'folder_a/a' -> 'folder_b/a'
cp: cannot create symbolic link 'folder_b/a': No such file or directory

On Sun, Jan 3, 2021 at 12:00 AM Brian Inglis
<Brian.Inglis@systematicsw.ab.ca> wrote:
>
> On 2021-01-02 21:16, Matt D. via Cygwin wrote:
> > I have a folder with a lot of native Windows symbolic links. I want to
> > copy this folder.
> >
> > I cannot rsync or cp this folder due to Cygwin being unable to create
> > symbolic links without also wanting to verify the link target. This
> > can be demonstrated:
> >
> > $ ln -s a b
> > ln: failed to create symbolic link 'b': No such file or directory
> >
> > If I create a test directory folder_a/ and folder_b/. Inside I will
> > "touch a" and "ln -s a b".
> >
> > I cannot rsync this folder:
> >
> > $ rsync -a folder_a/ folder_b/
> > rsync: symlink "folder_a/b" -> "a" failed: No such file or directory (2)
> > rsync error: some files/attrs were not transferred (see previous
> > errors) (code 23) at main.c(1306) [sender=3.2.0dev]
> >
> > Using "cp -a folder_a/* folder_b/" in this test case DOES work but
> > this is simply because files were returned in the correct order and
> > the link could be created.
> >
> > This can be demonstrated where this works fine:
> >
> > $ cp -a folder_a/a folder_a/b folder_b/
> >
> > But this does not:
> >
> > $ cp -a folder_a/b folder_a/b folder_b/
> > cp: cannot create symbolic link 'folder_b/b': No such file or directory
> > cp: warning: source file 'folder_a/b' specified more than once
> >
> > The order in which files are returned while listing them in a
> > directory and necessitating their pre-existence while performing a
> > deep copy is impossible. It's also very normal for symbolic links to
> > exist which may or may not point to a valid target depending on the
> > observing path.
> >
> > Windows does NOT require a link to be valid before creation. This can
> > be demonstrated with mklink:
> >
> > C:\mklink b a
> > symbolic link created for b <<===>> a
>
> Depending on exactly what you have and what you want to do try:
>
>         $ cp -av
>         $ cp -dv
>         $ cp -Pv
> or
>         > robocopy /sl
>
> --
> Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
>
> This email may be disturbing to some readers as it contains
> too much technical detail. Reader discretion is advised.
> [Data in binary units and prefixes, physical quantities in SI.]
> --
> Problem reports:      https://cygwin.com/problems.html
> FAQ:                  https://cygwin.com/faq/
> Documentation:        https://cygwin.com/docs.html
> Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2021-01-04 10:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-03  4:16 Matt D.
2021-01-03  5:00 ` Brian Inglis
2021-01-04 10:36   ` Matt D. [this message]
2021-01-04 12:30     ` Eliot Moss
2021-01-04 15:27       ` Matt D.
2021-01-04 15:46         ` Jeffrey Altman
2021-01-12 17:59           ` Matt D.
2021-01-12 22:18             ` Andrey Repin
2021-01-14  0:09               ` Matt D.
2021-01-04 16:32         ` Eliot Moss
2021-01-04 17:58         ` Achim Gratz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAC+X2=L2tCUSUYreh2oTSt33Zn295Boru6eAPfkckksKXnB4vQ@mail.gmail.com' \
    --to=codespunk@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).