hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bikas Saha (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-8847) Change untar to use Java API instead of spawning tar process
Date Wed, 03 Oct 2012 06:12:08 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-8847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13468361#comment-13468361
] 

Bikas Saha commented on HADOOP-8847:
------------------------------------

Java File.setExecutable/File.setWritable dont work as expected on Windows. In any case, the
distributed cache explicitly sets permissions on untar'd files after expanding archives. So
there should be no problem. Here is the code snippet from TrackerDistributedCacheManager.downloadCacheObject().
See end of snippet.
{code}
    if (isArchive) {
      String tmpArchive = workFile.getName().toLowerCase();
      File srcFile = new File(workFile.toString());
      File destDir = new File(workDir.toString());
      LOG.info(String.format("Extracting %s to %s",
               srcFile.toString(), destDir.toString()));
      if (tmpArchive.endsWith(".jar")) {
        RunJar.unJar(srcFile, destDir);
      } else if (tmpArchive.endsWith(".zip")) {
        FileUtil.unZip(srcFile, destDir);
      } else if (isTarFile(tmpArchive)) {
        FileUtil.unTar(srcFile, destDir);
      } else {
        LOG.warn(String.format(
            "Cache file %s specified as archive, but not valid extension.",
            srcFile.toString()));
        // else will not do anyhting
        // and copy the file into the dir as it is
      }
      FileUtil.chmod(destDir.toString(), "ugo+rx", true);
    }
{code}
If you are really worried about this change then I could continue to use existing spawn tar
impl for Linux.
                
> Change untar to use Java API instead of spawning tar process
> ------------------------------------------------------------
>
>                 Key: HADOOP-8847
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8847
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Bikas Saha
>            Assignee: Bikas Saha
>         Attachments: HADOOP-8847.branch-1-win.1.patch, test-untar.tar, test-untar.tgz
>
>
> Currently FileUtil.unTar() spawns tar utility to do the work. Tar may not be present
on all platforms by default eg. Windows. So changing this to use JAVA API's would help make
it more cross-platform. FileUtil.unZip() uses the same approach.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message