Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site mplvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!ittvax!dcdwest!sdcsvax!sdcc3!mplvax!john From: john@mplvax.UUCP (John McInerney) Newsgroups: net.sources.bugs,net.unix Subject: Re: Problem with patch and infinit directories Message-ID: <167@mplvax.UUCP> Date: Sun, 6-Jan-85 19:02:17 EST Article-I.D.: mplvax.167 Posted: Sun Jan 6 19:02:17 1985 Date-Received: Tue, 8-Jan-85 02:57:40 EST References: <792@enea.UUCP> Reply-To: john@mplvax.UUCP (John McInerney) Organization: Marine Physical Laborator of SIO at UCSD Lines: 46 Xref: watmath net.sources.bugs:153 net.unix:3242 Summary: In article <792@enea.UUCP> ber@enea.UUCP (Bjorn Eriksen) writes: >I just used 'patch' on a diff but didn't notice that the diff referred >to subdirectories that I didn't have. Patch creates a subdirectory .orig >and somehow it started to create them recursivly, .orig/.orig/.orig/..., >until I guess a "filname too long" error. The problem is now how do I >get rid of .orig without redo the filesystem? A "rm -rf .orig" fails. >This is 4.2BSD. > >-- > Bjorn Eriksen > ENEA DATA Sweden > > UUCP: {decvax,philabs}!mcvax!enea!ber > ARPA: decvax!mcvax!enea!ber@berkeley.arpa > mcvax!enea!ber@seismo.arpa What I did to get rid of these .orig files was to move the parent directory of the offending .orig calling it "blackhole" and then used tar to move the hierarchy to its correct place (not including the .orig file of course) with commands something like: mkdir gooddir cd blackhole tar cpf - [a-z]* | (cd ../gooddir; tar xpf - ) Then I used the following C program to get rid of the .orig directory. ----------------------------------------------------------------------------- main(){ if (unlink("blackhole/.orig")){ perror("rmblck:"); } } ----------------------------------------------------------------------------- I think that you could directly use the unlink(2) call to remove just the .orig directory, but I was paranoid that I would remove the good stuff too. Also, I believe that there are two occurances of the .orig link to parent in the 4.2 distribution. A find started from root should find them for you; be sure to redirect the error output. John McInerney sdcsvax!mplvax!john UUCP john@nosc ARPA