Ticket #245 (closed defect: fixed)
TAR task
| Reported by: | rehan.iftikhar@… | Owned by: | hans |
|---|---|---|---|
| Priority: | major | Milestone: | 2.4.0RC1 |
| Component: | phing-core | Version: | 2.3.0 |
| Keywords: | Cc: |
Description
The TAR task in phing makes symlinks into normal directories.
Attachments
Change History
comment:1 Changed 2 years ago by mrook
- Status changed from new to closed
- Resolution set to worksforme
comment:2 Changed 2 years ago by anonymous
Relevant Packages: Archive_Tar 1.3.3 stable phing 2.3.3 stable
I can recreate this. I create an archive from a working directory. The working directory contains numerous symlinks inside it and the resultant tar archive does not contain symlinks, however, it contains copies of the directories that were symlinked. Archive creation is as follows:
<tar destfile="${build.filename}" compression="gzip" basedir="${build.dir}/${xinc.build.number}" />
comment:3 Changed 2 years ago by mrook
- Status changed from closed to reopened
- Resolution worksforme deleted
Yup, confirmed now - thanks for the additional info.
comment:5 Changed 2 years ago by mrook
- Status changed from reopened to closed
- Resolution set to fixed
DirectoryScanner()::scan no longer automatically dereferences symbolic links. To simulate the previous behavior use:
<fileset expandsymboliclinks="true" ....
comment:6 Changed 2 years ago by anonymous
Was just reviewing your code changes, as I had tracked down the root of the problem and made more or less the same modifications to DirectoryScanner::scandir() as you made. I didn't add the backwards compatibility flag (expandsymboliclinks), but otherwise, our code is identical.
Just wanted to let you know that this change appears to break the copy task when attempting to copy a directory which contains a symlink that points to a directory. Stack trace from a failed attempt:
BUILD FAILED exception 'Exception' with message 'FileSystem::copy() FAILED. Cannot copy /var/xinc/projects/WebDS/builds/8362/webds-7.1.0.8362/extranet/includes to /deploy/webds-7.1.0.8362/extranet/includes. ' in /usr/local/lib/php/phing/system/io/FileSystem.php:400 Stack trace: #0 /usr/local/lib/php/phing/system/io/PhingFile.php(666): FileSystem->copy(Object(PhingFile), Object(PhingFile)) #1 /usr/local/lib/php/phing/util/FileUtils.php(103): PhingFile->copyTo(Object(PhingFile)) #2 /usr/local/lib/php/phing/tasks/system/CopyTask.php(379): FileUtils->copyFile(Object(PhingFile), Object(PhingFile), false, true, Array, Object(Project)) #3 /usr/local/lib/php/phing/tasks/system/CopyTask.php(245): CopyTask->doWork() #4 /usr/local/lib/php/phing/Task.php(253): CopyTask->main() #5 /usr/local/lib/php/phing/Target.php(240): Task->perform() #6 /usr/local/lib/php/phing/Target.php(263): Target->main() #7 /usr/local/lib/php/phing/Project.php(702): Target->performTasks() #8 /usr/local/lib/php/phing/Project.php(675): Project->executeTarget('fullBuild') #9 /usr/local/lib/php/phing/Phing.php(541): Project->executeTargets(Array) #10 /usr/local/lib/php/phing/Phing.php(170): Phing->runBuild() #11 /usr/local/lib/php/phing/Phing.php(270): Phing::start(Array, NULL) #12 /usr/local/lib/php/phing.php(37): Phing::fire(Array) #13 {main}
comment:7 Changed 2 years ago by mrook
Yup, thats correct, but CopyTask failed on symbolic links anyway - see #221.
comment:8 Changed 2 years ago by anonymous
Yeah, I was aware of 221, as that is an issue that was affecting me as well. I had an exec call out to cp in place as a workaround, but after this change, I decided to see if it would work with symlinks now. The difference now is that instead of logically failing and copying the target of the symlinks, the build now fails out due to the Exception above (which was formatted poorly in my comment, I apologize). I haven't taken time to follow through that exception and track down the cause, but my guess would be that PhingFile isn't built with symlink support.

Can't reproduce this using latest Archive_Tar and Phing source.