grub4dos
grub4dos copied to clipboard
grub4dos dd bug
F1 and F2 have same contents

!BAT
raw cmp /f1 /f2 && echo F1 is SAME as F2
raw dd if=(hd0,0)/f2 of=(md)0x3000+511
raw dd if=(md)0x3000+511 of=(md)0x3000+511 bs=1 skip=6 seek=12
raw dd if=(md)0x3000+511 of=(md)0x3000+511 bs=1 skip=12 seek=6
raw dd if=(md)0x3000+511 of=(hd0,0)/f2
raw cmp /f1 /f2 && echo F1 is SAME as F2
!BAT
raw cmp /f1 /f2 && echo F1 is SAME as F2
raw dd if=(hd0,0)/f2 of=(md)0x3000+511 bs=1
raw dd if=(md)0x3000+511 of=(hd0,0)/f2 bs=1
raw cmp /f1 /f2 && echo F1 is SAME as F2

This works OK

!BAT
raw cmp /f1 /f2 && echo F1 is SAME as F2
raw dd if=(hd0,0)/f2 of=(md)0x3000+511
raw dd if=(md)0x3000+511 of=(md)0x20000+511 bs=1 skip=6 seek=12
raw dd if=(md)0x20000+511 of=(md)0x3000+511 bs=1 skip=12 seek=6
raw dd if=(md)0x3000+511 of=(hd0,0)/f2
raw cmp /f1 /f2 && echo F1 is SAME as F2
Works if use 2nd buffer area
!BAT
raw cmp /f1 /f2 && echo F1 is SAME as F2
raw dd if=(hd0,0)/f2 of=(md)0x3000+511 bs=1
raw dd if=(md)0x3000+511 of=(md)0x3000+511 bs=1 skip=0 seek=1
raw dd if=(md)0x3000+511 of=(md)0x3000+511 bs=1 skip=1 seek=0
raw dd if=(md)0x3000+511 of=(hd0,0)/f2 bs=1
raw cmp /f1 /f2 && echo F1 is SAME as F2

!BAT
raw cmp /f1 /f2 && echo F1 is SAME as F2
raw dd if=(hd0,0)/f2 of=(md)0x3000+511 bs=1
raw dd if=(md)0x3000+511 of=(md)0x3000+511 bs=1 skip=0 seek=16
raw dd if=(md)0x3000+511 of=(md)0x3000+511 bs=1 skip=16 seek=0
raw dd if=(md)0x3000+511 of=(hd0,0)/f2
raw cmp /f1 /f2 && echo F1 is SAME as F2
raw cat --hex --skip=65520 --length=0x40 /f1
raw cat --hex --skip=65520 --length=0x40 /f2

Same issue in grub4efi

使用dd移动数据,一般是从一个文件到另一个文件。在同一个文件内移动数据,如果缓存够大,超过文件尺寸,可以一次移动完毕。当缓存不够大,需要多次移动时,尤其是向后移动,dd函数不能使用。应当使用复制函数。
reading/writing to a different file is OK The following code using files works OK
!BAT
raw dd if=(bd)/f0 of=(bd)/f1
raw dd if=(bd)/f0 of=(bd)/f2
raw cmp /f1 /f2 && echo F1 is SAME as F2
raw dd if=(bd)/f1 of=(bd)/f2 bs=1 skip=0 seek=16
raw dd if=(bd)/f2 of=(bd)/f1 bs=1 skip=16 seek=0
raw cmp /f1 /f0 && echo F1 is SAME as F0
raw cat --hex --skip=65520 --length=0x40 /f1
raw cat --hex --skip=65520 --length=0x40 /f0
Are you saying there is a 64k limit when moving memory backwards (including the skip/seek offset)? If so, shouldn't the dd code test for this case and report an error? 'Error: backwards memory move limit exceeded'
This code which uses the same file as if and of fails with same error at 64k boundary
!BAT
raw dd if=(bd)/f0 of=(bd)/f1
raw dd if=(bd)/f0 of=(bd)/f2
raw cmp /f1 /f2 && echo F1 is SAME as F2
raw dd if=(bd)/f1 of=(bd)/f1 bs=1 skip=0 seek=16
raw dd if=(bd)/f1 of=(bd)/f1 bs=1 skip=16 seek=0
raw cmp /f1 /f0 && echo F1 is SAME as F0
raw cat --hex --skip=65520 --length=0x40 /f1
raw cat --hex --skip=65520 --length=0x40 /f0

尝试修复,请测试. BOOTX64.rar.txt
memory seems to work OK, but error when using a file.
FAIL!!
OK
OK
我不明白你使用 dd 命令的目的是什么,但是 test3.g4d 的测试方法是错误的,结果永远是 FAIL! 比如 f1 的内容是: 11 11 11 11 11 11 11 11 - 11 11 11 11 11 11 11 11 22 22 22 22 22 22 22 22 - 22 22 22 22 22 22 22 22 33 33 33 33 33 33 33 33 - 33 33 33 33 33 33 33 33
执行 raw dd if=(bd)/f1 of=(bd)/f1 bs=1 skip=16 sddk=0 后,f1 的内容是: 11 11 11 11 11 11 11 11 - 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 - 11 11 11 11 11 11 11 11 22 22 22 22 22 22 22 22 - 22 22 22 22 22 22 22 22 注意: 33 33 33 33 33 33 33 33 - 33 33 33 33 33 33 33 33 这些数据被丢弃!
执行 raw dd if=(bd)/f1 of=(bd)/f1 bs=1 skip=0 sddk=16 后,f1 的内容是: 11 11 11 11 11 11 11 11 - 11 11 11 11 11 11 11 11 22 22 22 22 22 22 22 22 - 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 - 22 22 22 22 22 22 22 22 注意: 33 33 33 33 33 33 33 33 - 33 33 33 33 33 33 33 33 这些数据已经丢弃,不可能再复制到 f1 的第三行。
Yes, the last 16 bytes are expected to be different
but see actual result...

However, the first bytes are different which is not correct - offset 0 is different!
e.g. If we use a small file, we get expected result...

Note that error is at end of file, not at offset 0- so this is OK and expected.
如何重现test3.g4d? 方便的话,使用cat看看偏移0前后的变化。 也可能是cmp判断错误?

with debug

问题无法重现。测试正常。

2021-09-25
??? where is this version ???
就是9月24日版本
这是我从楼上下载的版本。

Very strange!
I test on USB drive.
I tested NTFS and FAT32 and VBOX5 and real system and USB HDD and USB Flash - all same result - did not copy!
The first dd command is not working?


我使用U盘启动后测试,是实体机,正常。不清楚你那里是怎么回事。
I am first booting to grubfm and then loading bootx64.efi grub4efi - would that make a difference? Could you do a test version of grub4dos for me to test?
What filesystem? NTFS? FAT32? FAT16?
我的U盘是FAT12。按说从哪里启动都应当是一样的,只要进入g4e环境。我怀疑有一条命令没有执行,就执行下一条命令了。我在调试g4e时,遇到过2次。一次是jpg图像解码错误,在一行代码后插入几微妙延时,才解决。
我的虚拟机是QEMU。难道是选择性地限制写操作?
Why not try real system?
I use vbox 5 and VMUB This is specifically written for vbox 5 and usb drives. Qemu will snapshot filesystem, it is not the same as real system.
虚拟机测试是使用QEMU。虚拟机在windows7环境。
真实机是U盘,没有进入操作系统 ,直接启动到grub4efi,是fat32分区。
虚拟机测试是使用QEMU。虚拟机在windows7环境。
真实机是U盘,没有进入操作系统 ,直接启动到grub4efi,是fat32分区。