[ 
https://issues.apache.org/jira/browse/COMPRESS-404?focusedWorklogId=430210&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-430210
 ]

ASF GitHub Bot logged work on COMPRESS-404:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/May/20 14:07
            Start Date: 04/May/20 14:07
    Worklog Time Spent: 10m 
      Work Description: michael-o commented on a change in pull request #97:
URL: https://github.com/apache/commons-compress/pull/97#discussion_r419461686



##########
File path: 
src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
##########
@@ -354,6 +364,24 @@ public TarArchiveEntry(final File file) {
         this(file, file.getPath());
     }
 
+    /**
+     * Construct an entry for a file. File is set to file, and the
+     * header is constructed from information from the file.
+     * The name is set from the normalized file path.
+     *
+     * <p>The entry's name will be the value of the {@code file}'s
+     * path with all file separators replaced by forward slashes and
+     * leading slashes as well as Windows drive letters stripped. The
+     * name will end in a slash if the {@code file} represents a
+     * directory.</p>
+     *
+     * @param file The file that the entry represents.
+     * @since 1.21
+     */
+    public TarArchiveEntry(final Path file) {
+        this(file, file.toString());

Review comment:
       What will happen if `file` is absolute?

##########
File path: 
src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
##########
@@ -384,12 +430,49 @@ public TarArchiveEntry(final File file, final String 
fileName) {
         } else {
             this.mode = DEFAULT_FILE_MODE;
             this.linkFlag = LF_NORMAL;
-            this.size = file.length();
+            try {
+                this.size = Files.size(file);
+            } catch (IOException e) {
+                e.printStackTrace();

Review comment:
       Not helpful.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 430210)
    Time Spent: 0.5h  (was: 20m)

> Add Path equivalents to TarArchiveEntry, with methods using File delegating 
> to equivalents
> ------------------------------------------------------------------------------------------
>
>                 Key: COMPRESS-404
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-404
>             Project: Commons Compress
>          Issue Type: Sub-task
>            Reporter: Simon Spero
>            Priority: Minor
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> (This is a reasonable place to start, as Paths give better access to 
> tar-relevant metadata on unix system).
> Symlink info is easier to obtain
> Unix based Paths allow access to useful attributes under "unix:*"  
> - numeric uid and gid 
> - string owner and group names
> - mtime,ctime,atime 
> - numeric mode
> - numeric dev and inode 
> - numeric rdev 
> - Linux, Solaris and Windows allow access to extended attributes 
> (MacOS X xattrs aren't supported as of jdk 9)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to