Subject: Strange behaviour when using interactive vs non-interactive mode - is this a bug?

From: Adam Baxter <[email-masked]>
Date: Tue, 28 Jul 2015 08:20:59 -0700

Hi all,
With the following script and parted 3.2

#!/bin/bash
image=blank.img
dd if=/dev/zero of=$image bs=1M count=32
sync
cat <<-EOF | parted -s $image
        mklabel msdos
        mkpart primary ext2 0 100%
        set 1 boot on
EOF
sync
file $image

I see different results if parted is invoked with -s or without.

*With* -s, the call to file results in "blank.img: data" and there's no
partitions in the disk image.
*Without* -s,

Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)         mklabel msdos
(parted)         mkpart primary ext2 0 100%
Warning: The resulting partition is not properly aligned for best
performance.
(parted)         set 1 boot on
(parted) quit
blank.img: DOS/MBR boot sector; partition 1 : ID=0x83, active, start-CHS
(0x0,0,2), end-CHS (0x1ff,3,32), startsector 1, 65535 sectors

Removing the quit command makes no difference.

The script without -s will crash at least parted 2.3.

Thanks,
Adam Baxter