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

Error: Failed to parse /tmp/493767530.kglobalshortcutsrc #95

Closed
3 of 4 tasks
elbowz opened this issue Mar 12, 2024 · 7 comments
Closed
3 of 4 tasks

Error: Failed to parse /tmp/493767530.kglobalshortcutsrc #95

elbowz opened this issue Mar 12, 2024 · 7 comments
Labels
question Further information is requested

Comments

@elbowz
Copy link

elbowz commented Mar 12, 2024

What exactly are you trying to do?

I'm doing something wrong...simply try to add kglobalshortcutsrc:

$ chezmoi_modify_manager --add ~/.config/kglobalshortcutsrc
$ cat ~/.local/share/chezmoi/dot_config/modify_private_kglobalshortcutsrc
#!/usr/bin/env chezmoi_modify_manager

source auto

# Add your ignores and transforms here

ignore regex "ActivityManager" "switch-to-activity-.*"
transform regex ".*" ".*" kde_shortcut```

Where else have you checked for solutions?

  • I have read the README
  • I have read the output of chezmoi_modify_manager --help-syntax and
    chezmoi_modify_manager --help-transforms (if relevant to my question).
  • I have checked that chezmoi_modify_manager --doctor doesn't list any
    issues that need to be resolved (or I need help resolving those issues).
  • Other, please give details.

Output of any commands you've tried

$ chezmoi apply                                                          
Error: Failed to parse /tmp/1804387465.kglobalshortcutsrc

Caused by:
    Invalid transform specified: kde_shortcut: Matching variant not found
chezmoi: exit status 1

Output of chezmoi_modify_manager --doctor

$ chezmoi_modify_manager --doctor
RESULT    CHECK                MESSAGE
Info      version              3.1.2
Info      build                Other builder, identifies as: aur
Info      rustc-version        1.76.0
Info      host                 os=linux, arch=x86_64, info=Arch Linux Rolling Release [64-bit]
Ok        has-chezmoi          Chezmoi found. Version: chezmoi version v2.47.1, built at 2024-03-03T07:35:20Z
Ok        chezmoi-override     CHEZMOI_MODIFY_MANAGER_ASSUME_CHEZMOI_VERSION is not set
Ok        in-path              chezmoi_modify_manager is in PATH at /usr/bin/chezmoi_modify_manager
Ok        has-ignore           Ignore of **/*.src.ini found
Ok        no-hook-script       No legacy hook script found

Output of chezmoi doctor:
RESULT    CHECK                       MESSAGE
warning   version                     v2.47.1, built at 2024-03-03T07:35:20Z
ok        latest-version              v2.47.1
ok        os-arch                     linux/amd64 (Arch Linux)
ok        uname                       Linux bblock 6.7.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 08 Mar 2024 01:59:01 +0000 x86_64 GNU/Linux
ok        go-version                  go1.22.0 (gc)
ok        executable                  /usr/bin/chezmoi
ok        config-file                 ~/.config/chezmoi/chezmoi.toml, last modified 2023-05-23T14:41:24+02:00
warning   source-dir                  ~/.local/share/chezmoi is a git working tree (dirty)
ok        suspicious-entries          no suspicious entries
warning   working-tree                ~/.local/share/chezmoi is a git working tree (dirty)
ok        dest-dir                    ~ is a directory
ok        umask                       022
ok        cd-command                  found /bin/zsh
ok        cd-args                     /bin/zsh
info      diff-command                not set
ok        edit-command                found /usr/bin/nvim
ok        edit-args                   /usr/bin/nvim
ok        git-command                 found /usr/bin/git, version 2.44.0
ok        merge-command               found /usr/bin/nvim
ok        shell-command               found /bin/zsh
ok        shell-args                  /bin/zsh
info      age-command                 age not found in $PATH
ok        gpg-command                 found /usr/bin/gpg, version 2.4.5
info      pinentry-command            not set
info      1password-command           op not found in $PATH
info      bitwarden-command           bw not found in $PATH
info      bitwarden-secrets-command   bws not found in $PATH
info      dashlane-command            dcli not found in $PATH
info      doppler-command             doppler not found in $PATH
info      gopass-command              gopass not found in $PATH
ok        keepassxc-command           found /usr/bin/keepassxc-cli, version 2.7.7
info      keepassxc-db                not set
info      keeper-command              keeper not found in $PATH
info      lastpass-command            lpass not found in $PATH
info      pass-command                pass not found in $PATH
info      passhole-command            ph not found in $PATH
info      rbw-command                 rbw not found in $PATH
info      vault-command               vault not found in $PATH
info      vlt-command                 vlt not found in $PATH
info      secret-command              not set

Thanks

@elbowz elbowz added the question Further information is requested label Mar 12, 2024
@VorpalBlade
Copy link
Owner

VorpalBlade commented Mar 12, 2024

  1. Assuming it is not just a copy-paste error when posting to here:

    transform regex "." "." kde_shortcut```

Those trailing backquotes shouldn't be there.

  1. The actual transform is called kde-shortcut with a dash. I see the examples.md was wrong. I will fix this. Thanks for finding this!

@VorpalBlade
Copy link
Owner

Feel free to reach back out if you still can't get it to work.

@elbowz
Copy link
Author

elbowz commented Mar 14, 2024

I prefer to append here further information, because the environment/sate and actions taken are unchanged (same modify_* file taken from your examples.md)...make me know if I have to open a new issue.

When I try to apply the new dotfiles (ie. chezmoi apply) on a third machine, I get:

[chezmoi_modify_manager WARN] Overlapping regex matches for ActivityManager/switch-to-activity-56274a72-0b6e-4047-a116-237fda170f36, first action taken

What is it mean?

Furthermore, I had to delete the file .config/kglobalshortcutsrc to have a full sync (ie. delete old present entries in the local file) . Is it a desired behavior?

I mean, that I had in the local kglobalshortcutsrc file some old entries for Krohnkite (removed in KDE6), no more present in the private_kglobalshortcutsrc.src.ini, but after the chezmoi apply these shortcuts still remain in the file.

Thanks!

edit:

$ head -n 4 .config/kglobalshortcutsrc
[ActivityManager]
_k_friendly_name=Activity Manager
switch-to-activity-56274a72-0b6e-4047-a116-237fda170f36=none,none,Switch to activity "Default"

$ head -n 3 .local/share/chezmoi/dot_config/private_kglobalshortcutsrc.src.ini
[ActivityManager]
_k_friendly_name=Activity Manager

$ cat .local/share/chezmoi/dot_config/modify_private_kglobalshortcutsrc
#!/usr/bin/env chezmoi_modify_manager

source auto

ignore regex "ActivityManager" "switch-to-activity-.*"
transform regex ".*" ".*" kde-shortcut

@VorpalBlade
Copy link
Owner

When I try to apply the new dotfiles (ie. chezmoi apply) on a third machine, I get:

[chezmoi_modify_manager WARN] Overlapping regex matches for ActivityManager/switch-to-activity-56274a72-0b6e-4047-a116-237fda170f36, first action taken

What is it mean?

This is about the lines:

ignore regex "ActivityManager" "switch-to-activity-.*"
transform regex ".*" ".*" kde-shortcut

I had forgotten that was also in the examples (not just my own config). Basically it means chezmoi_modify_manager (chmm for short, in retrospect I should have picked a shorter name to type!) found a key that matches multiple rules (the kde-shortcut transform, and the ignore).

It is picking and using the result of the "first" thing. That could be a bit of a gotcha (I ran into such a gotcha in another config), so that is why I added a warning. There are two problems here:

  1. "First thing" is not necessarily the same as "source order". Section rules are evaluated before keys for example. And in that case you won't even get a warning about it! Also literal rules are evaulated before regex-rules. Again you won't get a warning in that case I believe. So the warning is best-effort.
  2. Sometimes you want such a behaviour. Sometimes you would be helped by the warning.
  3. I didn't necessarily want to commit to a specific behaviour as guaranteed. I should think that through and come up with sensible semantics at some point.

So yes, something needs to be done to make this more user friendly. I need to think it through properly though. Maybe it shouldn't be a warning but you should have a debug mode where it would print warnings about such things?

Furthermore, I had to delete the file .config/kglobalshortcutsrc to have a full sync (ie. delete old present entries in the local file) . Is it a desired behavior?

That sounds weird. Not quite enough info to go on though. If you have some example on how to reproduce I would love to get this in a new issue though! Ideally I would need the old and the new ~/.config/kglobalshortcutsrc as well as your modify script (which you provided) as well as your kglobalshortcutsrc.src.ini file. Or if you don't want to provide the whole files, at least the sections that were affected by this bug.

@VorpalBlade
Copy link
Owner

Opened #99 about the regex match warning.

@elbowz
Copy link
Author

elbowz commented Mar 14, 2024

It is picking and using the result of the "first" thing. That could be a bit of a gotcha (I ran into such a gotcha in another config), so that is why I added a warning. There are two problems here:

I'm trying to understand your detailed explanation and logic behind...I'll answer in the new created issue.

That sounds weird. Not quite enough info to go on though. If you have some example on how to reproduce I would love to get this in a new issue though! Ideally I would need the old and the new ~/.config/kglobalshortcutsrc as well as your modify script (which you provided) as well as your kglobalshortcutsrc.src.ini file. Or if you don't want to provide the whole files, at least the sections that were affected by this bug.

Likewise, I'll try to reproduce the behavior, I still don't know if it's a bug or feature. I'm struggling with KDE6 these days ;)

Thanks for your time and answers!

@elbowz
Copy link
Author

elbowz commented Mar 15, 2024

Likewise, I'll try to reproduce the behavior, I still don't know if it's a bug or feature. I'm struggling with KDE6 these days ;)

Created the issue #100 to describe and reproduce the bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants