﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4939	CKReleaser limits source and target directories too aggressively	Clayton Coleman	Wiktor Walc	"CKReleaser prevents the source and target directories from being different because io.isChildPath has an incorrect logical test.  The default build (as specified in release.bat) works because target is a child path of source and because the _dev directory is ignored during copy.

Default command (from latest version of release.bat):
  java -jar ckreleaser/ckreleaser.jar ckreleaser.release ../.. release ""3.1 SVN"" ckeditor_3.1_svn --run-before-release=langtool.bat

  release.bat is in the <root>/_dev/releaser directory of the source tree, which means the source dir is <root> and the target directory is <root>/_dev/releaser/release

For 3rd parties using different build systems and different directory structures (for instance, where the build output must live in a directory outside of the source tree) it would be preferable to specify a command like:

  java -jar ckreleaser/ckreleaser.jar customckreleaser.release path/to/ckeditor build/ckeditor <versionid> <filename>

Executing this command throws the exception:

  Target directory must be located outside source directory

which is thrown by this line of releaser.js

468	                        if ( CKRELEASER.io.isChildPath( targetDir.getCanonicalPath(), sourceDir.getCanonicalPath() ) )[[BR]]
469	                                throw ""Target directory must be located outside source directory"";[[BR]]

This is incorrect - the target directory and source directory are not located underneath each other, which examination of isChildPath shows is because the return statement is too aggressive.

403	                isChildPath : function( childPath, parentPath )[[BR]]
404	                {[[BR]]
405	                        if ( childPath.length > parentPath.length )[[BR]]
406	                                return false;[[BR]]
407	[[BR]]
408	                        var i = 0, max = Math.min( childPath.length(), parentPath.length() );[[BR]]
409	[[BR]]
410	                        while ( i < max && childPath.charAt( i ) == parentPath.charAt( i ) )[[BR]]
411	                                i++;[[BR]]
412	[[BR]]
413	                        return i != max;[[BR]]
414	                }[[BR]]

If the working directory is c:\test, the source dir is c:\test\path\to\ckeditor, and the target dir is c:\test\build\ckeditor, then isChildPath should return false (the two are not child paths of each other).  However, ""return i != max"" returns true for this scenario because the two paths match only up until character 7 (i == 7, max == 22).  It should be ""return i==max"".

If isChildPath is adjusted to correctly check path parentage then ckreleaser can be used in different directory structures"	Bug	closed	Normal		Project : CKReleaser	SVN (CKEditor) - OLD	fixed	Confirmed Review+	
