How to repair the symlinks in a copied cygwin64 tree

Mark Geisert mark@maxrnd.com
Wed Aug 7 22:41:35 GMT 2024


Hi David,

On 8/7/2024 1:26 PM, David Karr via Cygwin wrote:
> At my work, I had to have my laptop reimagined for various reasons. I had
> them save my cygwin64 tree to external storage first. I now have the laptop
> back, and I copied the entire tree back in, but now I realize I should have
> done this differently, and I'm wondering how best to repair this. Some of
> you can probably guess, but now all of the files that were symlinks in
> Cygwin are now very small data files. I can tell they used to be symlinks
> because when I cat one, it shows "!<symlink>" in the first characters.
> 
> What is the best strategy for repairing this? The most simple-minded
> approach that I can see is simply renaming the cygwin64 tree to get it out
> of the way, and then just reinstalling Cygwin, and then copying in all the
> files in my cygwin home directory in the saved tree. I will likely guess
> wrong on what packages I had installed before. Is there some way I can
> simply repair the symylink files directly?

If the path to Windows' attrib.exe is in your path (use 'which attrib' 
to check) then you can simply 'attrib +I +S <filename>' the file that 
contains "!<symlink>".

> Besides the symlink problem, is there anything else that I might have
> broken by doing it this way?

That I don't know.

> I'm guessing the correct way to have done this would have been instead
> storing the "tar czpf" output in external storage. I think that would have
> preserved the symlinks and restored them properly with "tar xzf".

That looks good OK me but I've never had to try it, so YMMV.
HTH,

..mark



More information about the Cygwin mailing list