a2stuff / a2d

Disassembly of the Apple II Desktop - ProDOS GUI
https://a2desktop.com
269 stars 20 forks source link

"files remaining" in delete dialog starts at 65535! #800

Closed jewettg closed 2 months ago

jewettg commented 2 months ago

Describe the bug When deleting a folder that contains files, and you confirm, the dialog box that appears showing the remaining files to delete, the "files remaining" value starts at 65535, and starts to count down, not showing the accurate number of files remaining.

To Reproduce Steps to reproduce the behavior:

  1. Start DeskTop
  2. Select a folder that contains files
  3. OA-Delete or drag to trash.
  4. Confirm you want to delete.
  5. The "total files to delete" and "files remaining" will appear and the "files remaining" will start at a value at 65535, and counts down.

Expected behavior A correct number of files remaining to be deleted to be displayed instead of the MAX_UNSIGNED_SHORT.

Screenshots snapshot_of_bug https://github.com/a2stuff/a2d/assets/17208818/a7e92f80-e124-45fc-8388-ed57752e09a1

System Details (please complete the following information):

Additional context Have not yet tested in v1.4. Will do that, and report back.

inexorabletash commented 2 months ago

Just to confirm - you have a IIc Plus with ROM 5X ?

inexorabletash commented 2 months ago

I'm unable to repro in either 1.3 or 1.4, although I don't have that exact hardware setup.

Your repro steps may not be sufficient; from the screenshot it looks like you may have copied DeskTop to the RAM disk before launching. If you execute directly off of one of the distribution disk images, does the same problem occur? If the folder is in the root of the drive, does the same problem occur? If the folder is not on your RamExpress does the same problem occur? If you are able to use one of the web-based emulators (see links at the tops of the release pages) it would help if you can identify any specific element of your setup or way that you're using DeskTop that's triggering the problem, e.g. is it specific to the directory structure, how A2D is launched, exact steps prior to deleting the folder, etc.

jewettg commented 2 months ago

Just to confirm - you have a IIc Plus with ROM 5X ?

Yes, I have an Apple //c+ (the one with the 3.5" drive) Yes, that is what I have installed (ROM 5x).

jewettg commented 2 months ago

This is purely cosmetic (the files do get deleted, no issues), and it will take me a little while to perform the steps you mentioned. I will try to get to it today. ..but work next week, so it depends. I will also try v1.4.

One thing, I think happens, this happens the 2nd time deleting files, not the first? Maybe? I was able to replicate it in my setup, as the video (linked) shows.

So desktop loads itself into the RAMDisk, and I am using the 1MB expansion in the //c+ as a RAM Disk, and that is where the Desktop folder is located. I put desktop.system in the root, and when I turn on my //c+, it boots directly to Desktop.

As for the files being deleted, it does not matter, it happens no matter where the files are located. I know this only b/c I was cleaning up, and deleting files all over the directory structure.

inexorabletash commented 2 months ago

Interesting... the count ("Are you sure you want to permanently delete 1 file?") is obviously incorrect as it then proceeds to recurse and delete multiple files, which is why the 16 bit count is wrapping from 0 down to 65535. Quite odd as the recursion code path is similar in both cases.

I can't reproduce in 1.3 even creating the same directory path (/Reboot/Apps/II.Write/Docs2 populated with sample media), albeit with an emulator.

While there were several bugs in 1.1 like this, I fixed a lot before 1.2 was released. My best guess at the moment is that there's a memory corruption happening - I fixed some of those in 1.3 and 1.4. So hopefully 1.4 fixes it?

inexorabletash commented 2 months ago

This was probably fixed by 6765e56544f60431b2926df3c4c0bc049a1985f1 in 1.4 - the repro likely involves a same-volume file move followed by a delete.

inexorabletash commented 2 months ago

Confirmed already fixed in 1.4. Minimal repro:

  1. Launch DeskTop.
  2. Open a window.
  3. Create folders A and B.
  4. Drag B onto A.
  5. Drag A to the trash.

In 1.3 the count shows 1 file, and decrements to 65,535.

In 1.4 the count shows 2 files, and decrements to 0.