public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Igor Peshansky <pechtcha@cs.nyu.edu>
To: vapid@mindless.com
Cc: cygwin@cygwin.com
Subject: Re: links broken during a backup (not restore), need more info on   how they work to fix & file bug with vendor
Date: Sat, 17 May 2008 10:21:00 -0000	[thread overview]
Message-ID: <Pine.GSO.4.63.0805162247060.7245@access1.cims.nyu.edu> (raw)
In-Reply-To: <20080516225304.E3502104F0@ws1-3.us4.outblaze.com>

On Fri, 16 May 2008, vapid wrote:

> Thank you for the quick response Igor.
>
> > You need to use "attrib +R" on .lnk files and "attrib +S" on the
> > plain-text links.
>
> I swear I tried attrib +R on both types of links earlier, but I must
> have only tried the plain-text ones.  It does fix the .lnk's as you
> said.  I'm using these two [slow] commands to fix up my system.
>
> find / \( -name cygdrive -o -name proc -o -name dev \) -prune -o -name \*.lnk -print -exec bash -c 'attrib +R "`cygpath -d \"{}\"`"' \;
> find / \( -name cygdrive -o -name proc -o -name dev \) -prune -o -type f -exec bash -c 'grep "^\\!<symlink>" "{}" && attrib +S "`cygpath -d \"{}\"`" ' \;
>
> They scan through the cygwin root and any disks you have explicitly
> mounted.  I don't think it would actually hurt stuff on the windows side
> of the disk, but I am trying to stay out of those directories.  I'm
> fairly certain the second one is safe everywhere, but the first one
> may +R some non-cygwin links, if you have mounted windows directories.
> This doesn't seem to affect windows; the shortcut still work in explorer.
> The windows created shortcuts don't seem to work in bash with or without
> the +R, which is fine with me.
>
> Maybe someone can come up with a fancier find.  I had to spawn a bash to
> use the && and delay the evaluation of the `cygpath {}`.  There's a lot of
> quoting to deal with spaces in filenames.

You're spawning way too many processes here (though you do have to run one
attrib per file).  I'd go with something like this:

find / \( -name cygdrive -o -name proc -o -name dev \) -prune -o \
       -name \*.lnk -print | \
  cygpath -w -f - | perl -pe 's,\n,\0,' | \
  xargs -tr0 -n1 attrib +R

find / -mindepth 1 -maxdepth 1 \
       \! -name cygdrive \! -name proc \! -name dev -print0 | \
  xargs -r0 grep -lRF '^!<symlink>' | \
  cygpath -w -f - | perl -pe 's,\n,\0,' | \
  xargs -tr0 -n1 attrib +S

(not tested, but should work barring typos).
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"That which is hateful to you, do not do to your neighbor.  That is the whole
Torah; the rest is commentary.  Go and study it." -- Rabbi Hillel

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

  parent reply	other threads:[~2008-05-17  3:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-16 23:03 vapid
2008-05-17  0:52 ` Brian Dessent
2008-05-17 10:21 ` Igor Peshansky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-05-17  0:35 vapid vapid
2008-05-17  3:12 ` Christopher Faylor
2008-05-16 19:44 vapid vapid
2008-05-16 20:32 ` Igor Peshansky
2008-05-16 22:02   ` Christopher Faylor

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=Pine.GSO.4.63.0805162247060.7245@access1.cims.nyu.edu \
    --to=pechtcha@cs.nyu.edu \
    --cc=cygwin@cygwin.com \
    --cc=vapid@mindless.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).