bug-cvs
[Top][All Lists]
Advanced

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

cvs-1.11.1p1 (client): cvs export fails with rcstemplate


From: luik
Subject: cvs-1.11.1p1 (client): cvs export fails with rcstemplate
Date: Tue, 6 Nov 2001 14:37:12 +0100 (MET)

Program:        cvs
Version:        1.11.1p1

Host:           all
Area:           client

Synopsis:       cvs export fails with rcstemplate

Description:
    "cvs export" fails with the following error message:

benz:/tmp(3)> cvs export -rHEAD TeX
cvs [export aborted]: cannot write <CVS/Template file>: No such file or 
directory

    This happens under the following conditions:

    1. remote access to the repository is used, i.e. cvs client/server.
    2. a special template is defined for this module in the
       CVSROOT/rcsinfo file.

Reproduce with:
    see above

Fix:
    The problem is in src/client.c, which does not check for the
    "export" command in `template' or `handle_template'.  (Compare with
    `handle_clear_sticky' for example.)

    Perhaps, `template' should also check for `is_cvsroot_level', but
    I'm not sure about this.

    I've fixed the problem with the attached patch, but it's probably
    not the cleanest way to do it.

-- 
Andreas Luik         E-Mail: luik@gmx.net
                     PGP:    E2 6A 41 70 67 1E 0B 68  94 0D 9E 83 95 16 AF 59

*** cvs-1.11.1p1/src/client.c.ORIG      Tue Apr 24 20:14:53 2001
--- cvs-1.11.1p1/src/client.c   Tue Nov  6 14:25:38 2001
***************
*** 1392,1398 ****
      size_t nread;
      size_t nwrite;
  
!     FILE *fp;
  
      read_line (&size_string);
      if (size_string[0] == 'z')
--- 1392,1398 ----
      size_t nread;
      size_t nwrite;
  
!     FILE *fp = NULL;
  
      read_line (&size_string);
      if (size_string[0] == 'z')
***************
*** 1413,1421 ****
         is binary or not.  I haven't carefully looked into whether
         CVS/Template files should use local text file conventions or
         not.  */
!     fp = CVS_FOPEN (filename, "wb");
!     if (fp == NULL)
!       error (1, errno, "cannot write %s", fullname);
      nread = size;
      nwrite = 0;
      pread = buf;
--- 1413,1423 ----
         is binary or not.  I haven't carefully looked into whether
         CVS/Template files should use local text file conventions or
         not.  */
!     if (filename) {
!       fp = CVS_FOPEN (filename, "wb");
!       if (fp == NULL)
!           error (1, errno, "cannot write %s", fullname);
!     }
      nread = size;
      nwrite = 0;
      pread = buf;
***************
*** 1434,1448 ****
  
        if (nwrite > 0)
        {
!           n = fwrite (pwrite, 1, nwrite, fp);
!           if (ferror (fp))
!               error (1, errno, "cannot write %s", fullname);
            nwrite -= n;
            pwrite += n;
        }
      }
      free (buf);
!     if (fclose (fp) < 0)
        error (1, errno, "cannot close %s", fullname);
  }
  
--- 1436,1455 ----
  
        if (nwrite > 0)
        {
!           if (fp) {
!               n = fwrite (pwrite, 1, nwrite, fp);
!               if (ferror (fp))
!                   error (1, errno, "cannot write %s", fullname);
!           }
!           else {
!               n = nwrite;
!           }
            nwrite -= n;
            pwrite += n;
        }
      }
      free (buf);
!     if (fp && fclose (fp) < 0)
        error (1, errno, "cannot close %s", fullname);
  }
  
***************
*** 2471,2476 ****
--- 2478,2489 ----
      char *short_pathname;
      char *filename;
  {
+     if (strcmp (command_name, "export") == 0)
+     {
+       read_counted_file (NULL, NULL);
+       return;
+     }
+ 
      /* FIXME: should be computing second argument from CVSADM_TEMPLATE
         and short_pathname.  */
      read_counted_file (CVSADM_TEMPLATE, "<CVS/Template file>");





reply via email to

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