[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Directory creation/copy problem in Windows client
From: |
David Reiter |
Subject: |
RE: Directory creation/copy problem in Windows client |
Date: |
Thu, 25 Apr 2002 08:50:49 -0700 (PDT) |
Martin,
I didn't update on every loop iteration because I wasn't sure what
would happen if you start to mix the slashes. Would you ever have a
case where you would want to mix them? What would the behaviour then
be? If you have /var/cfengine/rpms\subdir where should this go?
I didn't know what would happen so that is why I just took the
first one.
I also noticed when it was copying files from a directory
the directory was all forward slash / but when it appended on the
last slash and put the file on it added the windows backslash.
For example for my directory /var/cfengine/rpms I would see the
following come across:
/var/cfengine/rpms\mypackage.rpm
Since the last \ wouldn't matter when creating the directory
(it just seperates the file) then it might be ok to use what
is in the source, but I would like to know if there would be
any case where we would want them mixed. If I get some
time I'll try to experiement and see.
David.
On Wed, 24 Apr 2002, Andrews, Martin wrote:
> David,
>
> I am the source of the incomplete support for windows file paths. The
> directories were changed to '\' because I thought that made sense as the
> default separator but that does not help. cfengine used to always use '/',
> but I think you are right - cfengine needs to preserve the original
> separator. Your fix seems okay - though why stick with the first file
> separator - you can forget the initial conditional and update
> Path_File_Separator at every node iteration. Does that seem right?
>
> Martin
>
> -----Original Message-----
> From: David Reiter [mailto:address@hidden
> Sent: Monday, April 22, 2002 8:05 PM
> To: address@hidden
> Subject: Directory creation/copy problem in Windows client
>
>
> Hi,
> I am running into a problem when having cfengine copy over files
> in a directory from a linux box. My setup is the following:
>
> I have a /var/cfengine/rpms directory on the linux box. I want
> any files that get put in that directory to be copied to the
> windows box. I added the following lines:
>
> directories:
> /var/cfengine/rpms
>
> Then had lines in the copy: section to copy any changed files in
> /var/cfengine/rpms over.
>
> What would happen when I tried was I would get log messages
> saying creating directory /var/cfeninge/rpms then error
> messages saying it didn't exist. When I looked in the
> filesystem (under cygwin) /var/cfengines/rpms was never created.
> So the rpms in the directory never got copied over. After doing
> some debugging I found out that it was actually creating
> c:\var\cfeninge\rpms, but then trying to copy the rpm files
> to the cygwin /var/cfengine/rpms directory.
>
> I traced the source of this problem to line 486
> *spc = FILE_SEPARATOR;
> For Windows FILE_SEPARATOR points to '\\' so as it was
> checking the directories in MakeDirectoriesFor it was
> using '\\' which then went out to the C: drive. I changed
> the logic to save the first separator as it was parsing the
> directory and use it as it created the dirs, which seems
> to have fixed the problem.
>
> insert at line 454:
> if (Path_File_Separator == '\0') Path_File_Separator = *sp;
> then change 486 to:
> *spc = Path_File_Separator;
> and declare the variable
> char Path_File_Separator='\0'; at the top of MakeDirectoriesFor()
>
> Does this fix sound reasonable? Am I going to have problems with
> other windows paths? Was there are specific reason the directories
> were being changed to \ ? Thanks for any information,
>
> David.
>
>
>
> _______________________________________________
> Bug-cfengine mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-cfengine
>