Opened 4 years ago

Last modified 2 years ago

#51599 new defect

main.log is never deleted with "keeplogs yes"

Reported by: ryandesign (Ryan Schmidt) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version: 2.3.99
Keywords: Cc: jmroot (Joshua Root), kurthindenburg (Kurt Hindenburg)
Port:

Description

Even if I run sudo port clean, the main.log file is not deleted. I feel this might relate to r146737.

Change History (8)

comment:1 Changed 4 years ago by ryandesign (Ryan Schmidt)

Summary: main.log is never deletedmain.log is never deleted with "keeplogs yes"

It appears this only happens when keeplogs yes is in macports.conf

comment:2 Changed 4 years ago by jmroot (Joshua Root)

Isn't the entire point of that setting to prevent logs from being deleted by clean? I don't see the bug here. If your concern is that there is no way to delete logs, port clean --logs does that.

For reference, the responsible code in portclean.tcl is

if {(([info exists ports_clean_logs] && $ports_clean_logs eq "yes") || ($keeplogs eq "no"))
        && !$usealtworkpath} {
    clean_logs
}

and the basic logic there has not changed since 2009 with [58be192b342eebd6f73719371ad53011d053c3b9/macports-base].

comment:3 Changed 3 years ago by kurthindenburg (Kurt Hindenburg)

Cc: kurthindenburg added

Can this be closed or do you feel there's a bug still?

comment:4 in reply to:  2 Changed 3 years ago by ryandesign (Ryan Schmidt)

Replying to jmroot:

Isn't the entire point of that setting to prevent logs from being deleted by clean?

The purpose of the setting, for me, was that the log was not deleted after a successful installation. In this way, if someone submitted a log of a failed build, I could compare it with my successful log file without having to rebuild the port. Now, because of the change in r146737, these log files balloon out of control in size the more times the port is updated, and whenever I want to compare logs, I first have to manually delete all the previous runs from my copy of the log.

comment:5 Changed 3 years ago by kurthindenburg (Kurt Hindenburg)

One way of handling this is to truncate the logs if keeplogs is true. So only one log is keep. This may or may not be what you want depending on your workflow.

comment:6 Changed 3 years ago by ryandesign (Ryan Schmidt)

Hmm, doesn't truncate usually mean set the file size to 0? Do you mean something else?

I realize now, after some time running with keeplogs yes again, that I also frequently want to install a port, then immediately check something in the log, but of course it's already gone. Training myself to use the -k flag is hard, plus that would keep the whole work directory, which I usually don't want.

comment:7 Changed 3 years ago by kurthindenburg (Kurt Hindenburg)

After r146737, I think keeplogs became confusing. Perhaps we need another variable: truncate_logs.

Truncating (instead of appending) the logs at the start will only keep one log file.

comment:8 Changed 2 years ago by raimue (Rainer Müller)

Truncating is a bad idea. If you run port configure and then port build in separate port commands, the configure output will be gone.

Let me propose the following:

Put the log file into ${workpath}/logs/main.log, so it is automatically cleaned with the rest of the work directory. This simplifies the log file handling as we can always append to it until it is cleaned. If keeplogs is set, before cleaning, the log file will be moved to ${prefix}/var/macports/logs/YYYY-MM-DD_HH-mm-ss_main.log, based on the mtime of the main.log. An explicit sudo port clean --logs would delete these archived log files.

Note: See TracTickets for help on using tickets.