| Summary: | mkdosfs produces identical serial numbers if called in quick succession | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | VIAVI_AB <andrea.biardi> |
| Component: | Other | Assignee: | unassigned |
| Status: | NEW --- | ||
| Severity: | normal | CC: | busybox-cvs |
| Priority: | P5 | ||
| Version: | 1.35.x | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Host: | Target: | ||
| Build: | |||
| Attachments: | patch | ||
Created attachment 9581 [details] patch (vanilla busybox 1.35 source) I'm using busybox to automate the creation of a virtual machine; part of this requires me to script something like this: #! /bin/sh sfdisk --quiet --wipe=always --wipe-partitions=always /dev/sda << EOF label: dos 1: type=0b, size=500M 2: type=0b, size=500M 3: type=0b, size=500M 4: type=0b, size=500M EOF mkdosfs /dev/sda1 mkdosfs /dev/sda2 mkdosfs /dev/sda3 mkdosfs /dev/sda4 lsblk -npr -o NAME,TYPE,UUID /dev/sda On a "modern" machine, the problem is that without a small (>= 1s) delay between the invocations of mkdosfs, all filesystems end up with the same serial number, which is undesirable (especially if those UUIDs end up in an /etc/fstab). Attached is a patch for consideration that attempts to use /dev/random first, falling back to the time-based mechanism in case /dev/random isn't accessible.