From 0e0eab8b274b31a545b0ca0e6b2bf61a0f70a815 Mon Sep 17 00:00:00 2001
From: Gerhard Gonter <ggonter@gmail.com>
Date: Fri, 29 Nov 2024 18:43:56 +0100
Subject: [PATCH] check tar files for problems

---
 hacks/misc/chktar.pl | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100755 hacks/misc/chktar.pl

diff --git a/hacks/misc/chktar.pl b/hacks/misc/chktar.pl
new file mode 100755
index 0000000..4beeac9
--- /dev/null
+++ b/hacks/misc/chktar.pl
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+
+use strict;
+use IPC::Run;
+
+my @FILES;
+while (defined (my $arg= shift(@ARGV)))
+{
+  if ($arg =~ /^-/)
+  {
+    die;
+  }
+  else
+  {
+    push (@FILES, $arg);
+  }
+}
+
+foreach my $fnm (@FILES)
+{
+  test_tar($fnm);
+}
+
+exit;
+
+sub test_tar
+{
+  my $fnm= shift;
+  my @cmd= ('tar', '-tvf', $fnm);
+  my $tar_output;
+  my $tar_input;
+  my $tar_stderr;
+
+  my $rc= IPC::Run::run(\@cmd, \$tar_input, \$tar_output, \$tar_stderr);
+  # my $rc= system(@cmd);
+  print __LINE__, " cmd=[", join(' ', @cmd), "]\n";
+  print __LINE__, " rc=[$rc]\n";
+  # print __LINE__, " tar_output=[$tar_output]\n";
+  print __LINE__, " tar_stderr=[$tar_stderr]\n";
+
+  $rc;
+}
+
+
-- 
GitLab