Skip to content

revision_pattern_from_build_bucket_path can return a bad revision pattern if bucket name contains numerics #4935

@jasocrow

Description

@jasocrow

Consider:

RELEASE_BUILD_BUCKET_PATH = gs://builds.fuzz-nprd-53709/([0-9]+).*.zip
def revision_pattern_from_build_bucket_path(bucket_path):
  """Get the revision pattern from a build bucket path."""
  return '.*?' + os.path.basename(bucket_path)

revision_pattern_from_build_bucket_path will return .*?([0-9]+).*.zip

for a path like gs://builds.fuzz-nprd-53709/123_01bced44.zip, the revision will be 53709 instead of 123.

Some code that shows this:

import re
import os

RELEASE_BUILD_BUCKET_PATH = "gs://builds.fuzz-nprd-53709/([0-9]+).*.zip"

def revision_pattern_from_build_bucket_path(bucket_path):
  """Get the revision pattern from a build bucket path."""
  return '.*?' + os.path.basename(bucket_path)

build_url = 'gs://builds.fuzz-nprd-53709/123_01bced44.zip'

revision_pattern = revision_pattern_from_build_bucket_path(RELEASE_BUILD_BUCKET_PATH)
print(f"{revision_pattern}")

match = re.match(revision_pattern, build_url)
revision = match.group(1)
print(f"{revision}")
% python3 show-bad-revision-number.py
.*?([0-9]+).*.zip
53709

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions