bug-cvs
[Top][All Lists]
Advanced

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

patch: trailing slash messes up export


From: miles zarathustra
Subject: patch: trailing slash messes up export
Date: Tue, 10 Jun 2003 23:03:32 -0700

The following patch fixes a bug in cvs export which appears if the final
character of $CVSROOT is a '/'. The behaviour is that the export, e.g.

  cvs export -Dnow proj

gives an error:

  [export aborted]: cannot export into working directory

I applied it to the 1.11.6 version of the CVS source and it seems to work,
but I have not tested rigorously.  I hope the cvs project will adopt this
patch, as the solution (removing the trailing / from CVSROOT) is not by any
means obvious, and it seems ridiculous to require it. If you are setting the
CVSROOT by hand, and use the <TAB> key in bash to get name completion, it
automatically appends the trailing /, so this fix should help avoid a
confusing and common problem.

The patch is below the signature below.

Thanks,

  -= miles zarathustra =-  http://www.aranyaka.org

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
na' sato vidyate bhavo; na' bhavo vidyate satah
"of the non-existent there is no coming to be;
of the existent, there is no ceasing to be."
  [ bhagavad-gita 2.18]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

*** src/main.c.old Thu May  1 18:12:55 2003
--- src/main.c Tue Jun 10 22:46:52 2003
***************
*** 267,272 ****
--- 267,283 ----
      NULL
  };

+ /*  trailing slash messes up export. [miles]
+  */
+ void rm_trailing_slash(char *str) {
+   int last;
+
+   if (! str ) return;
+   last = strlen(str) - 1;
+   if (last <= 0) return;
+   if (str[last] == '/' || str[last] == '\\')
+     str[last] = '\0';
+ }

  static int
  set_root_directory (p, ignored)
***************
*** 838,843 ****
--- 850,860 ----
           "or set the %s environment variable.", CVSROOT_ENV);
       }

+      /* [miles] remove trailing slash from CVSroot,
+         as it messes up export (at least)
+       */
+      rm_trailing_slash(CVSroot);
+
       if (! *CVSroot)
       {
    error (0, 0,






reply via email to

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