Skip to content

Fix versionagedays() misparsing build time as a date - #1421

Open
vairakkumaarsvs wants to merge 1 commit into
facebook:mainfrom
Singam-Tech-Inc:fix-versionagedays-build-path-parsing
Open

Fix versionagedays() misparsing build time as a date#1421
vairakkumaarsvs wants to merge 1 commit into
facebook:mainfrom
Singam-Tech-Inc:fix-versionagedays-build-path-parsing

Conversation

@vairakkumaarsvs

Copy link
Copy Markdown

versionagedays() split the version string on "_" and always took index 1 as the YYYYMMDD build date. That index is only correct for the Buck build path (gen_version.py), which prepends a MAIN_VERSION component so the string is "x.y.z_YYYYMMDD_HHMMSS_hash" (date at index 1). The open-source build.py path's auto_version() omits that prefix, producing "YYYYMMDD_HHMMSS_hash" instead - so index 1 is actually the HHMMSS time portion, not the date.

Because strptime's "%Y" greedily consumes exactly 4 digits, a 6-digit time string like "044315" doesn't fail to parse - it silently succeeds as year 0443, and the resulting multi-century "old version" hint gets shown even right after a fresh build.

Scan for the first 8-digit, all-numeric "_"-delimited part instead of assuming a fixed index, so this works for both version string shapes.

versionagedays() split the version string on "_" and always took index
1 as the YYYYMMDD build date. That index is only correct for the Buck
build path (gen_version.py), which prepends a MAIN_VERSION component so
the string is "x.y.z_YYYYMMDD_HHMMSS_hash" (date at index 1). The
open-source build.py path's auto_version() omits that prefix, producing
"YYYYMMDD_HHMMSS_hash" instead - so index 1 is actually the HHMMSS time
portion, not the date.

Because strptime's "%Y" greedily consumes exactly 4 digits, a 6-digit
time string like "044315" doesn't fail to parse - it silently succeeds
as year 0443, and the resulting multi-century "old version" hint gets
shown even right after a fresh build.

Scan for the first 8-digit, all-numeric "_"-delimited part instead of
assuming a fixed index, so this works for both version string shapes.
@meta-cla meta-cla Bot added the CLA Signed label Aug 25, 2026
@meta-codesync

meta-codesync Bot commented Aug 25, 2026

Copy link
Copy Markdown

This pull request has been imported. If you are a Meta employee, you can view this in D117323637. (Because this pull request was imported automatically, there will not be any future comments.)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant