chenall / grub4dos

外部命令和工具源码:https://github.com/chenall/grubutils 下载:
http://grub4dos.chenall.net
GNU General Public License v2.0
629 stars 132 forks source link

Blocklist does not show partition in output if used on a partition #428

Open deomsh opened 9 months ago

deomsh commented 9 months ago

Grub4dos function blocklist does not show partition in output if used ON a partition. Last version I could find WITHOUT this behavior is grub4dos 20210602.

No problems on devices without partition. Also the start sector and the blocks in the blocklist are NOT the problem, problem is only output on screen (and in a script, if piped output to a variable is used).

In the first and second print-screen the 'bad' behavior is showed first, can be corrected manually by inserting partition number. In last print-screen the 'good' behavior is showed first (output already contains partition number). If partition number is left out 'bad' output is same as later versions of grub4dos.

GRUB4DOS 20230922 Blocklist (hd0)-SMALL71A IMG = (hd0)0x2672d9c+0x1680 NOTok, only with (hd0,0) OK GRUB4DOS 20210813 Blocklist (hd0)-SMALL71A IMG = (hd0)0x2672d9c+0x1680 NOT ok, only with (hd0,0) OK GRUB4DOS 20210602 Blocklist (hd0)-SMALL71A IMG = (hd0)0x2672d9c+0x1680 last version OK

yaya2007 commented 7 months ago

很正常,没有什么错误。是你使用的问题。

(hd0) 对应的磁盘 (hd0,0) 对应的分区

deomsh commented 7 months ago

If this is normal behavior, the partition offset should have been taken into account, which is not the case now with output '(hd0)-blocklist' In case of floppy/ram-disk and CD the output can be directly used for 'cat' (for instance). On partitioned devices this is not possible now.

But I can make following workaround for use in a variable (not needed if output shows the partition already, like old grub4dos version) :

blocklist (hd0,0)/GRLDR > (md)0x300+1 cat --skip=6 (md)0x300+1 | set blcklstB= set blcklstB=(hd0,0)%blcklstB%

So it is not a big deal!

Output showed:

image