Use new mkdir_p helper in install_files
authorJacob Bachmeyer <jcb@gnu.org>
Sat, 5 Nov 2022 20:34:43 +0000 (15:34 -0500)
committerJacob Bachmeyer <jcb@gnu.org>
Sat, 5 Nov 2022 20:34:43 +0000 (15:34 -0500)
Instead of using File::Path or invokgin the system mkdir, we now emulate
"mkdir -p" using about 5 lines of Perl elsewhere in the script.

gatekeeper.pl

index e085635eb3edc795ed5f63024f5285c6304438e2..48778586e1616ebac651ac9e6bcb704ef9d70a27 100755 (executable)
@@ -2406,8 +2406,9 @@ sub install_files {
 
   our $Stage_dir; our $Public_dir;
 
+  my @directory = File::Spec::Unix->splitdir($header->{directory});
   my $destdir = File::Spec->catdir
-    ($Public_dir, File::Spec::Unix->splitdir($header->{directory}));
+    ($Public_dir, @directory);
   my $install_as = $step->[1];
 
   my $upload_file = $header->{filename};
@@ -2419,13 +2420,7 @@ sub install_files {
   my $final_upload = File::Spec->catfile($destdir, $install_as);
   my $final_signature = File::Spec->catfile($destdir, $install_as.'.sig');
 
-  # File::Path is 200 lines of Perl and requires reading an external
-  # text file.  In my mind, it is a toss-up as to whether that or
-  # forking the system mkdir is safer.  We could debate endlessly,
-  # change it if you like, let's move on ...
-  my @mkdir_args = ("/bin/mkdir", "-p", $destdir);
-  system (@mkdir_args);
-  -d $destdir or fatal("no directory $destdir",1);
+  mkdir_p $Public_dir, @directory;
 
   my $notification_str = '';