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

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

                Author: ASF GitHub Bot
            Created on: 28/Dec/22 20:49
            Start Date: 28/Dec/22 20:49
    Worklog Time Spent: 10m 
      Work Description: codecov-commenter commented on PR #345:
URL: https://github.com/apache/commons-compress/pull/345#issuecomment-1366908609

   # 
[Codecov](https://codecov.io/gh/apache/commons-compress/pull/345?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
 Report
   > Merging 
[#345](https://codecov.io/gh/apache/commons-compress/pull/345?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
 (894040c) into 
[master](https://codecov.io/gh/apache/commons-compress/commit/f6dadd24b4b20f46541110b0146ce8413430e873?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
 (f6dadd2) will **increase** coverage by `0.10%`.
   > The diff coverage is `89.01%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master     #345      +/-   ##
   ============================================
   + Coverage     80.33%   80.43%   +0.10%     
   - Complexity     6653     6718      +65     
   ============================================
     Files           342      342              
     Lines         25232    25356     +124     
     Branches       4085     4107      +22     
   ============================================
   + Hits          20271    20396     +125     
   + Misses         3382     3373       -9     
   - Partials       1579     1587       +8     
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/commons-compress/pull/345?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
 | Coverage Δ | |
   |---|---|---|
   | 
[...compress/archivers/zip/ZipArchiveOutputStream.java](https://codecov.io/gh/apache/commons-compress/pull/345/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvYXJjaGl2ZXJzL3ppcC9aaXBBcmNoaXZlT3V0cHV0U3RyZWFtLmphdmE=)
 | `74.28% <ø> (-0.05%)` | :arrow_down: |
   | 
[...ommons/compress/archivers/zip/ZipArchiveEntry.java](https://codecov.io/gh/apache/commons-compress/pull/345/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvYXJjaGl2ZXJzL3ppcC9aaXBBcmNoaXZlRW50cnkuamF2YQ==)
 | `82.50% <85.82%> (+2.43%)` | :arrow_up: |
   | 
[...a/org/apache/commons/compress/utils/TimeUtils.java](https://codecov.io/gh/apache/commons-compress/pull/345/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvdXRpbHMvVGltZVV0aWxzLmphdmE=)
 | `96.29% <90.00%> (-3.71%)` | :arrow_down: |
   | 
[...mons/compress/archivers/cpio/CpioArchiveEntry.java](https://codecov.io/gh/apache/commons-compress/pull/345/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvYXJjaGl2ZXJzL2NwaW8vQ3Bpb0FyY2hpdmVFbnRyeS5qYXZh)
 | `73.65% <100.00%> (ø)` | |
   | 
[...ommons/compress/archivers/tar/TarArchiveEntry.java](https://codecov.io/gh/apache/commons-compress/pull/345/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvYXJjaGl2ZXJzL3Rhci9UYXJBcmNoaXZlRW50cnkuamF2YQ==)
 | `71.71% <100.00%> (ø)` | |
   | 
[...compress/archivers/tar/TarArchiveOutputStream.java](https://codecov.io/gh/apache/commons-compress/pull/345/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvYXJjaGl2ZXJzL3Rhci9UYXJBcmNoaXZlT3V0cHV0U3RyZWFtLmphdmE=)
 | `88.61% <100.00%> (ø)` | |
   | 
[...che/commons/compress/archivers/zip/X000A\_NTFS.java](https://codecov.io/gh/apache/commons-compress/pull/345/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvYXJjaGl2ZXJzL3ppcC9YMDAwQV9OVEZTLmphdmE=)
 | `71.29% <100.00%> (+4.62%)` | :arrow_up: |
   | 
[...ompress/archivers/zip/X5455\_ExtendedTimestamp.java](https://codecov.io/gh/apache/commons-compress/pull/345/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvYXJjaGl2ZXJzL3ppcC9YNTQ1NV9FeHRlbmRlZFRpbWVzdGFtcC5qYXZh)
 | `91.47% <100.00%> (+1.81%)` | :arrow_up: |
   | 
[...apache/commons/compress/archivers/zip/ZipUtil.java](https://codecov.io/gh/apache/commons-compress/pull/345/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29tcHJlc3MvYXJjaGl2ZXJzL3ppcC9aaXBVdGlsLmphdmE=)
 | `83.33% <100.00%> (-2.11%)` | :arrow_down: |
   | ... and [12 
more](https://codecov.io/gh/apache/commons-compress/pull/345/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
 | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD 
build times. [Learn 
more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   




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

    Worklog Id:     (was: 836012)
    Time Spent: 20m  (was: 10m)

> Write ZIP extra time fields automatically
> -----------------------------------------
>
>                 Key: COMPRESS-613
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-613
>             Project: Commons Compress
>          Issue Type: Improvement
>          Components: Archivers
>    Affects Versions: 1.21
>            Reporter: Andre Brait
>            Priority: Major
>              Labels: zip
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> When writing to a Zip file through ZipArchiveOutputStream, setting creation 
> and access times in a ZipArchiveEntry does not cause these to be reflected as 
> X5455 or X000A extra fields in the resulting zip file. This also happens for 
> modification times that do not fit into an MS-DOS time.
> As a consequence, the date range is reduced, as well as the granularity (form 
> 100ns intervals to seconds).
> ZipEntry and standard java.util.zip facilities do that automatically, but 
> that's missing here.
> My proposal is to use the same logic the java.util.zip do and add those extra 
> fields automatically, if situation requires them.
> See my existing logic for this here: 
> [https://github.com/andrebrait/DATROMTool/blob/86a4f4978bab250ca54d047c58b4f91e7dbbcc7f/core/src/main/java/io/github/datromtool/io/FileCopier.java#L1425]
> It's (almost) the same logic from java.util.zip, but adapted to be used with 
> ZipArchiveEntry.
> If you're ok with it, I can send a PR.
> Actual logic will be more like 
> {{{}java.util.zip.ZipOutputStream#writeLOC(XEntry){}}}, represented below:
> {code:java}
>         int elenEXTT = 0;         // info-zip extended timestamp
>         int flagEXTT = 0;
>         long umtime = -1;
>         long uatime = -1;
>         long uctime = -1;
>         if (e.mtime != null) {
>             elenEXTT += 4;
>             flagEXTT |= EXTT_FLAG_LMT;
>             umtime = fileTimeToUnixTime(e.mtime);
>         }
>         if (e.atime != null) {
>             elenEXTT += 4;
>             flagEXTT |= EXTT_FLAG_LAT;
>             uatime = fileTimeToUnixTime(e.atime);
>         }
>         if (e.ctime != null) {
>             elenEXTT += 4;
>             flagEXTT |= EXTT_FLAT_CT;
>             uctime = fileTimeToUnixTime(e.ctime);
>         }
>         if (flagEXTT != 0) {
>             // to use ntfs time if any m/a/ctime is beyond unixtime upper 
> bound
>             if (umtime > UPPER_UNIXTIME_BOUND ||
>                 uatime > UPPER_UNIXTIME_BOUND ||
>                 uctime > UPPER_UNIXTIME_BOUND) {
>                 elen += 36;                // NTFS time, total 36 bytes
>             } else {
>                 elen += (elenEXTT + 5);    // headid(2) + size(2) + flag(1) + 
> data
>             }
>         }
>         writeShort(elen);
>         writeBytes(nameBytes, 0, nameBytes.length);
>         if (hasZip64) {
>             writeShort(ZIP64_EXTID);
>             writeShort(16);
>             writeLong(e.size);
>             writeLong(e.csize);
>         }
>         if (flagEXTT != 0) {
>             if (umtime > UPPER_UNIXTIME_BOUND ||
>                 uatime > UPPER_UNIXTIME_BOUND ||
>                 uctime > UPPER_UNIXTIME_BOUND) {
>                 writeShort(EXTID_NTFS);    // id
>                 writeShort(32);            // data size
>                 writeInt(0);               // reserved
>                 writeShort(0x0001);        // NTFS attr tag
>                 writeShort(24);
>                 writeLong(e.mtime == null ? WINDOWS_TIME_NOT_AVAILABLE
>                                           : fileTimeToWinTime(e.mtime));
>                 writeLong(e.atime == null ? WINDOWS_TIME_NOT_AVAILABLE
>                                           : fileTimeToWinTime(e.atime));
>                 writeLong(e.ctime == null ? WINDOWS_TIME_NOT_AVAILABLE
>                                           : fileTimeToWinTime(e.ctime));
>             } else {
>                 writeShort(EXTID_EXTT);
>                 writeShort(elenEXTT + 1);  // flag + data
>                 writeByte(flagEXTT);
>                 if (e.mtime != null)
>                     writeInt(umtime);
>                 if (e.atime != null)
>                     writeInt(uatime);
>                 if (e.ctime != null)
>                     writeInt(uctime);
>             }
>         }
>         writeExtra(e.extra);
>         locoff = written;
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to