flameshot icon indicating copy to clipboard operation
flameshot copied to clipboard

Save Path Changes and Causes Error Randomly

Open Cboughton opened this issue 10 months ago • 16 comments

Flameshot Version

Flameshot v12.1.0 (Debian 12.1.0-build2) Compiled with Qt 5.15.12

Installation Type

AppImage, Linux, MacOS, or Windows Package manager (apt, pacman, eopkg, choco, brew, ...)

Operating System type and version

Xubuntu 24.04.2 LTS

Description

Save path in the configuration is randomly changed to a folder that does not exist. Initial save path set as /tmp. After some time flameshot displays an error and the save path is changed to /tmp/cal.

Steps to reproduce

No response

Screenshots or screen recordings

No response

System Information

Xubuntu 24.04.2 LTS

Cboughton avatar Feb 17 '25 18:02 Cboughton

can you also share your flameshot.ini config file. It should be in ~/.config/flameshot/.

Also, please always take time and fill the requested information in the form. You left major parts out. Bug reports that are not filled properly are invalid, especially if we don't have the information that we need to reproduce the issue.

mmahmoudian avatar Feb 18 '25 03:02 mmahmoudian

Thank you. I apologize about the missing information. I am happy to get you anymore you need. Before the path changes [General] buttons=@Variant(\0\0\0\x7f\0\0\0\vQList\0\0\0\0\x18\0\0\0\0\0\0\0\x1\0\0\0\x2\0\0\0\x3\0\0\0\x4\0\0\0\x5\0\0\0\x6\0\0\0\x12\0\0\0\xf\0\0\0\x16\0\0\0\x13\0\0\0\a\0\0\0\b\0\0\0\t\0\0\0\x10\0\0\0\n\0\0\0\v\0\0\0\r\0\0\0\x17\0\0\0\xe\0\0\0\f\0\0\0\x11\0\0\0\x14\0\0\0\x15) checkForUpdates=false contrastOpacity=188 disabledTrayIcon=false drawThickness=10 ignoreUpdateToVersion=12.1.0 savePath=/tmp

After the path changes [General] buttons=@Variant(\0\0\0\x7f\0\0\0\vQList\0\0\0\0\x18\0\0\0\0\0\0\0\x1\0\0\0\x2\0\0\0\x3\0\0\0\x4\0\0\0\x5\0\0\0\x6\0\0\0\x12\0\0\0\xf\0\0\0\x16\0\0\0\x13\0\0\0\a\0\0\0\b\0\0\0\t\0\0\0\x10\0\0\0\n\0\0\0\v\0\0\0\r\0\0\0\x17\0\0\0\xe\0\0\0\f\0\0\0\x11\0\0\0\x14\0\0\0\x15) checkForUpdates=false contrastOpacity=188 disabledTrayIcon=false drawThickness=10 ignoreUpdateToVersion=12.1.0 savePath=/tmp/cal

Cboughton avatar Feb 18 '25 17:02 Cboughton

Just to make sure, this is your entire configuration file right? You have no filenamePattern etc. set?

FelixJochems avatar Feb 18 '25 20:02 FelixJochems

That is correct.

Cboughton avatar Feb 19 '25 19:02 Cboughton

Is there anymore information needed?

Cboughton avatar Mar 05 '25 21:03 Cboughton

How did you install ?

borgmanJeremy avatar Mar 10 '25 23:03 borgmanJeremy

sudo apt install flameshot

Cboughton avatar Mar 11 '25 15:03 Cboughton

I made a quick VM and clean install Xubuntu 24.04 and tried the following:

sudo apt update \
&& sudo apt upgrade \
&& sudo apt install flameshot \
&& reboot # just in case

and when the VM booted, I opened a terminal and ran flameshot and then went to config, it shows the ~/Pictures/ and also when I click on the tray icon and take a screenshot, it by default goes to ~/Pictures/ too. Therefore, I could not reproduce the issue.

Image

@Cboughton Can you provide some further information on how this can be reproduced? Does it happen after every reboot, or after any specific event?

mmahmoudian avatar Mar 12 '25 12:03 mmahmoudian

@Cboughton Maybe you could use inotify to see when the config file changes, and what process is changing it?

borgmanJeremy avatar Mar 12 '25 12:03 borgmanJeremy

@Cboughton You can use this example if you don't know how to work with what @borgmanJeremy suggested:

sudo apt install inotify-tools

touch ~/flameshot-config-change.log \
&& inotifywait --daemon \
               --outfile ~/flameshot-config-change.log \
               --timefmt '%Y-%m-%d %H:%M:%S' \
               --format '[%T] %w  -  %e%n' \
               --event modify \
               ~/.config/flameshot/flameshot.ini

