gnodet opened a new pull request, #419:
URL: https://github.com/apache/maven-archiver/pull/419

   ## Summary
   
   Fix a regression introduced by merging two independent commits that conflict 
with each other:
   - `11e764c` added support for negative epoch timestamps (e.g. 
`SOURCE_DATE_EPOCH=-1`)
   - `2e6b113` added `clampToDateMin()` which unconditionally clamps any 
timestamp before `DATE_MIN` (1980-01-01T00:00:02Z)
   
   Since negative epoch seconds are by definition before `DATE_MIN`, the 
clamping silently overwrites them, breaking the negative-epoch support added in 
the previous commit.
   
   ## Root Cause
   
   `clampToDateMin()` used `date.isBefore(DATE_MIN)` as its condition, which is 
`true` for **all** pre-1980 dates — including legitimate negative epoch seconds 
like `-1` (`1969-12-31T23:59:59Z`) or `-315532802` (`1960-01-01T23:59:58Z`).
   
   ## Fix
   
   Restrict the clamp to timestamps that are **at or after the Unix epoch** 
(`>= Instant.EPOCH`). Negative epoch seconds are intentional values and must 
pass through unchanged.
   
   ```java
   // Before
   if (date.isBefore(DATE_MIN)) {
   
   // After
   if (!date.isBefore(Instant.EPOCH) && date.isBefore(DATE_MIN)) {
   ```
   
   This preserves all existing behaviour:
   - `SOURCE_DATE_EPOCH=0` → clamped to `DATE_MIN` ✅
   - Positive timestamps before 1980 (e.g. `1`, `315532801`, 
`1979-12-31T23:59:59Z`) → clamped ✅
   - Negative epoch timestamps (`-1`, `-315532802`) → passed through unchanged ✅
   
   ## Tests
   
   All 115 existing tests pass, including both:
   - `parseOutputTimestampClampsToDateMin` (0, 1, 315532801, 
1970-01-01T00:00:00Z, 1979-12-31T23:59:59Z)
   - `parseOutputTimestampInstant` (-1 → -1, -315532802 → -315532802)
   
   _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_
   


-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to