MEGA65 / mega65-rom-public

MEGA65 ROM public issue reporting
4 stars 0 forks source link

Source and target filename can be the same in the COPY command #174

Closed jwa1974 closed 1 month ago

jwa1974 commented 1 month ago

Test Environment (required) You can use MEGA65INFO to retrieve this.

Describe the bug When doing a file COPY, where source and target filenames are the same (on the same disk), no error will be issued. The copy will be done, ending up with two files with the same name. Only if copying a second time, with the same names, a "FILE EXISTS" will be issued. Also, the documentation states the names must be different.

To Reproduce Steps to reproduce the behavior:

  1. Start with a clean disk (image or internal).
  2. Save a test file, eg: DSAVE "FILE".
  3. Do a copy: COPY "FILE" TO "FILE" -> No error!
  4. A DIR will reveal two files with the same name!
  5. Do another copy: COPY "FILE" TO "FILE" -> 63,FILE EXISTS,00,00

Expected behavior The command should issue an error when source and target filenames are the same (on the same disk) the first time.

Screenshots copy_bug

Additional context None.

dansanderson commented 1 month ago

I confirmed that this is actually a bug in the virtual disk driver, not the COPY command. Migrating this to: https://github.com/MEGA65/mega65-core/issues/842

The disk device itself is responsible for file duplications. BASIC is just issuing the DOS "C" command. This works as expected for external IEC disk drives.