Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 821676 - sys-apps/smartmontools update-smart-drivedb doesn't kill it's gpg-agent and throws errors on systems with root on NFS
Summary: sys-apps/smartmontools update-smart-drivedb doesn't kill it's gpg-agent and t...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Low normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-04 14:02 UTC by ev
Modified: 2022-03-02 08:06 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ev 2021-11-04 14:02:43 UTC
I use smartd daemon on machines with root filesystem.

/usr/sbin/update-smart-drivedb doesn't kill it's gpg-agent process and tries to remove it's home dir (line 494).
On NFS it doesn't work. Directory cannot be removed because nfs preserves delete open sockets/files. (script would have to rm -rf the directory twice)

This error causes stderr message which creates additional mail (false positive) when cron is configured to send mail. 

This small patch kills the gpg-agent and allows for error free $gnupgtmp deletion. 
-c backup /usr/sbin/update-smart-drivedb
*** backup	2021-11-04 14:29:14.665707108 +0100
--- /usr/sbin/update-smart-drivedb	2021-11-04 14:31:08.927219722 +0100
***************
*** 491,496 ****
--- 491,497 ----
      echo "$out" >&2
    fi
  
+   kill $(ps aux | awk '$11=="gpg-agent" && /smartmontools/{print $2}')
    rm -f -r "$gnupgtmp"
    return $r


Reproducible: Always

Steps to Reproduce:
1. run /etc/cron.monthly/smartmontools-update-drivedb on machine with root on NFS
Actual Results:  
LC_ALL=C /etc/cron.monthly/smartmontools-update-drivedb
rm: cannot remove '/var/db/smartmontools/.gnupg.139163.tmp': Directory not empty

Script executes normal but has problem deleting it's gpg directory. 

Expected Results:  
There should be no stderr output when scripts executes normally.

Script doesn't delete it's temporary directory.
Comment 1 Florian Schmaus gentoo-dev 2021-11-04 16:18:14 UTC
Thanks for you bug report. This appears to be a non-gentoo specific issue, have you tried to create a bug report upstream at https://www.smartmontools.org/#BugReports ?
Comment 2 ev 2021-11-04 20:26:56 UTC
Sorry for the problem.
I've just made bug report upstream. 

You can close or delete this bug.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-11-04 20:37:47 UTC
(In reply to ev from comment #2)
> Sorry for the problem.
> I've just made bug report upstream. 
> 
> You can close or delete this bug.

It's no problem -- telling us about things first so we can see if we should report it / it's our fault / ... is useful! Can you link us to the report?
Comment 4 ev 2021-11-04 22:52:45 UTC
Ok.
This is the address of bug report I created upstream. 
https://www.smartmontools.org/ticket/1542

If upstream won't fix it in a few months, it would be nice if you could somehow add this fix to ebuild.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-02 08:06:09 UTC
Fixed in 7.3.