Skip to content

Commit

Permalink
Fix for scanned directories not showing in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-theunsub committed Jan 26, 2024
1 parent a72664c commit ea3e42f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
3 changes: 2 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
CHANGELOG for ClamTk:

6.18 - 20240120
6.18 - 20240126
---------------
* Remove unnecessary line from #154 fix in App.pm
* Change default clamtk user directory to .config/clamtk (Github #161)
* Fix for scanned directories not showing in logs
* Add top-level heading to README.md
* Add af, ca, eu, and lt to desktop file
* Fix Punjabi (pa) string in desktop file
Expand Down
1 change: 0 additions & 1 deletion lib/Results.pm
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ sub show_window {
#<<<
my $i = 0;
while ( $i <= scalar keys %$hash ) {
# print 'name = ', $hash->{ $i }->{ name }, "\n";
my $iter = $liststore->append;
$liststore->set(
$iter,
Expand Down
26 changes: 14 additions & 12 deletions lib/Scan.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ my $found; # Holds information of bad stuff found

my $found_count = 0; # Scalar number of bad stuff found
my $num_scanned = 0; # Overall number of files scanned
my %dirs_scanned; # Directories scanned
my $dirs_scanned; # Directories scanned

my $hb; # HeaderBar
my $pb; # ProgressBar
Expand Down Expand Up @@ -367,6 +367,10 @@ sub scan {
#>>>
# binmode( $SCAN, ':utf8:bytes' );

# This is a placeholder for use in keeping track of
# directories scanned
my $dirname;

Gtk3::main_iteration while Gtk3::events_pending;
while ( <$SCAN> ) {
chomp;
Expand All @@ -379,11 +383,15 @@ sub scan {

if ( /^Scanning (.*?)$/ ) {
my $base = decode( 'UTF-8', basename( $1 ) );
$dirname = decode( 'UTF-8', dirname( $1) );

# Lots of temporary things under /tmp/clamav;
# we'll just ignore them.
$dirs_scanned->{ $dirname } = 1;

# Display stuff in popup infobar
set_infobar_text(
$topbar,

# sprintf( _( 'Scanning %s...' ), $dirname )
sprintf( _( 'Scanning %s...' ), $base )
);
Expand Down Expand Up @@ -424,7 +432,6 @@ sub scan {
chomp( $file ) if ( defined $file );
chomp( $status ) if ( defined $status );

my $dirname = decode( 'UTF-8', dirname( $file ) );
my $fileparse = decode( 'UTF-8', fileparse( $file ) );

my $hidden = ClamTk::Prefs->get_preference( 'ScanHidden' );
Expand All @@ -437,12 +444,6 @@ sub scan {
$dirparse = $dirname;
}

# Lots of temporary things under /tmp/clamav;
# we'll just ignore them.
$dirs_scanned{ $dirname } = 1
unless ( dirname( $file ) =~ /\/tmp\/clamav/
|| dirname( $file ) eq '.' );

# Do not show files in archives - we just want the end-result.
# It still scans and we still show the result.
next if ( $file =~ /\/tmp\/clamav/ );
Expand Down Expand Up @@ -473,7 +474,7 @@ sub scan {
}

Gtk3::main_iteration while Gtk3::events_pending;

# Done scanning - close filehandle and return to
# filter() and then to clean-up
close( $SCAN ); # or warn "Unable to close scanner! $!\n";
Expand Down Expand Up @@ -536,7 +537,8 @@ sub reset_stats {
$found_count = 0;
$pb_file_counter = 0;
$pb_step = 0;
%dirs_scanned = ();
$dirs_scanned = ();
$found = ();
$stopped = 1;
$directive = '';
$root_scan = FALSE;
Expand Down Expand Up @@ -577,7 +579,7 @@ sub logit {

#<<<
# sort the directories scanned for display
my @sorted = sort { $a cmp $b } keys %dirs_scanned;
my @sorted = sort { $a cmp $b } keys %$dirs_scanned;
if ( open $REPORT, '>>:encoding(UTF-8)', $virus_log ) {
print $REPORT "\nClamTk, v",
ClamTk::App->get_TK_version(), "\n",
Expand Down

0 comments on commit ea3e42f

Please sign in to comment.