From 555b33881e340bb65808eaf3f2d334f08b0c6246 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 10 Aug 2020 02:12:04 +0000 Subject: convert: check ARGV more correctly Instead of silently ignoring excessive args, don't let a user specify an extra directory. Furthermore, we'll support the odd case where BOFH wants to name an $INBOX_DIR to be `0' :P --- script/public-inbox-convert | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'script/public-inbox-convert') diff --git a/script/public-inbox-convert b/script/public-inbox-convert index c9075207..275857fa 100755 --- a/script/public-inbox-convert +++ b/script/public-inbox-convert @@ -45,8 +45,9 @@ GetOptions($opt, qw(jobs|j=i index! help|?), bad command-line args\n$usage EOF if ($opt->{help}) { print $help; exit 0 }; -my $old_dir = shift(@ARGV) or die $usage; -my $new_dir = shift(@ARGV) or die $usage; +my $old_dir = shift(@ARGV) // ''; +my $new_dir = shift(@ARGV) // ''; +die $usage if (scalar(@ARGV) || $new_dir eq '' || $old_dir eq ''); die "$new_dir exists\n" if -d $new_dir; die "$old_dir not a directory\n" unless -d $old_dir; -- cgit v1.2.3-24-ge0c7