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

fix sql error on bad virtualfull; detect parsing errors with strtod #1725

Conversation

sebsura
Copy link
Contributor

@sebsura sebsura commented Mar 1, 2024

Thank you for contributing to the Bareos Project!

This pr makes it so prev_jr an optional, so that code can check whether this particular member was initialized or not.
Previously the cleanup did not check whether prev_jr was initialised before it tried to clean it up (this happened if the
job ended in an error quickly).

It also changes the number parsing code somewhat. Now we check that everything is parsed, not just that something was parsed. In particular, with certain locales, we used to parse 1,5 as 1 and did not emit any errors since we managed to parse something.
Now we actually check if any characters are left over and fail the parsing if so.

Additionally a small enhancement was added to the parsing routines. Previously we could parse durations like
1 Year 5 Days 10 Hours correctly, but we could not parse numbers like 1 TB 500 GB, since the code did not loop until every token was consumed. This PR unified the duration/number parsing somewhat so that now even numbers can be split like above.

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

If you have any questions or problems, please give a comment in the PR.

Helpful documentation and best practices

Checklist for the reviewer of the PR (will be processed by the Bareos team)

Make sure you check/merge the PR using devtools/pr-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
  • Check backport line
  • Required backport PRs have been created
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR
Tests
  • Decision taken that a test is required (if not, then remove this paragraph)
  • The choice of the type of test (unit test or systemtest) is reasonable
  • Testname matches exactly what is being tested
  • On a fail, output of the test leads quickly to the origin of the fault

core/src/dird/consolidate.cc Outdated Show resolved Hide resolved
@sebsura sebsura marked this pull request as draft March 27, 2024 08:35
Copy link
Member

@pstorz pstorz left a comment

Choose a reason for hiding this comment

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

Looks good. I have enabled a former commented out test in test_edit.cc
and it fails. It seems that the last single 1 without modifier ist not accepted.

@arogge arogge added the bugfix label Apr 2, 2024
@arogge arogge modified the milestones: 23.0.3, 24.0.0 Apr 2, 2024
@sebsura sebsura marked this pull request as ready for review April 29, 2024 06:24
core/src/tests/test_edit.cc Outdated Show resolved Hide resolved
@sebsura sebsura force-pushed the dev/ssura/master/fix-sql-error-on-bad-virtualfull branch 2 times, most recently from 3cb2429 to e2c72d2 Compare May 24, 2024 07:46
sebsura and others added 9 commits June 5, 2024 07:32
This way we are forced to always consider the fact that this member
might not be set.
This way you can optionally ignore space at the end of the string.
Since we replaced jcr->dir_impl->previous_jcr with prev_jr, we also
need to check that the functions we call do not expect it to be set
like CreateRestoreBootstrap did.
@sebsura sebsura force-pushed the dev/ssura/master/fix-sql-error-on-bad-virtualfull branch from e2c72d2 to 5877286 Compare June 5, 2024 05:32
@BareosBot BareosBot merged commit d815387 into bareos:master Jun 5, 2024
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.

None yet

4 participants