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

Virtual disk DOS same-device "copy" command allows same source and filename once #842

Open
dansanderson opened this issue Oct 23, 2024 · 0 comments
Labels
new New report, not classified yet

Comments

@dansanderson
Copy link
Collaborator

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

  • Platform: MEGA65R6
  • Core Commit: Release v0.96
  • ROM Release: 920408

Describe the bug
Migrated from MEGA65/mega65-rom-public#174 filed against the ROM. This is actually a bug in the virtual disk driver.

The DOS "copy" command can duplicate a file on the same disk by providing the original file name and the new file name. If the new file name exists, including in the case where the new file name is the same as the original file name, DOS returns a File Exists error.

This does not work correctly for D81 disk images and the internal floppy drive. When the new name is the same as the original name, the virtual disk device will allow duplicating the file into a new entry with the same name the first time. It only reports File Exists when this process is repeated.

To Reproduce
This was noticed with the BASIC COPY command, but it can also be reproduced by issuing the "C" command directly to the device command channel. The BASIC COPY command delegates to the device DOS for same-device copies.

  1. Mount a D81 disk image (MOUNT "DISK.D81"), or mount the internal floppy drive with a disk inserted (MOUNT), on unit 8.
  2. Create a file, e.g. 10 PRINT "HI" / DSAVE "TEST". Use DIR to confirm that only one copy of this file appears in the directory.
  3. COPY "TEST" TO "TEST"

Expected: The command prints a File Exists disk error, and does not perform the copy.
Actual: The command succeeds. DIR reports that there are two copies of the file with the same name on the disk. Repeating step #3 subsequently has the expected behavior.

This can also be reproduced by issuing a command to the disk command channel: OPEN 15,8,15,"C0:TEST=TEST"

I confirmed that this does not happen on an external IEC disk drive, e.g. OPEN 15,11,15,"C0:TEST=TEST" returned the File Exists error the first time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new New report, not classified yet
Projects
None yet
Development

No branches or pull requests

1 participant