joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.81k stars 383 forks source link

XCOPY doesn't preserve long filenames when copying files in DOS env #5196

Open rayrapetyan opened 2 months ago

rayrapetyan commented 2 months ago

Describe the bug

XCOPY command replaces part of the filename with the "~" symbol for all files with long names it copies over.

Steps to reproduce the behaviour

  1. Mount CD ISO containing folder with long filenames as E: and FAT32 HDD image as D:
  2. While in DOS mode, run:
    XCOPY E:\Game D:\Game /I /E /Y /H

    Actual: E:\Game\Loc35\001_ROD_01.WAV copied as D:\Game\Loc35\001_RO~3.WAV

Expected behavior

File E:\Game\Loc35\001_ROD_01.WAV should be copied as D:\Game\Loc35\001_ROD_01.WAV

What operating system(s) this bug have occurred on?

Debian Bookworm

What version(s) of DOSBox-X have this bug?

2024.03.01

Used configuration

[sdl]
autolock=true
output=opengl
showmenu=false

[dosbox]
title=Windows 98
memsize=128

[video]
vmemsize=8
vesa modelist width limit=0
vesa modelist height limit=0

[dos]
ver=7.1
hard drive data rate limit=0
floppy drive data rate limit=0

[cpu]
cputype=pentium_mmx
core=normal

[sblaster]
sbtype=sb16vibra

[fdc, primary]
int13fakev86io=true

[ide, primary]
int13fakeio=true
int13fakev86io=true

[ide, secondary]
int13fakeio=true
int13fakev86io=true
cd-rom insertion delay=4000

[ide, tertiary]
enable=true
int13fakeio=true
int13fakev86io=true
cd-rom insertion delay=4000

[ide, quaternary]
enable=true
int13fakeio=true
int13fakev86io=true
cd-rom insertion delay=4000

[ide, quinternary]
enable=true
int13fakeio=true
int13fakev86io=true
cd-rom insertion delay=4000
irq=9
io=0110
altio=011F

[render]
scaler=none

[autoexec]
IMGMOUNT C "C"
IMGMOUNT D "D"
IMGMOUNT E "E" -t iso
IMGMOUNT F "F" -t iso
BOOT C:
EXIT

Output log

No response

Additional information

No response

Have you checked that no similar bug report(s) exist?

Code of Conduct & Contributing Guidelines

maron2000 commented 2 months ago

XCOPY is imported from FreeDOS which doesn't support Long file names. https://github.com/FDOS/xcopy

rayrapetyan commented 2 months ago

I see, thanks. Do you know if there is a pure-DOS copy implementation supporting long file names?

rayrapetyan commented 2 months ago

Looks like LCOPY from LFN tools works as expected in dosbox-x with disabled virtual memory flag, but is there something else, maybe more stable and mature? Also, since dosbox-x declares LFN support, why XCOPY was chosen?

rayrapetyan commented 2 months ago

Nope, LCOPY is failing to copy from mounted folder drives, it works only with image drives :(

rayrapetyan commented 2 weeks ago

For certain cases, e.g.:

LCOPY E:\*.avi D:\APP /V

LCOPY produces this:

LOG: CDROM: GetAudioTracks, stTrack=1, end=1, leadOut.min=56, leadOut.sec=15, leadOut.fr=55
LOG:    4614980 ERROR IOCTL:DOS:IOCTL Call 0D:4A Drive  3 volume/drive locking IOCTL, faking it
LOG: CPU_Exception: Exception 5 already in progress, triggering double fault instead
LOG: CPU_Exception: Double fault already in progress == Triple Fault. Resetting CPU.
LOG: Removing UMB block 0xcc00-0xdfff
LOG: Rebooting the system

Using /C option (disable cache) solves this issue. So in any case when using LCOPY in dosbox-x, always use /V and /C options, then it works pretty stable.