It occurs to me that I never included a demo of how to create an artificial space problem for testing purposes. Here is such a script; requires root on a modern linux system.
#!/bin/sh # script to demo problem of perl not detecting write errors with -pi # requires root on a linux system IMG=/root/floppy.img IMG_DIR=/root IMG_SIZE=1440 BS=1024 SOURCE=/dev/zero MOUNTPOINT=/mnt MKFS_ARGS="-t ext2" MOUNT_ARGS="-o loop" FILE=bar FILE_SIZE=900 cd / && mkdir -p $IMG_DIR && dd if=$SOURCE of=$IMG bs=$BS count=$IMG_SIZE && mkfs $MKFS_ARGS $IMG </dev/null && mount $MOUNT_ARGS $IMG $MOUNTPOINT && cd $MOUNTPOINT && dd if=$SOURCE of=$FILE bs=$BS count=$FILE_SIZE && echo before running perl: && df -k . && ls -l bar* && echo Running perl. . . && perl -pi~ -e 1 $FILE echo Done. Status is: $? && df -k . && ls -l bar* # clean up regardless of status cd /; umount $MOUNTPOINT; rm $IMG
