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 2009/10/21 17:18:21 UTC

DO NOT REPLY [Bug 48035] New: Tar task doesn't create one-file archives

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

           Summary: Tar task doesn't create one-file archives
           Product: Ant
           Version: 1.7.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: aklochkov@griddynamics.com


When tar task is used to create an archive consisting of one file, it doesn't
work under some circumstances. I've used debugger to find the problem. It's in
this code in Tar.java (lines 567-572_:

                Vector files = (Vector) basedirToFilesMap.get(base);
                if (files == null) {
                    files = new Vector();
                    basedirToFilesMap.put(base, new Vector());
                }
                files.add(r.getName());

Here files var is filled with "new Vector()" and then another fresh Vector
instance is put into the basedirToFilesMap. Then file name is added to the
first Vector instance which is useless as it should ad an entry to the second
Vector instance, which is used later.

Correct code:

                Vector files = (Vector) basedirToFilesMap.get(base);
                if (files == null) {
                    files = new Vector();
                    basedirToFilesMap.put(base, files);
                }
                files.add(r.getName());

-- 
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 48035] Tar task doesn't create one-file archives

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

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |1.8.0

--- Comment #1 from Stefan Bodewig <bo...@apache.org> 2009-10-21 11:50:45 UTC ---
Actually it's worse than that.  Your fix alone is not enough if the resource
doesn't have a basedir but its name is not an absolute path - this is the case
for the <file> resource, for example.

Fixed in svn revision 828141

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