I'm using Geany 1.30.1 on Windows 7.
After happily editing a file over some time, suddenly Geany refuses to save it with this error message: ![capture_20170522_133456](https://cloud.githubusercontent.com/assets/6795665/26307308/310c7900-3ef4-11...)
I know that Windows sometimes grabs a lock on a file when I'm just looking at it with another tool, but I am pretty sure that the only way I'm operating on this file since the last bootup of my machine, is by editing it in Geany. Still, for the safe side, I run the [Handle](https://technet.microsoft.com/en-us/sysinternals/bb896653) utility to see whether someone has a handle to either the file or the directory where the file is in - nothing. I also used Geany's "File/Properties" to check, whether maybe the file secretly became readonly; this is also not the case. Finally I turned on the gio_unsafe_save_backup and tried again, but same result. Note that it is a local file, so there can't be network issues involved either.
Then I tried "save as" with "rename", to store it under a new name in the same directory. This was refused with the same error message. I could see that the file got renamed, but still had the old content. This is weird: If the cause would be a directory lock, the rename should ALSO have failed.
Needless to say that it is not a disk space problem either.
I resolved the problem temporarily by using the following strategy:
1. Using "Save as" to save it to a completely different directory. 2. Copying the file back (on the command line) 3. Closing the Buffer in Geany 4. Reopening it
I then checked with my remaining open files in Geany. Modifying the buffer and saving, caused the same error with two of the files, while it worked fine with two others. One of the two where the error occured too, belonged to a different directory, while all the others - including those which could be saved - belonged to the same directory as the file where the problem occured initially.
I don't see yet in what respect the two files which did not have the problem, differed significantly from the two files where the problem occured.
Closing Geany, starting it, and I can continue editing like normal, but my feeling is that it will be only a question of time until the problem occurs again. Is there anything I can do to help the Geany developers to nail down the cause of this strange problem?
I am not a windows expert, but a couple of questions/suggestions.
The number one is, are you running any plugins? And if you are, does the problem occur when you run with no plugins?
I presume you retried the save and the "permission denied" continued after you had checked that nobody had a handle on the file?
Are you using windows native dialogs or GTK dialogs? And does the problem occur when you try the other? I vaguely remember something about dialogs having locks on files or directories because they read the metadata to populate the dialog.
IIRC the `gio_unsafe_save_backup` needs `use_gio_unsafe_file_saving` set as well.
Does the problem occur if you have neither `use_atomic_file_saving` nor `use_gio_unsafe_file_saving` nor `gio_unsafe_save_backup` set?
(1) The number one is, are you running any plugins?
I'm not aware of. I have installed Geany today, and did not fiddle around with Plugins. Of course, it might be that Geany, out of the box, uses some Plugins which need to be disabled. In any case, the settings have a checkmark in "use plugins". If the pane which shows the map of my functions, is displayed by a plugin, then I would conclude that at least this plugin is running alongside.
(2) I presume you retried the save and the "permission denied" continued after you had checked that nobody had a handle on the file?
Of course, and, as I said, I for sure did not do anything with this file from a different program. Plus, the error occured on 3 files out of 5. And, I could save these files earlier in the same edit session.
(3) Are you using windows native dialogs or GTK dialogs?
They are GTK dialogs. I have now changed the settings to use Windows dialogues, but honestly, I like the GTK ones better.
(4) Does the problem occur if you have neither use_atomic_file_saving nor use_gio_unsafe_file_saving nor gio_unsafe_save_backup set?
Yes, the other ones were disabled as well, but this didn't have any influence.
I wonder whether the problem might be related to a temporary directory or backup directory. Is Geany using some of them under the hood, maybe in my Windows Profile Data space? This is certainly an area which Geany should better keep its fingers off....
ADDITIONAL NOTE: After continuing to edit my files (after restarting Geany) for maybe 15 minutes, the error occured again. It is not possible to save the file.
Unfortunately, this version of Geany is not usable for me. I will therefore switch to a different editor, BUTif one of the Geany maintainers wants me to try out something, I will of course turn back to Geany, because I want to help to find the bug.
I have installed Geany today, and did not fiddle around with Plugins.
Ok, if its a new install and you didn't enable any plugins in `Tools->Plugin Manager` then there should be none running, but maybe just check none are enabled in plugin manager.
Of course, and, as I said, I for sure did not do anything with this file from a different program. Plus, the error occured on 3 files out of 5. And, I could save these files earlier in the same edit session.
Thats fine, we have to check the obvious first :)
I have now changed the settings to use Windows dialogues, but honestly, I like the GTK ones better.
Let us know if the problem still occurs, the GTK dialogs are not something we build so I don't know what they do, but I know they run extra threads, so maybe they trawl the filesystem to pre-load the dialogs, and I think I remember somewhere reports of them holding locks on stuff.
I wonder whether the problem might be related to a temporary directory or backup directory.
Other than its config directory that is saved in your user data (see `Help->Debug Messages` 4-5 down says where) Geany itself doesn't fiddle with files other than your explicit save and load, but some plugins do, hence the first question.
Unfortunately, this version of Geany is not usable for me. I will therefore switch to a different editor, BUTif one of the Geany maintainers wants me to try out something, I will of course turn back to Geany, because I want to help to find the bug.
I presume that means the windows dialogs didn't help :(
I know that there are some who use Geany on windows without problems, not sure if its 7 though, think its 10. Maybe they can provide some more suggestions on that might be unusual about your system.
I presume that means the windows dialogs didn't help :(
This is correct.
If someone could provide me a special, instrumented version, which logs what is going on during saving, I could run it until the problem occurs again, and then send the logs.
I use it on Windows 7 and Windows 10 without this problem. All files I edit are local on the disk and both machines have my one user as an administrator. Not sure it helps.
Just for some rainy day reading see my PHD thesis on saving files in Geany on the [wiki](https://wiki.geany.org/config/all_you_never_wanted_to_know_about_file_saving).
If someone could provide me a special, instrumented version, which logs what is going on during saving, I could run it until the problem occurs again, and then send the logs.
As the wiki article says, two of the three saving methods are from libraries that we don't control, so there is not much that can be done to see what is going on there. The third saving method is so simple that there is nothing to log, it exits on the first error and gives you a failure dialog.
The error message in German in your OP does not seem to be one of ours, suggesting that you were running one of the library saving methods when that occurred. Our message says "Failed to open file '%s' for writing: fopen() failed: %s", and the German translation also contains the "fopen()" part which is missing in the dialog you posted. Please make very sure that you have all three of the options `use_atomic_file_saving` and `use_gio_unsafe_file_saving` and `gio_unsafe_save_backup` turned off.
Finally thank you for continuing to help track the problem down, as you understand, until we can replicate it we can't do anything to fix it.
I am new to geany, and I use it to update html and php files for my server, and I ran into the same issue. I searched online and no luck, then I tried the "sudo chmod 775 filename.xxx" (xxx could stand for php, js, or whatever type of file). This allowed the file to execute when being called from the browser. I was also able to "sudo nano filename.xxx"
So i decided to try the command "sudo geany" which prompted for my password as usual when you use sudo and it worked. I was able to save.
So using the command geany assumes you're logged in as root, and if you are, you shouldn't have permission issues, but if not, you need to "sudo " into geany
"sudo nano filename.xxx"
If you have to sudo to edit the file you have your protections wrong, you need to fix them, not override them by running editors as root.
To be clear, the Geany team does NOT recommend running Geany as root, it is an IDE and some of the things it does as part of a normal development cycle may be security or other risks when run as root. You have been warned and you are responsible for any damage that may occur.
"sudo nano filename.xxx"
I don't agree with the avoid-root-at-all-cost paranoia, but you can minimize the "danger" by running the editor as the actual user that owns the file with `sudo -u`. You can also avoid creating a new file with wrong ownership.
So using the command geany assumes you're logged in as root, and if you are, you shouldn't have permission issues, but if not, you need to "sudo " into geany
So what exactly was the issue?
I know this is old, but for the people coming here to fix the problem for themselves. You're probably saving in the "Geany" folder and trying to execute your file out of the folder. Try saving your file on your desktop.
I have the same issue on network drives that I created with Win-SSHFS on Windows 10. The problem does not arise with other editors.
Hello, I have just experienced the same problem today (after years of using Geany seamlessly). Can this be related to the fact that I have tried to input Unicode characters like "É" just before (unsuccessfully, by the way...), which I think I had never done before? At each attempt of file saving, I get a new file named .goutputstream-XXXXXX instead, with the content of the file I am trying to save. Yours, Maxime
@MaximeG-51 when you say "input unicode characters" do you mean in the file contents or the filename?
Hi, In the file contents. I tried to type Éduterre. The "Alt-144" method I use in other Windows applications did not work, so I tried the Ctrl-Shift-u method described in the Geany Help, to no success. The file name does not contain any accented character (not even those that are directly on my French keyboard). Yours, Maxime
Typing characters into the file is not part of this issue, if it failed to include the character it can have no effect on saving the file, but if you did manage to include it, and the Locale can't store it in the file encoding, then save will fail, but with a different message to that which this issues is about.
I suggest you start a new issue and provide full system details and messages.
Jaw2966 commented: " I know this is old, but for the people coming here to fix the problem for themselves. You're probably saving in the "Geany" folder and trying to execute your file out of the folder. Try saving your file on your desktop."
This suggestion worked fine for me and appeared to cure the problem.
I certainly don't want the files to be stored in the Geany folder, and the Desktop doesn't make even less sense, as this would leave my Desktop cluttered with icons for a file. As you can see from the screenshot of my original question, I have my project directories for storing the file. And I must add that meanwhile the error does not occur anymore. Either something was fixed in Geany, or there had been a Windows problem. Windows is really weird at times. For instance (this is not necessarily related to the problem I experienced back them), I do have an empty directory on Windows, which I had created long time ago, but can't delete - not even with admin rights.
I have this issue and found this thread today. I'm using a folder that is syncing, maybe network shares, onedrive, synology drive, or dropbox can all cause similar issues. It mostly happened when I tried to save two changes rapidly in a row. Maybe an unlikely root cause for OP, who checked for other handlers, but might be affecting others facing this.
After one collision where it can't save if I try again too quickly all of Geany crashes on Windows 11. Never encountered this on Windows 10 for whatever reason.
github-comments@lists.geany.org