You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2011/08/11 03:50:15 UTC

DO NOT REPLY [Bug 51646] New: pathconvert - mapper using OS directory separator instead of dirsep

https://issues.apache.org/bugzilla/show_bug.cgi?id=51646

             Bug #: 51646
           Summary: pathconvert - mapper using OS directory separator
                    instead of dirsep
           Product: Ant
           Version: 1.8.1
          Platform: PC
        OS/Version: Windows Server 2003
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: szetheli+apache@gmail.com
    Classification: Unclassified


It looks like pathcovert is using the OS directory separator for processing
mapper even if a custom dirsep is specified.

I'm trying to write pathcovert statement that is OS agnostic, so I turn
dirsep="/" since I don't want to deal with windows "\".  I need to do some
manipulation on the path as well, turning the file names into properties, so I
use mapper to strip the parts I don't need.

Example:
<pathconvert property="-service.fragments.properties"
pathsep="=${line.separator}" dirsep="/"
  refid="-service.fragment.path" >
    <chainedmapper>
      <filtermapper>
    <!-- BUGBUG - even though dirsep=/, the filter sees \ on windows.  The
below line is necessary to make windows/linux treat the path the same-->
    <replacestring from="\" to="/" />
    <replaceregex pattern=".*/([^/]*)" replace="\1"/>
      </filtermapper>
    </chainedmapper>
</pathconvert>

Expected:
If I comment out the replacestring statement, mapper should see the path
elements as "a/b/c/file".

Actual:
with replacestring commented, replaceregex does not match, because its seeing
a\b\c\file

Work around:
Adding replacestring statement in place of the dirsep attribute (yuck).

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 51646] pathconvert - mapper using OS directory separator instead of dirsep

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51646

--- Comment #2 from szetheli+apache@gmail.com 2012-01-19 18:13:27 UTC ---
I'd consider it at least "Undesirable behavior".  Just because that's the order
the code currently evaluates things doesn't mean it's the order most desirable
by the user. 

Given pathconvert is used to convert paths into different strings, not
necessarily another path, it makes sense to me that dirsep should be applied
before the filters look at it, otherwise dirsep can be pretty useless in
pathcovert with filters.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 51646] pathconvert - mapper using OS directory separator instead of dirsep

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51646

Jesse Glick <jg...@netbeans.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jglick@netbeans.org

--- Comment #1 from Jesse Glick <jg...@netbeans.org> 2012-01-19 14:31:58 UTC ---
Probably the dirsep processing is just happening after the mappers, in which
case this is not a bug?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.