#1043251 fdisk: sfdisk output displays more partitions created than intended

Package:
fdisk
Source:
fdisk
Description:
collection of partitioning utilities
Submitter:
Date:
2023-08-09 13:39:05 UTC
Severity:
normal
Tags:
#1043251#5
Date:
2023-08-07 21:38:43 UTC
From:
To:
Dear Maintainer,

This dumpfile defines 3 partitions to be created:

```
label: gpt
unit: sectors
first-lba: 2048
sector-size: 512

1: size=512MiB, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B
2: size=512MiB, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
3: type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
```

Using sfdisk:
# sfdisk /dev/sdb <this.dump

The output is like this:

```
Checking that no-one is using this disk right now ... OK

Disk /dev/sdb: 100 MiB, 104857600 bytes, 204800 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
/dev/sdb1: Created a new partition 1 of type 'EFI System' and of size 10 MiB.
/dev/sdb2: Created a new partition 2 of type 'Linux filesystem' and of size 10 MiB.
/dev/sdb3: Created a new partition 3 of type 'Linux filesystem' and of size 78 MiB.
/dev/sdb4: Done.

New situation:
Disklabel type: gpt
Disk identifier: 21A415C2-8B45-9A40-B25E-4FBD0667FED4

Device     Start    End Sectors Size Type
/dev/sdb1   2048  22527   20480  10M EFI System
/dev/sdb2  22528  43007   20480  10M Linux filesystem
/dev/sdb3  43008 202751  159744  78M Linux filesystem

The partition table has been altered.
Syncing disks.
```

Notice this part:

```
/dev/sdb1: Created a new partition 1 of type 'EFI System' and of size 10 MiB.
/dev/sdb2: Created a new partition 2 of type 'Linux filesystem' and of size 10 MiB.
/dev/sdb3: Created a new partition 3 of type 'Linux filesystem' and of size 78 MiB.
/dev/sdb4: Done.
```

The /dev/sdb4 is not supposed to be there. It appears sfdisk is reusing the partition counter for line numbers.

If this is an upstream bug, please forward it on my behalf, I cannot github from where I live.

Thank you!