bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: autopoint --force can corrupt CVS/Entries files


From: Bruno Haible
Subject: Re: autopoint --force can corrupt CVS/Entries files
Date: Sun, 20 Apr 2008 08:18:05 +0200
User-agent: KMail/1.5.4

Jim Meyering wrote:
> This was first reported by Rich Jones here:
> 
>   http://bugzilla.redhat.com/441481
> 
> In the presence of non-functional xargs, autopoint
> corrupts existing CVS/Entries files.
> 
> Here's a small stand-alone reproducer:
> 
> #!/bin/sh
> rm -rf j m
> mkdir j && d=$PWD/j;
> (cd j && printf '#!/bin/sh\nexit 1\n' > xargs; chmod a+x xargs; cvs -d $d 
> init )
> mkdir m && (cd m && touch a && cvs -d $d import -m x m M M0 )
> rm -rf m; cvs -d $d co m && cd m
> echo 'AM_GNU_GETTEXT_VERSION([0.15])' > configure.ac
> PATH=$d:$PATH autopoint --force
> cvs -n up
> 
> After running that, cvs -n up prints this:
> 
>     cvs update: in directory .:
>     cvs update: ignoring CVS/Root because it specifies a non-existent 
> repository /e/m/tmpcvs20759
>     cvs update: No CVSROOT specified!  Please use the `-d' option
>     cvs [update aborted]: or set the CVSROOT environment variable.

Normally a shell script should be able to rely on the basic utilities, like
'test', 'cp', 'find', 'xargs'.

Also, nothing is really broken in your situation, since autopoint backs up
all overwritten files.

But to some users who don't look for the backup files, it may appear like
'autopoint' screwed their environment; for this reason I'm applying this
patch. (Your proposed patch handled a broken 'xargs' program, but did not
handle a broken 'rm' program. But as you know, for some versions of rm, used
over NFS, "rm -rf" sometimes does not remove all files.)

Thanks for the reproducible test case.

Bruno


2008-04-20  Bruno Haible  <address@hidden>

        * autopoint.in: Check that really all CVS directories are removed.
        Reported by Jim Meyering <address@hidden>.

*** autopoint.in        18 Jan 2008 23:30:16 -0000      1.37
--- autopoint.in        20 Apr 2008 06:06:07 -0000
***************
*** 426,431 ****
--- 426,438 ----
  cvsver=gettext-`echo "$ver" | sed -e 's/\./_/g'`
  (cvs checkout -r"$cvsver" archive > /dev/null) 2>&1 | grep -v '^cvs checkout: 
Updating'
  find archive -name CVS -type d -print | xargs rm -rf
+ # Check that really all CVS directories are gone, otherwise we would overwrite
+ # the contents of the user's CVS directories.
+ if test `find archive -name CVS -type d -print | wc -l` != 0; then
+   cd ..
+   rm -rf "$cvs_dir" "$work_dir"
+   func_fatal_error "failed to remove all CVS subdirectories"
+ fi
  if test `find archive -type f -print | wc -l` = 0; then
    cd ..
    rm -rf "$cvs_dir" "$work_dir"





reply via email to

[Prev in Thread] Current Thread [Next in Thread]