Modify

Ticket #8 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

TarTask seem to omit empty directories

Reported by: knut Owned by: hans
Priority: minor Milestone: 2.2.0
Component: Version: 2.2.0RC1
Keywords: TarTask Cc:

Description

Reproducable example:

<target name="empty">

<mkdir dir="empty/empty"/> <tar compression="gzip" destFile="empty.tar.gz" basedir="empty"/>

</target>

Should do the same as: mkdir empty cd empty mkdir empty tar czvf empty.tar.gz empty

Attachments

Change History

comment:1 Changed 4 years ago by knut

  • Priority changed from minor to major

comment:2 Changed 4 years ago by anonymous

This results in the following output:

test > empty:
  [mkdir] Created dir: /home/knut/web/phing/svn/trunk/test/empty/empty
  [tar] Nothing to do: /home/knut/web/phing/svn/trunk/test/empty.tar.gz is up to date.

But the empty.tar.gz file isn't even created because the task is omitting empty directories. I've tried digging for this bug, but it looks like it's sticking deeper down than the task code.

comment:3 Changed 4 years ago by mrook

  • Owner set to mrook
  • Priority changed from major to minor
  • Status changed from new to assigned

Hi Knut,

This is a side-effect of FileSet behavior. Quoting from the source:

// FIXME
// Current model is only adding directories implicitly.  This
// won't add any empty directories.  Perhaps modify TarFileSet::getFiles()
// to also include empty directories.  Not high priority, since non-inclusion
// of empty dirs is probably not unexpected behavior for TarTask.

TarTask scans all filesets for files that have a mtime more recent than the TAR archive. Since there are no files in the fileset, nothing is more recent, and the TAR archive is never created.

Thus, as mentioned, the fix would be to modify TarFileSet::getFiles() to include empty dirs. I'm not sure we want this however (and maybe we do, convince me ;)).

comment:4 Changed 4 years ago by knut

A typical problem I meet is in our PRADO demo applications (which we want to ship with the distribution) we have some empty directories called "assets" and "runtime" which is empty by default, but is filled up with data when the demo application runs, hence quite useful empty directories.

Since you mentioned that this is a side-effect from FileSet I saw that the actual problem occurs in CopyTask @ Line 211 in the PRADO build file  http://trac.pradosoft.com/browser/trunk/build.xml?rev=906 where I loose the empty directories which I actually have here.

Convinced?

comment:5 Changed 4 years ago by hans

  • Owner changed from mrook to hans
  • Status changed from assigned to new

comment:6 Changed 4 years ago by hans

  • Status changed from new to closed
  • Resolution set to fixed

This should be fixed in changeset:94. There were actually two inter-related bugs that were fixed:

  1. TarTask now has a includeEmptyDirs attribute, which is true by default.
  2. Checks to see whether archive is up-to-date will not return true if the archive does not exist :)
View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.