Bug 458943 - kdesrc-run ignores options
Summary: kdesrc-run ignores options
Status: RESOLVED WORKSFORME
Alias: None
Product: kdesrc-build
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Michael Pyne
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-10 06:52 UTC by Juraj
Modified: 2023-09-01 18:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Juraj 2022-09-10 06:52:32 UTC
SUMMARY
The "kdesrc-run" script ignores provided options (-h, --help, -f, --fork, ...) and treats them as programs to start.

STEPS TO REPRODUCE
1. Install kdesrc-build on Artix
2. run # kdesrc-run --help
3. or run an example # kdesrc-run -f kate -l 5 file1.txt

OBSERVED RESULT
An error message:
> kdesrc-run:source:2: no such file or directory: /home/USER/kde/build/-f/prefix.sh
> kdesrc-run:source:2: no such file or directory: /home/USER/kde/build/--help/prefix.sh
> 
> General error message:
> kdesrc-run:source:2: no such file or directory: /home/USER/kde/build/%OPTION%/prefix.sh
Where %OPTION% is the provided option.

EXPECTED RESULT
The option is recognized and program (eg. kate) is started.

SOFTWARE/OS VERSIONS
Perl Version: 5.36.0-1
kdesrc-build Versions: 22.07-1 and git-r2635.630d70d-1

ADDITIONAL INFORMATION
I tried both versions, one from Arch repositories (version 22.07-1) and also one built from AUR (git-r2635.630d70d-1) and both have same issue.
Comment 1 Andrew Shark 2023-09-01 17:22:11 UTC
Cannot reproduce.

`kdesrc-run --help` shows usage.
`kdesrc-run -f kate -l 5 file1.txt` opens the file1.txt in kate (in the same instance, if that was already opened) at line 5.

Note, that kate has a special code, that if forks even when you do not use the `-f` option.

SOFTWARE/OS VERSIONS
kdesrc-build 22.07 (v22.07-246-gceaed4b) [not a package from Arch repository]
Comment 2 Juraj 2023-09-01 17:36:12 UTC
Thank you for looking into this.

> Cannot reproduce.
I did not specify that I am running this from ZSH shell.
When it is called from BASH it runs just fine.

It looks weird to me.

> Note, that kate has a special code, that if forks even when you do not use the `-f` option.
It can bug with just "kdesrc-run --help"; nothing else is needed, kate is innocent.
Comment 3 Andrew Shark 2023-09-01 17:43:17 UTC
No, working fine for me. I am also using zsh on Arch by the way.

```
➜  ~ echo $SHELL
/usr/bin/zsh
➜  kde6 ./kdesrc-run --help
Usage:
    kdesrc-run [options] <module-name> [arguments]

Options:
      -e, --exec <program>    Specify program of the module. Default to module name.
      -f, --fork              Launch the program in a new session.
      -q, --quiet             Do not print run information.
      -h, --help              Print usage information and exit.
      --list-installed        Print installed modules and exit.
```

> When it is called from BASH it runs just fine.
Looks like you have a problem in your zsh.
Comment 4 Juraj 2023-09-01 17:45:23 UTC
Thank you for checking again.

OK, I will try to find it or switch to bash....
Comment 5 Juraj 2023-09-01 17:57:30 UTC
Hello,
I found what is / was wrong.

The past me created an alias in .zshrc to make things easier for him and than forgot about it.

> ## Run projects built with kdesrc-build
> function kdesrc-run
> {
>   source "$HOME/kde/build/$1/prefix.sh" && "$HOME/kde/usr/bin/$@"
> }

This is the cause of the problem, my forgotten configuration.
Comment 6 Andrew Shark 2023-09-01 18:22:35 UTC
Thanks for sharing.
I have several folders: `~/kde5` and `~/kde6`. I have added `~/bin/kdesrc-run` with the following
```bash
#!/bin/bash
source /home/username/.config/kdesrc_kde_version # Contains VERSIONKDE=6 
echo "Using kde version $VERSIONKDE"

cd /home/username/kde"$VERSIONKDE"

export QT_LOGGING_RULES="somecategory*=true;...";
export QT_MESSAGE_PATTERN="...%{message}";

./kdesrc-run $@
```
and similarly for the kdesrc-build. I can then easily switch between builds (for kde5 and kde6), while still be able to invoke kdesrc-build/run directly, without the need to go to corresponding folder or specifying the kdesrc-buildrc path.

TIL that there is an Arch package for kdesrc-build. Mentioned that in wiki.