[PATCH] Add a length check to the timestamp version detection. (#1194494)

Anne Mulhern amulhern at redhat.com
Fri Feb 20 15:38:35 UTC 2015





----- Original Message -----
> From: "David Shea" <dshea at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Friday, February 20, 2015 10:13:03 AM
> Subject: Re: [PATCH] Add a length check to the timestamp version detection.	(#1194494)
> 
> On 02/20/2015 10:06 AM, Anne Mulhern wrote:
> >
> >
> >
> > ----- Original Message -----
> >> From: "David Shea" <dshea at redhat.com>
> >> To: anaconda-patches at lists.fedorahosted.org
> >> Sent: Friday, February 20, 2015 9:09:31 AM
> >> Subject: [PATCH] Add a length check to the timestamp version detection.
> >> 	(#1194494)
> >>
> >> '22' is not a timestamp.
> >> ---
> >>   pyanaconda/packaging/__init__.py | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/pyanaconda/packaging/__init__.py
> >> b/pyanaconda/packaging/__init__.py
> >> index e4a9a63..2af5a9a 100644
> >> --- a/pyanaconda/packaging/__init__.py
> >> +++ b/pyanaconda/packaging/__init__.py
> >> @@ -397,7 +397,7 @@ class Payload(object):
> >>   
> >>           # If the version looks like a timestamp, assume it's rawhide
> >>           # plz change before Fedora version 9999999
> >> -        if version[:8].isdigit():
> >> +        if len(version) > 7 and version[:8].isdigit():
> >>               version = "rawhide"
> >>   
> >>           log.debug("got a release version of %s", version)
> >> --
> >> 2.1.0
> >>
> >> _______________________________________________
> >> anaconda-patches mailing list
> >> anaconda-patches at lists.fedorahosted.org
> >> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> >>
> > It's probably more correct to use a regular expression, at this point.
> 
> Before I go down that road (and really? you've seen my regexes, right?)
> I'll repeat a question I asked in the bug: does anyone use this anymore?
> The timestamp check was never very good, and the rawhide .buildstamp
> version these days is "rawhide".
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

Good point. I'm not against you throwing out the check entirely.

Additionally, 

I think that the isdigit() check is pointless anyway...by the time it reaches
the code version is either a string of digits or "rawhide" (due to regular expression matching above).

Maybe it would make some sense to make VERSION_DIGITS regular expression be restricted to just 7 digits
...and throw out the checking code?

- mulhern




More information about the anaconda-patches mailing list