Bug 438535

Summary: confusing "which was included from line NN" Config Error from kdesrc-build
Product: [Developer tools] kdesrc-build Reporter: skierpage <info>
Component: generalAssignee: Michael Pyne <mpyne>
Status: RESOLVED FIXED    
Severity: minor CC: ashark
Priority: NOR    
Version First Reported In: Git   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description skierpage 2021-06-13 07:18:55 UTC
SUMMARY
Following https://community.kde.org/Get_Involved/development , I finally got to building!, but got
        Config Error: Unable to open file /home/spage/programs/kde/src/kdesrc-build/kf5-qt5-build-include which was included from line 42
But there's no line 42 in kdesrc-build.

STEPS TO REPRODUCE
1. Set up kdesrc-build
2. Wait several years 😉, repeat setup it in a different location
3. Run `kdesrc-build baloo`


OBSERVED RESULT
You get a great error message from `kdesrc-build baloo`
    kdesrc-build encountered an exceptional error condition:
     ========
        Config Error: Unable to open file /home/spage/programs/kde/src/kdesrc-build/kf5-qt5-build-include which was included from line 42
     ========
            Can't continue, so stopping now.

but it's not processing the script file kdesrc-build, so ??
(Eventually I figured out the actual failing include is happening while parsing my outdated configuration file ~/.kdesrc-buildrc , but you have to know to look here.)

EXPECTED RESULT
It would be great if the configuration loading could say what config file it's processing, e.g.
    Config Error while processing ~/.kdesrc-buildrc : Unable to open file /home/spage/programs/kde/src/kdesrc-build/kf5-qt5-build-include which was included from its line 42

I realize this may be really hard to do, as the rc processing seems to be happening in some Perl module that may be unaware of the context.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.21.5
KDE Frameworks Version: git master
Qt Version: 5.15.2 on Wayland
Comment 1 Andrew Shark 2023-11-10 11:33:14 UTC
> I realize this may be really hard to do

It is not. It probably just needs to change the line
```perl
"Unable to open file $filename which was included from line $.");
```
to
```perl
"Unable to open file $filename which was included from $fh->{current_fn}:$.");
```
Comment 2 Bug Janitor Service 2023-11-11 22:59:41 UTC
A possibly relevant merge request was started @ https://invent.kde.org/sdk/kdesrc-build/-/merge_requests/317
Comment 3 Joshua Goins 2023-11-12 17:29:09 UTC
Git commit ac0134ffdfa2eadca78fd7e462c17aa955f86dce by Joshua Goins, on behalf of Andrew Shark.
Committed on 12/11/2023 at 18:28.
Pushed by redstrate into branch 'master'.

Print the file name from which the include instruction failed

M  +2    -4    modules/ksb/RecursiveFH.pm

https://invent.kde.org/sdk/kdesrc-build/-/commit/ac0134ffdfa2eadca78fd7e462c17aa955f86dce