Bug 40978 - t/db_dependent/Budgets.t fails on Debian 13 due to warnings
Summary: t/db_dependent/Budgets.t fails on Debian 13 due to warnings
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Jonathan Druart
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks: 41077
  Show dependency treegraph
 
Reported: 2025-10-09 02:19 UTC by Victor Grousset/tuxayo
Modified: 2025-11-10 15:33 UTC (History)
4 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.11.00,25.05.05,24.11.11
Circulation function:


Attachments
Bug 40978: Remove warnings from Budgets.t (1.12 KB, patch)
2025-10-10 09:16 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40978: Remove warnings from Budgets.t (1.12 KB, patch)
2025-10-13 02:05 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 40978: Remove warnings from Budgets.t (1.17 KB, patch)
2025-10-13 02:06 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 40978: Remove warnings from Budgets.t (1.06 KB, patch)
2025-10-17 10:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 40978: Remove warnings from Budgets.t (1.15 KB, patch)
2025-10-24 07:10 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Grousset/tuxayo 2025-10-09 02:19:45 UTC
Test plan
1. KOHA_IMAGE=main-bookworm ktd up
2. prove t/db_dependent/Budgets.t
3. pass
4. KOHA_IMAGE=main-trixie ktd up
5. prove t/db_dependent/Budgets.t
#   Failed test 'no warnings'
#   at /usr/share/perl/5.40/Test/Builder.pm line 193.
# There were 30 warning(s)
#     Previous test 65 'total ordered price is 20'
#     Use of uninitialized value $row[0] in hash element at /usr/lib/x86_64-linux-gnu/perl5/5.40/DBI.pm line 2122.
#  at /usr/lib/x86_64-linux-gnu/perl5/5.40/DBI.pm line 2122.
#       DBD::_::st::fetchall_hashref(DBI::st=HASH(0x557454dac660), "budget_id") called at /usr/lib/x86_64-linux-gnu/perl5/5.40/DBD/mysql.pm line 866
#       DBD::mysql::st::__ANON__(DBI::st=HASH(0x557454dac660), "budget_id") called at /usr/lib/x86_64-linux-gnu/perl5/5.40/DBI.pm line 1684
#       DBD::_::db::selectall_hashref(DBI::db=HASH(0x557454733ab0), "\x{a}            SELECT shipmentcost_budgetid as budget_id,\x{a}     "..., "budget_id") called at /kohadevbox/koha/C4/Budgets.pm line 750
#       C4::Budgets::GetBudgetHierarchy(36) called at /kohadevbox/koha/C4/Budgets.pm line 1442
#       C4::Budgets::CloneBudgetPeriod(HASH(0x557454dc9ca0)) called at t/db_dependent/Budgets.t line 598
# 

etc

Maybe you need to apply bug 40680 if there are other warnings interfering. Or just ignore them and focus on the "Use of uninitialized value" ones.

Severity = major because it makes the CI fail and hides issues even if not as much as Bug 40680. Maybe critical, I don't know.
Comment 1 Jonathan Druart 2025-10-10 09:16:12 UTC
Created attachment 187719 [details] [review]
Bug 40978: Remove warnings from Budgets.t

If no shipment_budget is set then undef is set as key of the hashref
which generates a warning:
  Use of uninitialized value $row[0] in hash element at /usr/lib/x86_64-linux-gnu/perl5/5.40/DBI.pm line 2122.

Later we only access the hashref by budget_id, so this change seems
safe.
Comment 2 Victor Grousset/tuxayo 2025-10-13 02:05:07 UTC Comment hidden (obsolete)
Comment 3 Victor Grousset/tuxayo 2025-10-13 02:06:41 UTC
Created attachment 187781 [details] [review]
Bug 40978: Remove warnings from Budgets.t

If no shipment_budget is set then undef is set as key of the hashref
which generates a warning:
  Use of uninitialized value $row[0] in hash element at /usr/lib/x86_64-linux-gnu/perl5/5.40/DBI.pm line 2122.

Later we only access the hashref by budget_id, so this change seems
safe.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 4 Victor Grousset/tuxayo 2025-10-13 02:07:36 UTC
It works!
Comment 5 Jonathan Druart 2025-10-17 10:15:47 UTC
Created attachment 188060 [details] [review]
Bug 40978: Remove warnings from Budgets.t

If no shipment_budget is set then undef is set as key of the hashref
which generates a warning:
  Use of uninitialized value $row[0] in hash element at /usr/lib/x86_64-linux-gnu/perl5/5.40/DBI.pm line 2122.

Later we only access the hashref by budget_id, so this change seems
safe.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 6 Marcel de Rooy 2025-10-24 07:10:24 UTC
Created attachment 188399 [details] [review]
Bug 40978: Remove warnings from Budgets.t

If no shipment_budget is set then undef is set as key of the hashref
which generates a warning:
  Use of uninitialized value $row[0] in hash element at /usr/lib/x86_64-linux-gnu/perl5/5.40/DBI.pm line 2122.

Later we only access the hashref by budget_id, so this change seems
safe.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 7 Lucas Gass (lukeg) 2025-10-24 13:59:04 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 8 Paul Derscheid 2025-10-29 09:10:21 UTC
Nice work everyone!

Pushed to 25.05.x
Comment 9 Fridolin Somers 2025-11-10 15:33:38 UTC
Pushed to 24.11.x for 24.11.11