From 2b860c5de498d0e5b61d1f97a0faa751d26a0ac6 Mon Sep 17 00:00:00 2001 From: Roberto Ricci Date: Sat, 31 Jan 2026 17:50:45 +0100 Subject: [PATCH] sanoid: fix runtime warnings "print() on closed filehandle FH at /usr/local/bin/sanoid line 1797" It's harmless but annoying because it causes cron to send an email. --- .../sanoid/patches/file_handle_conflict.patch | 58 +++++++++++++++++++ srcpkgs/sanoid/template | 2 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/sanoid/patches/file_handle_conflict.patch diff --git a/srcpkgs/sanoid/patches/file_handle_conflict.patch b/srcpkgs/sanoid/patches/file_handle_conflict.patch new file mode 100644 index 00000000000000..f59732e85bcdc8 --- /dev/null +++ b/srcpkgs/sanoid/patches/file_handle_conflict.patch @@ -0,0 +1,58 @@ +https://github.com/jimsalterjrs/sanoid/commit/393a4672e5695af5a5a8c82faed455e5689e0c69 +https://github.com/jimsalterjrs/sanoid/pull/1071 +diff --git a/sanoid b/sanoid +index 4a71319..ce31f18 100755 +--- a/sanoid ++++ b/sanoid +@@ -1084,11 +1084,9 @@ sub init { + @datasets = getchilddatasets($config{$section}{'path'}); + DATASETS: foreach my $dataset(@datasets) { + if (! @cachedatasets) { +- push (@updatedatasets, $dataset); ++ push (@updatedatasets, "$dataset\n"); + } + +- chomp $dataset; +- + if ($zfsRecursive) { + # don't try to take the snapshot ourself, recursive zfs snapshot will take care of that + $config{$dataset}{'autosnap'} = 0; +@@ -1691,7 +1689,7 @@ sub getchilddatasets { + my $getchildrencmd = "$mysudocmd $zfs list -o name -t filesystem,volume -Hr $fs |"; + if ($args{'debug'}) { print "DEBUG: getting list of child datasets on $fs using $getchildrencmd...\n"; } + open FH, $getchildrencmd; +- my @children = ; ++ chomp( my @children = ); + close FH; + + # parent dataset is the first element +@@ -1781,25 +1779,25 @@ sub addcachedsnapshots { + + copy($cache, "$cache.tmp") or die "Could not copy to $cache.tmp!\n"; + +- open FH, ">> $cache.tmp" or die "Could not write to $cache.tmp!\n"; ++ open my $fh, ">> $cache.tmp" or die "Could not write to $cache.tmp!\n"; + while((my $snap, my $details) = each(%taken)) { + my @parts = split("@", $snap, 2); + + my $suffix = $parts[1] . "\tcreation\t" . $details->{time} . "\t-"; + my $dataset = $parts[0]; + +- print FH "${dataset}\@${suffix}\n"; ++ print $fh "${dataset}\@${suffix}\n"; + + if ($details->{recursive}) { + my @datasets = getchilddatasets($dataset); + + foreach my $dataset(@datasets) { +- print FH "${dataset}\@${suffix}\n"; ++ print $fh "${dataset}\@${suffix}\n"; + } + } + } + +- close FH; ++ close $fh; + + # preserve mtime of cache for expire check + my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat($cache); diff --git a/srcpkgs/sanoid/template b/srcpkgs/sanoid/template index 36d2acc64a117c..6e5e936896f9e5 100644 --- a/srcpkgs/sanoid/template +++ b/srcpkgs/sanoid/template @@ -1,7 +1,7 @@ # Template file for 'sanoid' pkgname=sanoid version=2.3.0 -revision=1 +revision=2 depends="perl perl-Config-IniFiles perl-Capture-Tiny" short_desc="Policy-driven snapshot management tool for ZFS filesystems" maintainer="Benjamin Slade "