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

End of sketch lost after "Save As" #1798

Closed
3 tasks done
ednieuw opened this issue Jan 4, 2023 · 3 comments
Closed
3 tasks done

End of sketch lost after "Save As" #1798

ednieuw opened this issue Jan 4, 2023 · 3 comments
Labels
conclusion: duplicate Has already been submitted conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@ednieuw
Copy link

ednieuw commented Jan 4, 2023

Describe the problem

When I develop a program I regularly save the script with a new filename containing the version number.

From the first version of the IDE 2.0 I have had problems with Save As such as:

  • Sketch being saved in the Arduino sketch root folder.
  • IDE freezing during a save./
  • Part of the sketch being lost.

I experienced the problem of the last part of the sketch being lost when using Arduino IDE 2.0.3.

I attached the last compilations of version RP2040-WordClockV018b and the damaged file RP2040-WordClockV019.

Before doing the "Save As" operation, I saw that the V018b filename had a lot of, probably, temporary characters after the V018b like RP2040-WordClockV018b344uiy32i4ui3 or something like that

To reproduce

I have no idea to reproduce this.

I compile for an Arduino Nano RP2040 Connect with the standard Arduino board settings.

Autosave is off because I regularly save the file manually.

Expected behavior

No sketch contents are lost after doing a "Save As" operation.

Arduino IDE version

2.0.3

Operating system

Windows

Operating system version

11

Additional context

I attached the ZIP with the last compilation temp files:

Temp.zip

  • arduino-language-server1763127236: contains the last complete "V018b" sketch file before the "Save As" operation to produce the "V019" version.
  • arduino-language-server3607719326: contains the damaged "V019" sketch file.

I regularly put the PC in Hibernation or in Sleep then taking a pause for myself


I did not test with the nightly built

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
@ednieuw ednieuw added the type: imperfection Perceived defect in any part of project label Jan 4, 2023
@per1234 per1234 changed the title SaveAs looses end of sketch End of sketch lost after "Save As" Jan 4, 2023
@per1234 per1234 added the topic: code Related to content of the project itself label Jan 4, 2023
@per1234
Copy link
Contributor

per1234 commented Jan 4, 2023

Hi @ednieuw. Thanks for your report.

I attached the last compilations of version RP2040-WordClockV018b and the damaged file RP2040-WordClockV019.

I think you forgot to attach the "damaged file RP2040-WordClockV019"

It is not clear to me why you chose to include the temporary files generated by Arduino IDE instead of the permanent sketch folders. These files are only intended to be used internally by the Arduino Language Server and Arduino Firmware Uploader, rather than directly by the user. The user is expected to only directly interact with the permanent sketch files produced by Arduino IDE's "Save As" and "Save" operations. Do you use these files directly? If yes, please describe how you use them.

@ednieuw
Copy link
Author

ednieuw commented Jan 5, 2023 via email

@per1234
Copy link
Contributor

per1234 commented Nov 23, 2023

I see we received another report of this bug later, which received more discussion: #2086

The cause of that bug was identified and fixed by #2027. I checked the files you provided:

$ stat --printf="%s" arduino-language-server1763127236/sketch/RP2040-WordClockV018b.ino.cpp 

111016

$ stat --printf="%s" arduino-language-server3607719326/sketch/RP2040-WordClockV019.ino.cpp 

70321

From this I can see that the symptoms you reported here match very well with those reported in #2086

So I will close this as fixed. The fix was first introduced in the Arduino IDE 2.2.0 release so you should not encounter this problem when using Arduino IDE versions 2.2.0 or newer. If you are still experiencing this fault, please comment here and I'll investigate further.

Thanks again for reporting this serious bug @ednieuw. I apologize for not having found the time to look into this before now.

@per1234 per1234 closed this as completed Nov 23, 2023
@per1234 per1234 added conclusion: duplicate Has already been submitted conclusion: resolved Issue was resolved labels Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: duplicate Has already been submitted 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

No branches or pull requests

2 participants