Skip to content

Conversation

@lovelydinosaur
Copy link
Member

@lovelydinosaur lovelydinosaur commented Aug 1, 2024

Closes #3794

Not clear to me if...

  • There may also be a timezone issue here leading to the negative value.

And furthermore...

  • Non-integer values will still raise an exception here.

But this does at least resolve the immediate issue.

Thanks to @vedranmiletic for raising the issue and @pawamoy for the confimation.

Not clear to me if...

* There may also be a timezone issue here leading to the negative value.

And furthermore...

* Non-integer values will still raise an exception here.

But this does at least resolve the immediate issue.
Copy link
Contributor

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix @tomchristie. Just wondering what the issue exactly was.

else:
dt = get_build_datetime()
return int(dt.timestamp())
return max(int(dt.timestamp()), 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure to understand the fix (but believe you that it actually fixes the issue). Is it a timezone-aware/naive issue? I gather int(dt.timestamp()) would return a negative integer when there are no pages and SOURCE_DATE_EPOCH=0? But why 🤔?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add an actual test by the way? To prevent any regression.

# Lexicographic comparison is OK for ISO date.
date_string = max(p.update_date for p in pages)
dt = datetime.fromisoformat(date_string)
dt = datetime.fromisoformat(date_string).replace(tzinfo=timezone.utc)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that we're using utc timezone datetimes everywhere, except here.
The robust fix is that we update this naive timezone into a utc based timezone.

@lovelydinosaur lovelydinosaur merged commit 0b22a52 into master Aug 28, 2024
@lovelydinosaur lovelydinosaur deleted the tomchristie-patch-1 branch August 28, 2024 13:08
@vedranmiletic
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build with SOURCE_DATE_EPOCH=0 fails

4 participants