[ 
https://issues.jenkins-ci.org/browse/JENKINS-13028?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ari Hyttinen updated JENKINS-13028:
-----------------------------------

    Description: 
When user supplies a network share file path (for example 
\\path\to\share\file.xxx)
to a field, which uses FilePath.child() method to get FilePath object for the 
file, it does not work, because FilePath.isAbsolute() method returns false for 
the path, and then current workspace is prepended to it.

If using drive letter, for example X:\mapped\path\file.xxx, then isAbsolute 
detects it correctly, and FilePath.child() returns valid FilePath object.

In plugin code, a kludgy workaround I've been using is:
if pathString starts with "\\\\", 
then get new FilePath(pathString), 
else get FilePath.child(pathString).

User workarounds are to copy the file from share to workspace with separate 
build step, or to map the share to a drive letter if possible.

Note: hudson/FilePath.java already has regexp for detecting these paths as 
absolute, but for some reason isAbsolute() uses different regexp, which only 
detects driver letter and /-paths.


  was:
When user supplies a network share file path (for example 
\\path\to\share\file.xxx)
to a field, which uses FilePath.child() method to get FilePath object for the 
file, it does not work, because FilePath.isAbsolute() method returns false for 
the path, and then current workspace is prepended to it.

If using drive letter, for example X:\mapped\path\file.xxx, then isAbsolute 
detects it correctly, and FilePath.child() returns valid FilePath object.

Kludgy workaround (in plugin code) I've been using is:
if pathString starts with \\, 
then get new FilePath(pathString), 
else get FilePath.child(pathString).

User workarounds are to copy the file from share to workspace with separate 
build step, or to map the share to a drive letter if possible.

Note: hudson/FilePath.java already has regexp for detecting \\-paths, but for 
some reason isAbsolute() uses different regexp, which only detects driver 
letter and /-paths.


    
> hudson.FilePath.isAbsolute() method thinks Windows paths starting with \\ are 
> not absolute
> ------------------------------------------------------------------------------------------
>
>                 Key: JENKINS-13028
>                 URL: https://issues.jenkins-ci.org/browse/JENKINS-13028
>             Project: Jenkins
>          Issue Type: Bug
>          Components: core
>            Reporter: Ari Hyttinen
>
> When user supplies a network share file path (for example 
> \\path\to\share\file.xxx)
> to a field, which uses FilePath.child() method to get FilePath object for the 
> file, it does not work, because FilePath.isAbsolute() method returns false 
> for the path, and then current workspace is prepended to it.
> If using drive letter, for example X:\mapped\path\file.xxx, then isAbsolute 
> detects it correctly, and FilePath.child() returns valid FilePath object.
> In plugin code, a kludgy workaround I've been using is:
> if pathString starts with "\\\\", 
> then get new FilePath(pathString), 
> else get FilePath.child(pathString).
> User workarounds are to copy the file from share to workspace with separate 
> build step, or to map the share to a drive letter if possible.
> Note: hudson/FilePath.java already has regexp for detecting these paths as 
> absolute, but for some reason isAbsolute() uses different regexp, which only 
> detects driver letter and /-paths.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to