delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/01/03/00:01:16

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C33EA3857004
Authentication-Results: sourceware.org; dmarc=none (p=none dis=none)
header.from=SystematicSw.ab.ca
Authentication-Results: sourceware.org;
spf=none smtp.mailfrom=brian DOT inglis AT systematicsw DOT ab DOT ca
X-Authority-Analysis: v=2.4 cv=Q4RsX66a c=1 sm=1 tr=0 ts=5ff14f67
a=kiZT5GMN3KAWqtYcXc+/4Q==:117 a=kiZT5GMN3KAWqtYcXc+/4Q==:17
a=IkcTkHD0fZMA:10 a=uYT-Tk0qkVT609LjNaIA:9 a=QEXdDO2ut3YA:10
Subject: Re: Native symbolic link behavior is broken and makes backups using
Cygwin command line tools impossible
To: cygwin AT cygwin DOT com
References: <CAC+X2=J-mKZH7WAdt2RQocqP+4rUqSkGi-acDC7U3N=uu7QGDA AT mail DOT gmail DOT com>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Organization: Systematic Software
Message-ID: <1d853aa0-4cbe-b92c-8d9f-53fc72371a7b@SystematicSw.ab.ca>
Date: Sat, 2 Jan 2021 22:00:21 -0700
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.6.0
MIME-Version: 1.0
In-Reply-To: <CAC+X2=J-mKZH7WAdt2RQocqP+4rUqSkGi-acDC7U3N=uu7QGDA@mail.gmail.com>
X-CMAE-Envelope: MS4xfDEmLrvA1eoqJOSGwyVoDCEhAAyJy/KmXRcmcXk/vLaGDp1QEbLsVCm0N9wFWdUYrMGKNgEXq/YFCze6Y5yqYClpTD4YnjhwD2nF208/NIRmf4U6SVFo
19eRUJcbojV1BQ76KCdfTsWBDV9BsoJ3YcSrkoxDsR9+bvC85s70Wo+gQAswvYd40r2vNkn3gMwgCoaDsKN8TB1ZFvbiC/y5WPc=
X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,
RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE,
TXREP autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Reply-To: cygwin AT cygwin DOT com
Errors-To: cygwin-bounces AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019