Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inconsistent refusal of bodhi override with maximum duration #4182

Closed
keszybz opened this issue Jan 19, 2021 · 4 comments · Fixed by #4204
Closed

inconsistent refusal of bodhi override with maximum duration #4182

keszybz opened this issue Jan 19, 2021 · 4 comments · Fixed by #4204
Labels
EasyFix These are good issues to get started with if you are new to the project

Comments

@keszybz
Copy link

keszybz commented Jan 19, 2021

From https://bugzilla.redhat.com/show_bug.cgi?id=1761691:

$ fedpkg override create --duration=31 python-pytest-steps-1.6.2-1.fc31
Expiration date may not be longer than 31
Could not execute create_buildroot_override: Cannot create override.

Obviously the user is asking for a duration of 31 days which is not "longer than 31".

fedpkg-1.37-5.el8.1.noarch

Creating the update with --duration=30 works.

Looking at the code

now = datetime.utcnow()
if expiration_date <= now:
request.errors.add('body', 'expiration_date',
'Expiration date in the past')
return
days = config.get('buildroot_limit')
limit = now + timedelta(days=days)
if expiration_date > limit:

it's a toctou issue: expiration_date is calculated first, and then when now + timedelta(days=config.get('buildroot_limit')) is calculated the result is tiny bit off, so the check fails.

@mattiaverga mattiaverga added the EasyFix These are good issues to get started with if you are new to the project label Mar 15, 2021
@samyak-jn
Copy link
Contributor

samyak-jn commented Apr 2, 2021

Hi,
Just a quick question with regards to bodhi overrides, I was testing bodhi in the vagrant, To reproduce the above issue wanted to run bodhi overrides save --duration=31 <pkgname> to test, but it asks for username and password I tried authenticating using fas account but failed to do so, is it right approach to test overrides, how can I use the bodhi overrides save command properly?

@samyak-jn
Copy link
Contributor

samyak-jn commented Apr 2, 2021

Also, what is optimal buildroot_limit should be defined? What's the ideal duration for overrides that needs to be set?

Herewith reference to the source:

        'buildroot_limit': {
            'value': 31,
            'validator': int},

The issue talks about the inconsistency caused in the error message that 31 is no longer than 31, two things (the error message should be re-written (longer and equal to), also, if we have allowed the duration to 31 this should work right?)
I'm just new to bodhi, so might be asking some non-relevant doubts :)

CC: @keszybz

@mattiaverga
Copy link
Contributor

mattiaverga commented Apr 3, 2021

Hi @samyak-jn ,
the vagrant Bodhi box uses staging accounts, you will need to register your account in https://accounts.stg.fedoraproject.org (seems that production accounts were not sync-ed to staging).
EDIT: the accounts are there, but you probably have to reset your password

About the time limit, just change the check so that it is not so pedantic... ;-)

@samyak-jn
Copy link
Contributor

Thanks, @mattiaverga, will do the changes in the check and also update the error message so that it won't confuse the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EasyFix These are good issues to get started with if you are new to the project
Projects
None yet
3 participants