[ https://jira.codehaus.org/browse/WAGON-363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=326840#comment-326840 ]
Stefan Braune commented on WAGON-363: ------------------------------------- This problem still persists with wagon-ftp:2.4 (and below). I fixed that issue by myself in class org.apache.maven.wagon.providers.ftp.FtpWagon. The issue was, that while making directories recursively, the code tests whether a directory already exists by entering it and seeing whether that worked or not. After that (and maybe after creating the directory) it will enter it again. If the directory already existed (as it is the case for ".."), it enters it a second time. That's the whole bug. The original version reads like this: // we only create the nextDir if it doesn't yet exist if (!ftp.changeWorkingDirectory(nextDir)) { ok &= ftp.makeDirectory(nextDir); } if (ok) { // set the permissions for the freshly created directory setPermissions(permissions); ftp.changeWorkingDirectory(nextDir); // now create the deeper directories final String remainingDirs = fileName.substring(slashPos + 1); ok &= makeFtpDirectoryRecursive(remainingDirs, permissions); } The fixed version looks like this (notice the changedDir boolean variable, which fixes the whole thing): boolean changedDir = false; // we only create the nextDir if it doesn't yet exist if (!ftp.changeWorkingDirectory(nextDir)) { ok &= ftp.makeDirectory(nextDir); } else { changedDir = true; } if (ok) { // set the permissions for the freshly created directory setPermissions(permissions); if (!changedDir) { ftp.changeWorkingDirectory(nextDir); } // now create the deeper directories final String remainingDirs = fileName.substring(slashPos + 1); ok &= makeFtpDirectoryRecursive(remainingDirs, permissions); } I hope, that this patch will be integrated soon. :) > wagon-ftp fails to create non-existing directory when path contains "/../" > -------------------------------------------------------------------------- > > Key: WAGON-363 > URL: https://jira.codehaus.org/browse/WAGON-363 > Project: Maven Wagon > Issue Type: Bug > Components: wagon-ftp > Affects Versions: 2.1 > Environment: Maven 3.0.3 > Java 6u29 > Windows 7x64 > Reporter: Falko Modler > > Creating non-existent parent folders as described in WAGON-265 does not work > for the following scenario (real ftp-server replaced with "someurl.com"): > I want to upload the site for a module named "exec-listeners-extension". > This module inherits from mms-modules-parent (direct parent) which inherits > from mms-parent ("transitive" parent). > All modules/parents have site-urls, whereas the url of > exec-listeners-extension is defined as: > {code}<url>${distributionManagement.site.urlBase}/maven/${project.artifactId}</url>{code} > ${distributionManagement.site.urlBase} is defined in mms-parent ("transitive" > parent of exec-listeners-extension): > {code}<distributionManagement.site.urlBase>ftp://reuse-sites.mms-at-work.de/mms/www/reuse-sites</distributionManagement.site.urlBase>{code} > So the final site location sould be: > ftp://someurl.com/mms/www/reuse-sites/maven/exec-listeners-extension > This folder/path does already exist and is writable: > ftp://someurl.com/mms/www/reuse-sites > The folder mms-parent within reuse-sites also does already exist. > The "maven" folder (and it's subfolder "exec-listeners-extension") do not > exist and thus need to be created. > But this is what happens when calling mvn site-deploy: > {code} > Command sent: SYST > Reply received: 215 UNIX Type: L8 Version: SUNOS > Remote system is UNIX Type: L8 Version: SUNOS > Command sent: TYPE I > Reply received: 200 Type set to I. > ftp://someurl.com/mms/www/reuse-sites/mms-parent/ - Session: Opened > [INFO] Pushing > c:\Develop\_dev\mms-modules\maven\exec-listeners-extension\trunk\target\site > [INFO] >>> to > ftp://someurl.com/mms/www/reuse-sites/mms-parent/../maven/exec-listeners-extension > Command sent: CWD /mms/www/reuse-sites/mms-parent/ > Reply received: 250 CWD command successful. > Recursively uploading directory > c:\Develop\_dev\mms-modules\maven\exec-listeners-extension\trunk\target\site > as ../maven/exec-listeners-extension > processing = > c:\Develop\_dev\mms-modules\maven\exec-listeners-extension\trunk\target\site > as ../maven/exec-listeners-extension > Command sent: CWD ../maven/exec-listeners-extension > Reply received: 550 ../maven/exec-listeners-extension: No such file or > directory. > Command sent: PWD > Reply received: 257 "/mms/www/reuse-sites/mms-parent" is current directory. > Command sent: CWD .. > Reply received: 250 CWD command successful. > Command sent: CWD .. > Reply received: 250 CWD command successful. > Command sent: PWD > Reply received: 257 "/mms/www" is current directory. > Command sent: CWD maven > Reply received: 550 maven: No such file or directory. > Command sent: MKD maven > Reply received: 550 maven: Permission denied. > Command sent: CWD /mms/www > Reply received: 250 CWD command successful. > Command sent: CWD /mms/www/reuse-sites/mms-parent > Reply received: 250 CWD command successful. > ftp://someurl.com/mms/www/reuse-sites/mms-parent/ - Session: Disconnecting > ftp://someurl.com/mms/www/reuse-sites/mms-parent/ - Session: Disconnected > [INFO] > ------------------------------------------------------------------------ > [INFO] BUILD FAILURE > [INFO] > ------------------------------------------------------------------------ > [INFO] Total time: 47.461s > [INFO] Finished at: Fri Dec 09 20:56:09 CET 2011 > [INFO] Final Memory: 33M/961M > [INFO] > ------------------------------------------------------------------------ > [ERROR] Failed to execute goal > org.apache.maven.plugins:maven-site-plugin:3.0:deploy (default-deploy) on > project exec-listeners-extension: Error uploading site: Unable to create > directory ../maven/exec-listeners-extension when processing > c:\Develop\_dev\mms-modules\maven\exec-listeners-extension\trunk\target\site > -> [Help 1] > {code} > Wagon-ftp executes "CWD .." twice which leads to a "Permission denied" later > on when trying to create the "maven" folder in "www" (not writable!) instead > of "reuse-sites". > I guess this is because WAGON-265 added an automatic "CWD .." (?) and the > path being uses by wagon-ftp already contains "/../": > {code}[INFO] >>> to > ftp://someurl.com/mms/www/reuse-sites/mms-parent/../maven/exec-listeners-extension{code} > I don't know why the path already contains a "/../". I guess this is because > of the parent relationship?! -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira