[BUG] shortcut.present not idempotent, icon_location still broken
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
file.shortcut was broken (see #53706)
The bug was closed as fixed with PR #62025
I migrated stuff to use the new shortcut.present and it's failing badly.
Simple test state:
test_user_shortcut:
shortcut.present:
- name: 'C:\Users\someuser\Desktop\test_user.url'
- target: 'https://google.com/'
- icon_location: 'c:\test.ico'
test_public_shortcut:
shortcut.present:
- name: 'C:\Users\public\Desktop\test_public.url'
- target: 'https://yahoo.com/'
- icon_location: 'c:\test.ico'
To run it, stick a valid icon at c:\test.ico and adjust the c:\users\someuser path to point to your account.
Run the state.
The icons are created, but the icon isn't applied.
Notice the salt output that shows things like the icon target being C:\Program Files\Salt Project\Salt\https:\yahoo.com and yet if you right-click the icon and go to 'properties' it points to https://yahoo.com and works properly. Also notice the salt output strips one of the forward slashes from https://.
If you manually set the icon on the 'user' shortcut, it works just fine.
If you try to manually set the icon on the 'public' shortcut, it errors out with: "Cannot apply changes to this Internet Shortcut".
Running the state again produces an error:
Failed to create the shortcut: C:\Users\public\Desktop\test_public.url Found existing shortcut
It shouldn't be an error that the shortcut exists, just like...say....file.managed doesn't error out on the state application because it created the file during the first run.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Windows state using shortcut.present with the two .url paths and a valid icon at c:\test.ico. Start by locating the shortcut.present implementation and compare its first and repeated runs, including icon_location handling. Done means existing shortcuts do not fail on reapplication, the target remains intact, and the icon is applied correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100