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

Save fails silently when sketch out of sync with file system #2051

Closed
3 tasks done
per1234 opened this issue May 8, 2023 · 1 comment · Fixed by #2055
Closed
3 tasks done

Save fails silently when sketch out of sync with file system #2051

per1234 opened this issue May 8, 2023 · 1 comment · Fixed by #2055
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented May 8, 2023

Describe the problem

When the "Auto save" preference is disabled, any changes to a sketch made in the Arduino IDE editor are "staged" in memory until the user manually saves the sketch. The sketch file can be modified externally during that time. These conditions pose a danger of user data being lost when the sketch is saved.

When the user attempts to save the sketch under these conditions Arduino IDE detects the out of sync state and displays a dialog notifying the user of the situation and asking how to proceed:

image

🐛 If the user clicks the "YES" button in the dialog to indicate they wish to write the version of the sketch from the editor to disk, the write does not occur contrary to the user's directive.

To reproduce

  1. Select File > New Sketch from the Arduino IDE menus.
  2. Select File > Save As... from the Arduino IDE menus.
  3. Save the sketch with the name "UnsyncedSketch".
  4. Select File > Preferences from the Arduino IDE menus.
  5. Uncheck the box next to " Auto save"
  6. Click the OK button.
  7. Make an identifiable change to the sketch:
    // change made in IDE
    ❗ Do not save the sketch.
  8. Open UnsyncedSketch/UnsyncedSketch.ino in a text editor.
  9. Make an identifiable change to the sketch:
    // change made externally
  10. Save the file in the text editor.
  11. Select File > Save from the Arduino IDE menus.
    The "The file 'UnsyncedSketch.ino' has been changed on the file system." dialog opens.
  12. Click the YES button in the dialog.

🐛 The change made in the IDE editor is not saved to disk.
🐛 There is no indication to the user that their data was not saved other than the ("dirty" state indicator) remaining on the sketch tab.

Expected behavior

When the user directs Arduino IDE to write the sketch to disk, it does so.

Arduino IDE version

964ea3b

Operating system

Windows

Operating system version

11

Additional context

I bisected the regression to e4beb03 (does not occur with the build of the previous commit dafb245).


Nothing is printed to the logs when the save fails.

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels May 8, 2023
@kittaakos kittaakos self-assigned this May 8, 2023
@kittaakos
Copy link
Contributor

I bisected the regression to e4beb03 (does not occur with the build of the previous commit dafb245).

I think this is the breaking change 39ab836, and not dafb245.

Screen Shot 2023-05-09 at 11 00 21

kittaakos pushed a commit that referenced this issue May 9, 2023
Closes #2051

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit that referenced this issue May 9, 2023
Closes #2051

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit that referenced this issue May 9, 2023
Closes #2051

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit that referenced this issue May 11, 2023
Closes #2051

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
@per1234 per1234 added the conclusion: resolved Issue was resolved label May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants