Package: e2fsprogs
Version: 1.46.2-2
Severity: normal
File: /sbin/mke2fs
X-Debbugs-Cc: j...@joshtriplett.org

mke2fs with -E offset=N does not seem to take the offset into account
when checking the target to see if it seems to already contain
something. For instance:

/tmp$ truncate -s 1G disk.img
/tmp$ echo '8,+,L' | sfdisk --lock --no-reread --no-tell-kernel disk.img
Disk disk.img: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

>>> Created a new DOS disklabel with disk identifier 0x729c5118.
disk.img1: Created a new partition 1 of type 'Linux' and of size 1024 MiB.
disk.img2: Done.

New situation:
Disklabel type: dos
Disk identifier: 0x729c5118

Device     Boot Start     End Sectors  Size Id Type
disk.img1           8 2097151 2097144 1024M 83 Linux

The partition table has been altered.
/tmp$ mkfs.ext4 -E offset=4096 disk.img
mke2fs 1.46.2 (28-Feb-2021)
Found a dos partition table in disk.img
Proceed anyway? (y,N)



I deeply appreciate that mke2fs checks for existing data before
overwriting it, and I'd prefer to not just pass -F here. I think the
"plausible" checks should take the offset into account.


-- System Information:
Debian Release: 11.0
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 
'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: arm64

Kernel: Linux 5.12.8 (SMP w/4 CPU threads)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages e2fsprogs depends on:
ii  libblkid1    2.36.1-7
ii  libc6        2.31-12
ii  libcom-err2  1.46.2-2
ii  libext2fs2   1.46.2-2
ii  libss2       1.46.2-2
ii  libuuid1     2.36.1-7
ii  logsave      1.46.2-2

Versions of packages e2fsprogs recommends:
pn  e2fsprogs-l10n  <none>

Versions of packages e2fsprogs suggests:
pn  e2fsck-static  <none>
pn  fuse2fs        <none>
pn  gpart          <none>
ii  parted         3.4-1

-- no debconf information

Reply via email to