Index: src/checkout.cpp =================================================================== RCS file: /cvs/cvsnt/src/checkout.c,v retrieving revision 1.26.2.69.6.11 diff -c -r1.26.2.69.6.11 checkout.cpp *** src/checkout.cpp 14 May 2008 09:01:54 -0000 1.26.2.69.6.11 --- src/checkout.cpp 15 May 2008 02:49:54 -0000 *************** *** 125,130 **** --- 125,131 ---- int local = 0; int shorten = -1; char *where = NULL; + char *whereami = NULL; char *valid_options; const char *const *valid_usage; *************** *** 409,414 **** --- 410,485 ---- { for(int i=0; i=&myupdir[0]; --p) + if(ISDIRSEP(*p)) *p='\0'; + else break; + } + + #ifdef _WIN32 + mydirsep=strrchr(myupdir,'\\'); + myothersep=strrchr(myupdir,'/'); + if (myothersep>mydirsep) + mydirsep=myothersep; + #else + mydirsep=strrchr(myupdir,'/'); + #endif + if (mydirsep) + { + *mydirsep='\0'; + mydirsep++; + + if(mycwd && (strcmp(mycwd,"/") + #ifdef _WIN32 + && strcmp(mycwd,"\\") && !(strlen(mycwd)<=3 && *mycwd && mycwd[1]==':') + #endif + )) + { + + #ifdef _WIN32 + if ((myupdir[1]==':')&&(strlen(myupdir)==2)) + { + /* trying to chdir to d: when it should be d:\ */ + strcpy(myupdir2,myupdir); + strcat(myupdir2,"\\"); + whereami = xstrdup(myupdir2); + } + else + #endif + whereami = xstrdup(myupdir2); + } + send_to_server("tell-me-curdir ",0); + send_to_server (whereami, 0); + send_to_server ("\n", 1); + } + } + } } if (!run_module_prog) Index: src/modules.cpp =================================================================== RCS file: /cvs/cvsnt/src/modules.c,v retrieving revision 1.15.2.39.8.3 diff -c -r1.15.2.39.8.3 modules.cpp *** src/modules.cpp 12 Feb 2008 02:54:22 -0000 1.15.2.39.8.3 --- src/modules.cpp 15 May 2008 03:12:11 -0000 *************** *** 23,28 **** --- 23,30 ---- #include "cvs.h" #include "savecwd.h" + + /* Defines related to the syntax of the modules file. */ *************** *** 59,64 **** --- 61,67 ---- static int premodule_proc(void *param, const trigger_interface *cb); static int postmodule_proc(void *param, const trigger_interface *cb); + char *get_tell_me_curdir(void); static const char *module_name; /* *************** *** 415,420 **** --- 418,424 ---- */ found: + TRACE(3,"do module() found:"); /* remember where we start */ if (save_cwd (&cwd)) error_exit (); *************** *** 433,438 **** --- 437,443 ---- *cp = '\0'; } + TRACE(3,"do module() found spec_opt=\"%s\"",PATCH_NULL(spec_opt)); /* don't do special options only part of a module was specified */ if (mfile != NULL) spec_opt = NULL; *************** *** 457,462 **** --- 462,473 ---- modargc = xmodargc; modargv = xmodargv; + int moduledotok=0; + #ifdef SERVER_SUPPORT + char setbuffer2[MAX_PATH]="\0"; + if(!CGlobalSettings::GetGlobalValue("cvsnt","PServer","ModuleDotOK",setbuffer2,sizeof(setbuffer2))) + moduledotok = atoi(setbuffer2); + #endif /* parse the args */ optind = 0; while ((c = getopt (modargc, modargv, CVSMODULE_OPTS)) != -1) *************** *** 470,478 **** --- 481,514 ---- /* -d ../foo or -d /foo -r -d foo/../.. are illegal in the modules file */ if(isabsolute(optarg) || pathname_levels(optarg)>0) error(1,0,"Illegal module directory `%s'",optarg); + if((!strcmp(optarg,".")) || (!strcmp(optarg,"./"))) + { + if (moduledotok==0) + { + error(1,0,"Illegal module directory `%s' (set ModuleDotOK=1 to override)",optarg); + goto do_module_return; + error_exit (); // just to be sure + } + #ifdef SERVER_SUPPORT + char *tell_me_curdir=get_tell_me_curdir(); + if (tell_me_curdir!=NULL) + if (modargv) + error(0,0,"warning: module directory `%s' - client should use `cd ..; cvs co -d \"%s\" \"%s\"'.",optarg,tell_me_curdir,modargv[0]); + else + error(0,0,"warning: module directory `%s' - client should use `cd ..; cvs co -d \"%s\"'.",optarg,tell_me_curdir); + else + error(0,0,"warning: module directory `%s' is old and may cause errors.",optarg); + if (mwhere) + xfree (mwhere); + mwhere = xstrdup ("./"); + #endif + } + else + { if (mwhere) xfree (mwhere); mwhere = xstrdup (optarg); + } nonalias_opt = 1; break; case 'i': Index: src/server.cpp =================================================================== RCS file: /cvs/cvsnt/src/server.c,v retrieving revision 1.106.2.210.6.25 diff -c -r1.106.2.210.6.25 server.cpp *** src/server.cpp 14 May 2008 23:27:06 -0000 1.106.2.210.6.25 --- src/server.cpp 15 May 2008 03:23:09 -0000 *************** *** 1592,1597 **** --- 1592,1599 ---- writeonce=0; // not enough memory to do it this way else pcuronce=ponce; + if (writeonce) + TRACE(99,"receive_partial_file ()writeonce is set so allocated %lu bytes of memory.",(unsigned long)(sizeof (char) * (size+4))); } while (size > 0) { *************** *** 1614,1619 **** --- 1616,1623 ---- #endif #endif } + if (nreadcount<2) + TRACE(99,"receive_partial_file () about to read #%d",nreadcount); status = buf_read_data (buf_from_net, size, &data, &nread); if ((!no_reverse_dns)&&(slowdns)) { *************** *** 2758,2763 **** --- 2762,2788 ---- static int argument_count; static char **argument_vector; static int argument_vector_size; + static char *tell_me_curdir=NULL; + + static void serve_tell_me_curdir (char *arg) + { + + tell_me_curdir = (char*)xmalloc (strlen (arg) + 1); + if (tell_me_curdir == NULL) + { + error(1,ENOMEM,"Alloc failed"); + return; + } + strcpy (tell_me_curdir, arg); + } + + char *get_tell_me_curdir(void) + { + if (tell_me_curdir==NULL) + return NULL; + return xstrdup(tell_me_curdir); + } + static void serve_argument (char *arg) { *************** *** 4660,4665 **** --- 4685,4691 ---- REQ_LINE("Rename", serve_rename, 0), REQ_LINE("VirtualRepository", serve_virtual_repository, 0), REQ_LINE("expand-modules", serve_expand_modules, 0), + REQ_LINE("tell-me-curdir", serve_tell_me_curdir, 0), REQ_LINE("ci", serve_ci, RQ_ESSENTIAL), REQ_LINE("co", serve_co, RQ_ESSENTIAL), REQ_LINE("chown", serve_chown, 0),