You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by si...@apache.org on 2022/05/05 13:15:01 UTC
svn commit: r1900586 - in /spamassassin/trunk/t: SATest.pm spamc_cf.t spamd_client.t spamd_plugin.t spamd_sql_prefs.t spamd_unix.t spamd_unix_and_tcp.t uri_list.t
Author: sidney
Date: Thu May 5 13:15:00 2022
New Revision: 1900586
URL: http://svn.apache.org/viewvc?rev=1900586&view=rev
Log:
bug 7986 Partial fix lets tests run when directory path up to 80 long. Use workdir, remove now obsolete mk_safe_tmpdir()
Modified:
spamassassin/trunk/t/SATest.pm
spamassassin/trunk/t/spamc_cf.t
spamassassin/trunk/t/spamd_client.t
spamassassin/trunk/t/spamd_plugin.t
spamassassin/trunk/t/spamd_sql_prefs.t
spamassassin/trunk/t/spamd_unix.t
spamassassin/trunk/t/spamd_unix_and_tcp.t
spamassassin/trunk/t/uri_list.t
Modified: spamassassin/trunk/t/SATest.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/SATest.pm?rev=1900586&r1=1900585&r2=1900586&view=diff
==============================================================================
--- spamassassin/trunk/t/SATest.pm (original)
+++ spamassassin/trunk/t/SATest.pm Thu May 5 13:15:00 2022
@@ -1005,42 +1005,6 @@ sub conf_bool {
return 0; # n or 0
}
-sub mk_safe_tmpdir {
- return $safe_tmpdir if defined($safe_tmpdir);
-
- my $dir = $workdir || File::Spec->tmpdir();
-
- # be a little paranoid, since we're using a public tmp dir and
- # are exposed to race conditions
- my $retries = 10;
- my $tmp;
- while (1) {
- $tmp = "$dir/satest.$$.".rand(99999);
- if (!-d $tmp && mkdir ($tmp, 0755)) {
- if (-d $tmp && -o $tmp) { # check we own it
- lstat($tmp);
- if (-d _ && -o _) { # double-check, ignoring symlinks
- last; # we got it safely
- }
- }
- }
-
- die "cannot get tmp dir, giving up" if ($retries-- < 0);
-
- warn "failed to create tmp dir '$tmp' safely, retrying...";
- sleep 1;
- }
-
- $safe_tmpdir = $tmp;
- return $tmp;
-}
-
-sub cleanup_safe_tmpdir {
- if ($safe_tmpdir) {
- rmtree($safe_tmpdir) or warn "cannot rmtree $safe_tmpdir";
- }
-}
-
sub wait_for_file_to_change_or_disappear {
my ($f, $timeout, $action) = @_;
Modified: spamassassin/trunk/t/spamc_cf.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamc_cf.t?rev=1900586&r1=1900585&r2=1900586&view=diff
==============================================================================
--- spamassassin/trunk/t/spamc_cf.t (original)
+++ spamassassin/trunk/t/spamc_cf.t Thu May 5 13:15:00 2022
@@ -15,7 +15,7 @@ plan tests => 4;
q{ X-Spam-Flag: YES}, 'flag',
);
-my $sockpath = mk_safe_tmpdir()."/spamd.sock";
+my $sockpath = $workdir."/spamd.sock";
start_spamd("-D -L --socketpath=$sockpath");
open (OUT, ">$workdir/spamc_cf.cf");
@@ -25,5 +25,4 @@ close OUT;
ok (spamcrun ("-F $workdir/spamc_cf.cf < data/spam/001", \&patterns_run_cb));
ok_all_patterns();
stop_spamd();
-cleanup_safe_tmpdir();
Modified: spamassassin/trunk/t/spamd_client.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_client.t?rev=1900586&r1=1900585&r2=1900586&view=diff
==============================================================================
--- spamassassin/trunk/t/spamd_client.t (original)
+++ spamassassin/trunk/t/spamd_client.t Thu May 5 13:15:00 2022
@@ -97,7 +97,7 @@ if (!$RUNNING_ON_WINDOWS) {
%anti_patterns = ();
- my $sockpath = mk_safe_tmpdir()."/spamd.sock";
+ my $sockpath = $workdir."/spamd.sock";
ok(start_spamd("-L --socketpath=$sockpath"));
$client = create_clientobj({
@@ -126,7 +126,6 @@ if (!$RUNNING_ON_WINDOWS) {
ok_all_patterns();
ok(stop_spamd());
- cleanup_safe_tmpdir();
}
if (HAS_SDBM_FILE) {
Modified: spamassassin/trunk/t/spamd_plugin.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_plugin.t?rev=1900586&r1=1900585&r2=1900586&view=diff
==============================================================================
--- spamassassin/trunk/t/spamd_plugin.t (original)
+++ spamassassin/trunk/t/spamd_plugin.t Thu May 5 13:15:00 2022
@@ -24,7 +24,7 @@ print COUNTER "0";
close COUNTER;
chmod (0666, "$workdir/spamd_plugin.tmp");
-my $sockpath = mk_safe_tmpdir()."/spamd.sock";
+my $sockpath = $workdir."/spamd.sock";
start_spamd("-D -L --socketpath=$sockpath");
%patterns = (
@@ -50,5 +50,4 @@ checkfile($spamd_stderr, \&patterns_run_
ok_all_patterns();
stop_spamd();
-cleanup_safe_tmpdir();
Modified: spamassassin/trunk/t/spamd_sql_prefs.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_sql_prefs.t?rev=1900586&r1=1900585&r2=1900586&view=diff
==============================================================================
--- spamassassin/trunk/t/spamd_sql_prefs.t (original)
+++ spamassassin/trunk/t/spamd_sql_prefs.t Thu May 5 13:15:00 2022
@@ -14,7 +14,7 @@ plan tests => 32;
# ---------------------------------------------------------------------------
-my $userprefdb = mk_safe_tmpdir()."/userpref.db";
+my $userprefdb = $workdir."/userpref.db";
my $dbh = DBI->connect("dbi:SQLite:dbname=$userprefdb","","");
ok($dbh);
@@ -85,7 +85,5 @@ ok_all_patterns();
ok(stop_spamd());
-cleanup_safe_tmpdir();
-
ok($dbh->disconnect());
Modified: spamassassin/trunk/t/spamd_unix.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_unix.t?rev=1900586&r1=1900585&r2=1900586&view=diff
==============================================================================
--- spamassassin/trunk/t/spamd_unix.t (original)
+++ spamassassin/trunk/t/spamd_unix.t Thu May 5 13:15:00 2022
@@ -20,10 +20,8 @@ tstprefs("
use_auto_whitelist 0
");
-my $sockpath = mk_safe_tmpdir()."/spamd.sock";
+my $sockpath = $workdir."/spamd.sock";
start_spamd("-D -L --socketpath=$sockpath");
ok (spamcrun ("-U $sockpath < data/spam/001", \&patterns_run_cb));
ok_all_patterns();
stop_spamd();
-cleanup_safe_tmpdir();
-
Modified: spamassassin/trunk/t/spamd_unix_and_tcp.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_unix_and_tcp.t?rev=1900586&r1=1900585&r2=1900586&view=diff
==============================================================================
--- spamassassin/trunk/t/spamd_unix_and_tcp.t (original)
+++ spamassassin/trunk/t/spamd_unix_and_tcp.t Thu May 5 13:15:00 2022
@@ -10,7 +10,7 @@ plan tests => 10;
# ---------------------------------------------------------------------------
-my $sockpath = mk_safe_tmpdir()."/spamd.sock";
+my $sockpath = $workdir."/spamd.sock";
start_spamd("-D -L --socketpath=$sockpath --port $spamdport -A $spamdhost -i $spamdhost");
%patterns = (
q{ Subject: There yours for FREE!}, 'subj',
@@ -42,5 +42,4 @@ ok (spamcrun ("< data/spam/gtube.eml", \
ok_all_patterns();
stop_spamd();
-cleanup_safe_tmpdir();
Modified: spamassassin/trunk/t/uri_list.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/uri_list.t?rev=1900586&r1=1900585&r2=1900586&view=diff
==============================================================================
--- spamassassin/trunk/t/uri_list.t (original)
+++ spamassassin/trunk/t/uri_list.t Thu May 5 13:15:00 2022
@@ -111,7 +111,7 @@ http://host5.example.com
http://host6.example.com
EOT
-my $tmpdir = mk_safe_tmpdir();
+my $tmpdir = $workdir;
for my $mail ($twoplus, $threeurls, $threeplus, $foururls, $fiveurls, $sixurls) {
my @urls = grep(/\bhttp:/m,$mail);
@@ -141,4 +141,3 @@ for my $mail ($twoplus, $threeurls, $th
}
}
-cleanup_safe_tmpdir();