Calling a shell command is a security hole if $path contains special characters (e.g. "${foo}"). Observed in http://hydra.nixos.org/build/4041321.
D4QVCQUSU2W2GWCCI2SLCLM2QO3OYJ5QLGPKXSMZ6XUVIDW6PCTQC
$sha1 = `nix-hash --flat --type sha1 $path`
or die "cannot hash $path: $?";;
chomp $sha1;
$sha256 = `nix-hash --flat --type sha256 $path`
or die "cannot hash $path: $?";;
chomp $sha256;
$sha1 = hashFile("sha1", 0, $path);
$sha256 = hashFile("sha256", 0, $path);