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

"Sketchbook" menu missing if sketch name is invalid regex #1600

Closed
3 tasks done
per1234 opened this issue Oct 29, 2022 · 2 comments · Fixed by #1622
Closed
3 tasks done

"Sketchbook" menu missing if sketch name is invalid regex #1600

per1234 opened this issue Oct 29, 2022 · 2 comments · Fixed by #1622
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 Oct 29, 2022

Describe the problem

The File > Sketchbook menu provides convenient access to the sketches the user has stored under their sketchbook folder.

During the population of this menu, the IDE processes each sketch name as a regular expression:

🐛 If a sketch with a name that happens to be an invalid regular expression is present in the sketchbook, the File > Sketchbook menu is missing.

To reproduce

  1. Select File > Save As... from the Arduino IDE menus.
  2. Save the sketch under the sketchbook folder with the name Foo
  3. Select File > Sketchbook from the Arduino IDE menus.
    🙂 The "Foo" sketch and any other sketches present in the sketchbook are listed in the menu.
  4. Select File > Save As... from the Arduino IDE menus.
  5. Save the sketch under the sketchbook folder with the name Bar++
  6. Select File from the Arduino IDE menus.

🐛 There is no File > Sketchbook menu.

Expected behavior

File > Sketchbook menu is populated with all valid sketches even if invalid sketches are also present in the sketchbook.

Arduino IDE version

2.0.1

Operating system

  • Windows
  • Linux

Operating system version

  • Windows 10
  • Ubuntu 20.04

Additional context

This issue is not about supporting non-compliant sketch names. I used File > Save As... in the demo in order to make it as simple as possible to reproduce this bug. However, even after the bug of the IDE allowing the creation of non-compliant sketch names (#1599) is fixed, the user may still create or find such sketches (which will become increasingly prevalent since the IDE allows their creation) in the wild. The IDE must handle the presence of such invalid sketches gracefully, rather than breaking.


One option for resolving the issue would be to escape the sketchName string for use in a regular expression, as done here:

https://stackoverflow.com/a/6969486/7059512


I bisected the introduction of the bug to 4c55807 / #1018 (does not occur with the build for cb50d3a)


Originally reported by @Willem43T at https://forum.arduino.cc/t/2-0-1-no-open-recent-menu-item/1046905/6

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 29, 2022
@kittaakos kittaakos self-assigned this Nov 3, 2022
kittaakos pushed a commit that referenced this issue Nov 3, 2022
Closes #1600

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit that referenced this issue Nov 7, 2022
Closes #1600

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
@ubidefeo
Copy link

ubidefeo commented Nov 9, 2022

This issue is also present when a fresh installation of IDE 2 is first launched.
The Documents/Arduino folder is created but being empty it won't populate the menu item, which, being long 0, is just hidden

@kittaakos
Copy link
Contributor

kittaakos commented Nov 9, 2022

The Documents/Arduino folder is created but being empty it won't populate the menu item, which, being long 0, is just hidden

The issue you are referring to is already logged here, @ubidefeo #569

I am going to revert your assignee changes. There is a PR #1622 for this task.

kittaakos pushed a commit that referenced this issue Nov 10, 2022
Closes #1600

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos pushed a commit that referenced this issue Nov 10, 2022
Closes #1600

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
@per1234 per1234 added the conclusion: resolved Issue was resolved label Nov 10, 2022
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.

4 participants