oneill
(Fresh Scripter)
2007-10-10 09:19 AM
Possible copy bug with 4.60?

Hello All,
I'm trying to copy a file from my domain controller using KIX 4.60 copy command and I've noticed a slight difference between the earlier versions of KIX and the new version of KIX.

If I execute the following code;

@KIX ?
$XLA_Srce = "\\csenergy\netlogon\files\TSJXL9.XLA"
$XLA_Dest = "C:\Documents and Settings\goneill\Application Data\Microsoft\Excel\XLSTART"
$XLA_Srce ?
$XLA_Dest ?
Copy $XLA_Srce $XLA_Dest
'Code (' + @ERROR + ') ' + @SERROR ?

Result:
4.60
\\domain\netlogon\files\TSJXL9.XLA
C:\Documents and Settings\goneill\Application Data\Microsoft\Excel\XLSTART
Code (0) The operation completed successfully.

As you can see from the result it says that the copy was successfully however the file isn't copied. If I run the same code using 4.53 or 4.51 then it works successfully and the file is actually copied.

If I add a backslash "\" to the end of the destination path it works for all versions. e.g.
$XLA_Dest = "C:\Documents and Settings\goneill\Application Data\Microsoft\Excel\XLSTART\"

Is anyone else able to reproduce this behaviour? Is this a bug or is it expected?

thanks.


Sealeopard
(KiX Master)
2007-10-11 04:04 AM
Re: Possible copy bug with 4.60?

Thishas been the expected behavior for a long time. See the COPY command description in the KiXtart Help file.
 Quote:

Remarks: If the source or target specifies a directory, please make sure to add a trailing backslash.


Witto
(MM club member)
2007-10-11 08:44 AM
Re: Possible copy bug with 4.60?

I almost knew this answer would be given. But wouldn't it break many scripts if suddenly the trailing backslash is strict?
At a command prompt, trailing backslashes are never required.


oneill
(Fresh Scripter)
2007-10-11 10:42 AM
Re: Possible copy bug with 4.60?

If the trailing backslash is required, why do I then get a successful message? Shouldn't it produce an error?

DrillSergeant
(MM club member)
2007-10-11 09:52 PM
Re: Possible copy bug with 4.60?

I think it's a bug also...

If I execute this code with 4.60 the file test.txt ends up in the folder:
D:\Data\Development\KiXtart\copyerr

If I execute it with 4.52 the file ends up in the folder:
D:\Data\Development\KiXtart\copyerr\test2

 Code:
@KIX ?
$XLA_Srce = "D:\Data\Development\KiXtart\copyerr\test1\test.txt"
$XLA_Dest = "D:\Data\Development\KiXtart\copyerr\test2"
$XLA_Srce ? 
$XLA_Dest ?
Copy $XLA_Srce $XLA_Dest 
'Code (' + @ERROR + ') ' + @SERROR ?


Even if you forget the backslash, it shouldn't be copied to the folder a level lower...

If anyone else agrees, we can put it in the suggestions forum (or beta forum, but since 4.60 is not beta any more this is probably not right)



Mart
(KiX Supporter)
2007-10-11 10:18 PM
Re: Possible copy bug with 4.60?

I wonder if this is a side effect (unwanted or not) of the fix for copying a single file to non-existing folder. This fix is first introduced in 4.60 afaik.

 Quote:

....
Enhanced commands, functions, macros
....
COPY - Enhanced to enable copying a single file to a non-existing directory.
....


Witto
(MM club member)
2007-10-11 10:32 PM
Re: Possible copy bug with 4.60?

On page 3 of the kix2010.doc of v4.60, I read
 Quote:

Enhanced commands, functions, macros
...
COPY Enhanced to enable copying a single file to a non-existing directory.

On page 30, I read
 Quote:

COPY
Action
Copies one or more files or directories.

Syntax
COPY "source" "destination" [/h] [/s]

If the source or destination specifies a directory, please make sure to add a trailing backslash.

but as far as I remember, copy always worked without trailing backslashes. I have the impression that due to the enhancement, this hidden feature has been lost...
Trailing backslashes are also not needed at a command prompt.
I don't know if it can be called a bug, but it is a pity that at once, using or forgetting the trailing backslash maybe breaks some scripts
[Edit]
I see that Mart had the same thought about the cause. Why am I always so late hitting that submit button...
[/Edit]


