drummerSupport icon indicating copy to clipboard operation
drummerSupport copied to clipboard

Steps for one type of file overwrite

Open PostMonsterG opened this issue 4 years ago • 5 comments

Steps to reproduce

  1. Create a new document called OutlineOverwriteTest.opml
  2. Put some text in there
  3. Add this line dialog.about (http.readUrl ("http://scripting.com/states.opml"), "States outline")
  4. Execute it
  5. Expand one of the nodes in the dialog outline
  6. Wait for Drummer to save

Drummer will have just saved states.opml into OutlineOverwriteTest.opml.

To verify,

  1. Close Drummer's browser window without dismissing the dialog
  2. Reopen Drummer

When you reopen Drummer, the tab has been renamed states.opml and the contents are the states outline.

Notes

  • If you dismiss the dialog at step 7 (instead of quitting), Drummer will re-save the correct contents of OutlineOverwriteTest.opml over the previously-saved incorrect version. So you won't notice that the file temporarily had the wrong contents.
  • I think expanding the node in the dialog states outline may be what triggers the overwrite. If I let Drummer sit there without touching any of the controls, it doesn't look like it attempts to save.

PostMonsterG avatar Jan 08 '22 06:01 PostMonsterG

I'm able to reproduce this, both on Web Drummer and Electric Drummer.

I made a quick screencast. You can see the tab text change to 'states.opml' behind the dialog when the node is expandend, and back to 'overwriteTest' right after the dialog closes. Here's the console output.

code.js:1008  saveThisTab: f == overwriteTest.md, secs == 0.264, secs since interact == 1.647
scripting.js:46 runScriptText: processedScriptText == (async function () {await processRunCursorScriptResult(await dialog.about(await http.readUrl('http://scripting.com/states.opml'), 'States outline'), 0);})()
verbs.js:1267 Using proxy server.
code.js:1543 servercall: url == http://drummer.scripting.com/httpreadurl?url=http%3A%2F%2Fscripting.com%2Fstates.opml&oauth_token=XXXX&oauth_token_secret=XXXX, secs == 0.198
code.js:4115 myExpandCallback: type == undefined
code.js:1008 saveThisTab: f == overwriteTest.md, secs == 0.239, secs since interact == 0.042
code.js:1008 saveThisTab: f == overwriteTest.md, secs == 0.234, secs since interact == 7.037

https://user-images.githubusercontent.com/8681117/148674549-2e4d5e06-4280-4b1b-88e4-fa378a101cb8.mp4

scotthansonde avatar Jan 09 '22 08:01 scotthansonde

I read the report a couple of times, carefully, watched @scotthansonde video, and did the test myself twice.

i just read the report again, it seems that if you close drummer while the dialog.about dialog is open it will have overwritten the file with the states outline.

scripting avatar Jan 09 '22 16:01 scripting

Okay I think I understand what's going wrong, but I don't know yet what the fix is. I have to spend some time thinking about it.

scripting avatar Jan 09 '22 16:01 scripting

@PostMonsterG, @scotthansonde -- I think I have the problem fixed.

http://scripting.com/drummer/blog/2022/01/09/235613.html?title=changedHowAutosaveWorks

So please verify that it is fixed. Knock wood. ;-)

However on the way to fixing it I spotted another problem, this one only cosmetic. While the dialog is open the crumbtrail updates, and when you close the dialog, the crumb trail is still incorrect. Moving the cursor fixes it.

Unfortunately the same thing that fixed the overwriting problem will not fix the crumb trail. As before I will think about this offline.

Thank you @PostMonsterG for persevering. I like getting rid of problems like this. :-)

scripting avatar Jan 10 '22 00:01 scripting

For me it's fixed. The underlying tab never changes when clicking in the dialog, reloading Drummer with the dialog open does not change the original outline.

scotthansonde avatar Jan 10 '22 04:01 scotthansonde