The nano editor does the following when saving a file myfile.txt:
First try to delete the myfile.bak file using MOS_del. This call fails when myfile.bak does not exist, but the program proceeds.
Then try to rename myfile.txt to myfile.bak using MOS_ren. This call fails when myfile.txt does not exist, but the program proceeds. In any of those cases, myfile.txt no longer exists (it did not exist in the first place or it got renamed).
Then use MOS_save to save the file. This call fails if myfile.txt already exists.
In MOS 2.2.1, when myfile.txt did not exist already, the file is saved as expected.
When myfile.txt already exists, the save fails. The rename operation did not take place (myfile.bak was not created) and the delete operation did succeed (any old myfile.bak as deleted).
Note: this error condition only occurs when the machine has run autoexec.txt at startup, even when this autoexec.txt is an empty file. Nano can save normally when no autoexec.bin was present at all.
2.2.2 appears to have solved this issue now.
This appeared to be a bug with uninitialized variables when mos_REN checked if the destination was a directory or not.
The nano editor does the following when saving a file myfile.txt:
In MOS 2.2.1, when myfile.txt did not exist already, the file is saved as expected. When myfile.txt already exists, the save fails. The rename operation did not take place (myfile.bak was not created) and the delete operation did succeed (any old myfile.bak as deleted).
Note: this error condition only occurs when the machine has run autoexec.txt at startup, even when this autoexec.txt is an empty file. Nano can save normally when no autoexec.bin was present at all.