Mart
(KiX Supporter)
2007-10-11 10:43 PM
Re: Possible copy bug with 4.60?

One could want/need to copy a file to a file with no extension like test.txt to test.

Imho copying a file to a folder but not using the last \ should be interpreted as copying a file to a file. If you want to copy to a folder you should always use a trailing \. So imho the current (4.60) behaviour is not correct.


DrillSergeant
(MM club member)
2007-10-11 10:44 PM
Re: Possible copy bug with 4.60?

I can agree with you guys, if the statement:

Copy C:\folder\file.txt C:\folder2

would result in a file called 'folder2' in folder C:\ but that's not what happens. What happens is that it is copied to C:\file.txt and that's unexpected behaviour to say the least.

I also agree with oneill that this is not good for backwards compatibility...



Sealeopard
(KiX Master)
2007-10-12 04:20 AM
Re: Possible copy bug with 4.60?

The trailing backslash is mentioned in v4.21 on forward for directories. So, it's definitely been there for a while. On the same note a COPY C:\FOLDER\TEXT.TXT D:\FOLDER should thus result in a file called FOLDER in the root of D:\.

MIDAC
(Just in Town)
2008-05-16 12:42 AM
Re: Possible copy bug with 4.60?

Guys, this is crazy!!! I've spent hours on trying to figure out why my script was copying to the wrong folder. Finally went back to an older version of KIX as that was the only thing that had changed, and lo and behold, it worked fine. So I found this thread... really, these are pretty fundamental changes you are making causing your loyal followers like myself to tear our hair out. And I agree with some poster above, the way it is now is not very intuitive and as to why it dumps stuff in one folder up instead of renaming it to the new name, is also not right.

I also found that the MOVE command seems to have given the same treatment.. I had to add a trailing "/" there too to make it work like before.

Angry Mike


Richard H.Administrator
(KiX Supporter)
2008-05-16 09:25 AM
Re: Possible copy bug with 4.60?

Chill Mike, don't be Angry. KiXtart is too cute to be angry with.

No-one on this board is a KiXtart developer. We are a self-help community of KiXtart end users just like you.

The developer pops in occasionally to check out reported bugs and feature requests so by all means add a "me too" with some anecdotal evidence or change proposals if you think that the thread warrants reviving.

I suggest you leave your hair alone though, you'll be grateful for whatever you have left in later life.


Björn
(Korg Regular)
2008-05-19 04:09 PM
Re: Possible copy bug with 4.60?

And, until bugs/features has been resolved, checking for more than just the exit code from something isn't enough - check for existence of whatever you did or undid.

1 - do it
2 - check it
3 - log it
4 - fix it ;\)


Ruud van Velsen
(Hey THIS is FUN)
2008-06-03 05:20 PM
Re: Possible copy bug with 4.60?

Arr... sorry about this. Believe it or not, but COPY/MOVE are actually some of the hardest things to get right.

It looks as if I indeed broke something while fixing the 'single file' thing in 4.60.

I'll investigate and let you guys know what's up.

Ruud


Ruud van Velsen
(Hey THIS is FUN)
2008-06-05 08:55 AM
Re: Possible copy bug with 4.60?

Short update: as mentioned earlier in this thread, it's always best to specify a trailing backslash when copying to a directory.

However... KiXtart does try very hard to understand the multitude of COPY/MOVE exceptions, and this particular case should have worked.

It does now, anyway, in the update I'm working on.

More on this soon.

Thanks for the report!

Ruud


CrimInalA
(Fresh Scripter)
2009-01-07 09:39 AM
Re: Possible copy bug with 4.60?

Any idea as when this issue will be resolved ?

What is the option for now ? use a trailing backspace if you want to copy to a directory ?


Les
(KiX Master)
2009-01-07 06:28 PM
Re: Possible copy bug with 4.60?

4.61 beta 1 purports to have addressed this.
 Quote:
This update contains the following fixes & enhancements:

· Fixed issue with handling of EXIT codes
· Fixed issue with COPYing files to a directory (without specifying a backslash)
· Fixed issue with writing large DWORD values to the registry
· Updated @PRODUCTTYPE to correctly report Server 2008
· Added REPLACE function