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

Incorrect handling of changed case of sketch file name #482

Open
3 tasks done
DaveTur opened this issue Aug 16, 2021 · 8 comments
Open
3 tasks done

Incorrect handling of changed case of sketch file name #482

DaveTur opened this issue Aug 16, 2021 · 8 comments
Assignees
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@DaveTur
Copy link

DaveTur commented Aug 16, 2021

Describe the problem

Arduino IDE incorrectly displays redundant editor tabs after the user renames a secondary sketch file under the following conditions:

  • The sketch was opened in Arduino IDE at some point in time before the rename.
  • The file system is case insensitive (Windows and macOS).
  • The file was renamed using an external tool (e.g., file manager application, mv)
  • The new filename differs from the old one only in case.

🐛 The user will be confused by the presence of an editor tab for a file that no longer exists. They will not find any way to correct the situation via the Arduino IDE interface.
🐛 The bug can cause a loss of the user's sketch code.

To reproduce

  1. Select File > New Sketch from the Arduino IDE menus.
  2. Click the button on the right side of the editor toolbar.
  3. Select "New Tab" from the menu.
  4. In the "Name for new file" field, type Foo.ino
  5. Click the OK button.
  6. Select File > Save As... from the Arduino IDE menus.
  7. Save the sketch to any convenient location.
  8. Select File > Close from the Arduino IDE menus.
  9. Use your file browser or terminal software to rename the file Foo.ino in the sketch folder to foo.ino.
  10. Open the sketch in the Arduino IDE.
    🐛 The editor still contains a "Foo.ino" tab in addition to the expected "foo.ino" tab.
  11. Select File > Preferences from the Arduino IDE menus.
  12. Check the box next to "☐ Auto save".
  13. Click the OK button.
  14. Add some text to the "foo.ino" editor tab:
    // hello world
  15. Select the "Foo.ino" editor tab.
    😕 The editor does not contain the text that was added to the "foo.ino" editor tab.
  16. Type a character in the "Foo.ino" editor tab.
    🐛 An unexpected "The file 'Foo.ino' has been changed on the file system." dialog opens:
    image
  17. Click the No button.
  18. Type a character in the "Foo.ino" editor tab.
  19. Click the Yes button in the dialog.
  20. Select the "foo.ino" editor tab.
    🐛 The previous // hello world contents of the file have been replaced by the characters that were added to the "Foo.ino" editor tab.
  21. Select File > Preferences from the Arduino IDE menus.
  22. Uncheck the box next to " Auto save"
  23. Click the OK button.
  24. Add some text to the "foo.ino" editor tab:
    // foobar
  25. Select File > Save from the Arduino IDE menus.
    🐛 An unexpected "The file 'Foo.ino' has been changed on the file system." dialog opens.
  26. Click the Yes button.
    🐛 An unexpected "The file 'foo.ino' has been changed on the file system." dialog opens.
  27. Click the Yes button.
  28. Select the "foo.ino" editor tab.
    😕 The editor does not contain the text that was added to the "Foo.ino" editor tab.

Expected behavior

Editor tabs always reflect the actual sketch files.

Arduino IDE version

Original report

2.0.0-beta.10

Last verified with

69b7365

Operating system

  • Windows
  • macOS

Operating system version

  • Windows 11
  • macOS Ventura

Additional context

The bug does not apply to renaming using the editor tab control menu's "Rename" item because its dialog refuses to allow such a renaming (#2272).

Additional Reports

Workaround

  1. Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
  2. Select the "View: Reset Workbench Layout" command from the menu.

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 Oct 24, 2021
@ubidefeo

This comment was marked as outdated.

@per1234

This comment was marked as outdated.

@Lorandil

This comment was marked as duplicate.

@per1234 per1234 changed the title The file <file> has been changed on the file system Incorrect handling of changed case of sketch file name Jan 1, 2023
@per1234

This comment was marked as duplicate.

@Lorandil

This comment was marked as outdated.

@Lorandil

This comment was marked as outdated.

@HattonLe

This comment was marked as off-topic.

@HattonLe

This comment was marked as off-topic.

@arduino arduino locked as too heated and limited conversation to collaborators Jun 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

6 participants