Problem with patch and infinit directories
John McInerney
john at mplvax.UUCP
Mon Jan 7 10:02:17 AEST 1985
In article <792 at enea.UUCP> ber at 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 at berkeley.arpa
> mcvax!enea!ber at 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 at nosc ARPA
More information about the Comp.unix
mailing list