X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Fri, 16 May 2008 23:12:01 -0400 (EDT) From: Igor Peshansky Reply-To: cygwin AT cygwin DOT com To: vapid AT mindless DOT com cc: cygwin AT cygwin DOT com Subject: Re: links broken during a backup (not restore), need more info on how they work to fix & file bug with vendor In-Reply-To: <20080516225304.E3502104F0@ws1-3.us4.outblaze.com> Message-ID: References: <20080516225304 DOT E3502104F0 AT ws1-3 DOT us4 DOT outblaze DOT com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT 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 "^\\!" "{}" && 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 '^!' | \ 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 AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT 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/