What this does is that:

  1. installs the inotify-tools to ease your usage
  2. create a log file names ~/flameshot-config-change.log
  3. using inotifywait, create a daemon that in the background looks for the changes to ~/.config/flameshot/flameshot.ini and stores them with date and time in the log file

You can monitor the log file using tail -f '~/flameshot-config-change.log' and it will produce and output like the following if the file is modified:

[2025-03-12 15:40:57] /home/mm/.config/flameshot/flameshot.ini  -  MODIFY

mmahmoudian avatar Mar 12 '25 13:03 mmahmoudian

I have not been able to find a trigger for this. It happens at random intervals and is not dependent on reboots. I have set up inotify to monitor when the config file changes and will update when I have more information.

Cboughton avatar Mar 12 '25 14:03 Cboughton

I've checked the code that would be able to change the savePath. Aside from the configuration manager it's only here which only takes the directory of the saved file and sets it as the savepath. I can't figure out how this would trigger without specifically being called and showing a GUI.

Unfortunately we will have to wait for it to happen again so that we can see if it's caused by flameshot itself.

FelixJochems avatar Mar 18 '25 20:03 FelixJochems

The save path was changed again at 16:30 on 2025-05-14. Theese are the logs from 16:37 2025-05-14

[2025-05-14 07:15:03] /home/X/.config/flameshot/flameshot.ini - OPEN

[2025-05-14 07:15:03] /home/X/.config/flameshot/flameshot.ini - ACCESS

[2025-05-14 07:15:03] /home/X/.config/flameshot/flameshot.ini - CLOSE_NOWRITE,CLOSE

[2025-05-14 12:42:14] /home/X/.config/flameshot/flameshot.ini - OPEN

[2025-05-14 12:42:14] /home/X/.config/flameshot/flameshot.ini - ACCESS

[2025-05-14 12:42:14] /home/X/.config/flameshot/flameshot.ini - CLOSE_NOWRITE,CLOSE

[2025-05-14 13:42:45] /home/X/.config/flameshot/flameshot.ini - OPEN

[2025-05-14 13:42:45] /home/X/.config/flameshot/flameshot.ini - ACCESS

[2025-05-14 13:42:45] /home/X/.config/flameshot/flameshot.ini - CLOSE_NOWRITE,CLOSE

[2025-05-14 14:36:05] /home/X/.config/flameshot/flameshot.ini - OPEN

[2025-05-14 14:36:05] /home/X/.config/flameshot/flameshot.ini - ACCESS

[2025-05-14 14:36:05] /home/X/.config/flameshot/flameshot.ini - CLOSE_NOWRITE,CLOSE

Cboughton avatar May 19 '25 14:05 Cboughton

Does it say which process opened and modified it? If not is there a way to enable that?

Edit: and were you actively using flameshot at the time?

borgmanJeremy avatar May 19 '25 21:05 borgmanJeremy

It does not say which process opened and modified it.

I'm not sure when the change occurred either as it was noticed at 16:30 when a screen shot was attempted. I am reporting this for a client and have limited informaiton.

Cboughton avatar May 20 '25 15:05 Cboughton

@Cboughton I think if you are on a systemd machine you can use auditctl:

# to see the status (first line tells you if it is enabled
sudo auditctl -s

# add the rule for watching the flameshot.ini for user X on write and attribute changes
sudo auditctl -a always,exit -F arch=b64 -F path=/home/X/.config/flameshot/flameshot.ini -F perm=wa

# list the rules and confirm ours is added
sudo auditctl -l

Now, if the auditctl was not enabled, but enable it:

sudo auditctl -e 1

and if the auditd.service is not running, start that too:

sudo systemctl start auditd.service

and in theory you should be able to see the logs using ausearch and filtering by file path:

sudo ausearch -f /home/X/.config/flameshot/flameshot.ini

and at the end when you are done, just delete the rules:

sudo auditctl -D

Disclaimer: I tried to get it working on my computer on a test file, but I didn't manage to get it working. Here are the sources I used:

  • https://www.redhat.com/en/blog/configure-linux-auditing-auditd - Containes old syntax of auditctl, but if you are on an old distro this might still work
  • https://linux-audit.com/linux-audit-framework/configuring-and-auditing-linux-systems-with-audit-daemon/
  • https://www.namehero.com/blog/getting-started-with-auditctl-on-linux/
  • https://commandmasters.com/commands/auditctl-linux/ - I found this the most comprehensive

mmahmoudian avatar May 29 '25 16:05 mmahmoudian