Open mouse07410 opened 2 months ago
How did you install ClamAV, via Homebrew?
How did you install ClamAV, via Homebrew?
No, via Macports: sudo port install clamav
.
Shouldn't really matter - all that counts is that in some cases ClamAV installation is owned and run by user (unprivileged), and in other cases (like mine) it runs under either root
or _clamav
user name. Those latter ones require sudo
, which the current topgrade
does not provide.
Here's the patch that addressed all of my current issues related to (a) not invoking certain managers or apps (poetry
, freshclam
) with sudo
, and (b) insisting on invocation of tlmgr
using full path (/Library/TeX/texbin/tlmgr
on MacOS with MacTeX). Please feel free to incorporate it, or do as you see fit.
index 152c721..bfdd3ae 100644
--- a/src/steps/generic.rs
+++ b/src/steps/generic.rs
@@ -668,7 +668,8 @@ pub fn run_tlmgr_update(ctx: &ExecutionContext) -> Result<()> {
} else {
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
let mut c = ctx.run_type().execute(sudo);
- c.arg(&tlmgr);
+ //c.arg(&tlmgr);
+ c.arg("tlmgr");
c
};
command.args(["update", "--self", "--all"]);
@@ -969,8 +970,9 @@ pub fn run_certbot(ctx: &ExecutionContext) -> Result<()> {
/// doc: https://docs.clamav.net/manual/Usage/SignatureManagement.html#freshclam
pub fn run_freshclam(ctx: &ExecutionContext) -> Result<()> {
let freshclam = require("freshclam")?;
+ let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
print_separator("Update ClamAV Database(FreshClam)");
- ctx.run_type().execute(freshclam).status_checked()
+ ctx.run_type().execute(sudo).arg("-EH").arg(freshclam).status_checked()
}
/// Involve `pio upgrade` to update PlatformIO core.
@@ -1020,8 +1022,9 @@ pub fn run_lensfun_update_data(ctx: &ExecutionContext) -> Result<()> {
pub fn run_poetry(ctx: &ExecutionContext) -> Result<()> {
let poetry = require("poetry")?;
+ let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
print_separator("Poetry");
- ctx.run_type().execute(poetry).args(["self", "update"]).status_checked()
+ ctx.run_type().execute(sudo).arg(poetry).args(["self", "update"]).status_checked()
}
pub fn run_uv(ctx: &ExecutionContext) -> Result<()> {
Any update...?
Hi, thanks for the ping, I am too busy with my work so I may ignore replies.
For your change to the freshclam
step:
+ ctx.run_type().execute(sudo).arg("-EH").arg(freshclam).status_checked()
Why is -EH
needed?
For your poetry issue, is it also installed via Macports? If so, I think you should disable this step and let Macports manage and update it.
For your tlmgr issue, let's discuss it in this thread: #865
For your change to the
freshclam
step, why is-EH
needed?
I think - to pass local env vars. But, honestly, not sure.
For your poetry issue, is it also installed via Macports? If so, I think you should disable this step and let Macports manage and update it.
This is not about updating the poetry
itself, which Macports indeed does on its own - it's about updating the stuff that poetry
manages, and which Macports can't/won't do by itself.
I think - to pass local env vars. But, honestly, not sure.
If a simple sudo freshclam
works in your case, then no.
This is not about updating the poetry itself, which Macports indeed does on its own - it's about updating the stuff that poetry manages, and which Macports can't/won't do by itself.
Makes sense
I need a way to inspect if sudo
is needed, a naive solution (for UNIX) is to check the owner of the files that freshclam
will modify, then check if the current process is capable of doing that, if not, sudo is needed.
Not sure how to do this on Windows though.
Erroneous Behavior
Expected Behavior
Steps to reproduce
Install the latest version on a machine that has Macports-installed ClamAV, and run
topgrade
. When it reaches updating ClamAV db, observe the failure (shown above).Possible Cause (Optional)
freshclam
not invoked with privilege, which on Macports installation it must.Problem persists without calling from topgrade
Did you run topgrade through
Remote Execution
Configuration file (Optional)
Additional Details
Operation System/Version: MacOS Sonoma 14.6.1
Rust 1.80.1
Installation Cloned this repo, and did "cargo build && cargo install --path ."
Topgrade version (
topgrade -V
)Verbose Output (
topgrade -v
)Probably unnecessary - it's obvious that what's missing is a way to tell
topgrade
to invokefreshclam
undersudo
.