Skip to content

Commit

Permalink
zypper.conf: new commit/psCheckAccessDeleted to avoid 'lsof' call aft…
Browse files Browse the repository at this point in the history
…er commit (bsc#945169)

On some systems 'lsof' seems to perform very slow, and the check takes up
to several minutes. Due to this it's possible to disable the automatic
check after each commit. Explicit calls to 'zypper ps' are not affected by
this option.
  • Loading branch information
mlandres committed Sep 24, 2015
1 parent 6e741f9 commit ff57dba
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Config.cc
Expand Up @@ -100,6 +100,8 @@ namespace
SOLVER_INSTALL_RECOMMENDS,
SOLVER_FORCE_RESOLUTION_COMMANDS,

COMMIT_PS_CHECK_ACCESS_DELETED,

COLOR_USE_COLORS,
COLOR_RESULT,
COLOR_MSG_STATUS,
Expand Down Expand Up @@ -129,6 +131,8 @@ namespace
{ "solver/installRecommends", ConfigOption::SOLVER_INSTALL_RECOMMENDS },
{ "solver/forceResolutionCommands", ConfigOption::SOLVER_FORCE_RESOLUTION_COMMANDS },

{ "commit/psCheckAccessDeleted", ConfigOption::COMMIT_PS_CHECK_ACCESS_DELETED },

{ "color/useColors", ConfigOption::COLOR_USE_COLORS },
//"color/background" LEGACY
{ "color/result", ConfigOption::COLOR_RESULT },
Expand Down Expand Up @@ -169,6 +173,7 @@ namespace
Config::Config()
: repo_list_columns("anr")
, solver_installRecommends(!ZConfig::instance().solver_onlyRequires())
, psCheckAccessDeleted(true)
, do_colors (false)
, color_useColors ("autodetect")
, color_result (namedColor("default"))
Expand Down Expand Up @@ -232,6 +237,11 @@ void Config::read( const std::string & file )
solver_forceResolutionCommands.insert(ZypperCommand(str::trim(*c)));
}

// ---------------[ commit ]------------------------------------------------

s = augeas.getOption(asString( ConfigOption::COMMIT_PS_CHECK_ACCESS_DELETED ));
if ( ! s.empty() )
psCheckAccessDeleted = str::strToBool( s, psCheckAccessDeleted );

// ---------------[ colors ]------------------------------------------------

Expand Down
2 changes: 2 additions & 0 deletions src/Config.h
Expand Up @@ -33,6 +33,8 @@ struct Config
bool solver_installRecommends;
std::set<ZypperCommand> solver_forceResolutionCommands;

bool psCheckAccessDeleted; ///< do post commit 'zypper ps' check?

/**
* Whether to colorize the output. This is evaluated according to
* color_useColors and has_colors()
Expand Down
7 changes: 7 additions & 0 deletions src/solve-commit.cc
Expand Up @@ -445,6 +445,13 @@ ZYppCommitPolicy get_commit_policy(Zypper & zypper)
*/
static void notify_processes_using_deleted_files(Zypper & zypper)
{
if ( ! zypper.config().psCheckAccessDeleted )
{
zypper.out().info( str::form(_("Check for running processes using deleted libraries is disabled in zypper.conf. Run '%s' to check manually."),
"zypper ps -s" ) );
return; // disabled in config
}

zypper.out().info(
_("Checking for running processes using deleted libraries..."), Out::HIGH);
zypp::CheckAccessDeleted checker(false); // wait for explicit call to check()
Expand Down
14 changes: 14 additions & 0 deletions zypper.conf
Expand Up @@ -101,6 +101,20 @@
## Default value: remove
# forceResolutionCommands = remove

[commit]

## Post commit check for processes/services using old/deleted files
##
## Like 'zypper ps', the post commit check for processes/services using
## old/deleted files calls 'lsof'. On some systems 'lsof' seems to perform
## very slow, and the check takes up to several minutes. Due to this it's
## possible to disable the automatic check after each commit. Explicit calls
## to 'zypper ps' are not affected by this option.
##
## Valid values: boolean
## Default value: yes
##
# psCheckAccessDeleted = yes

[color]

Expand Down

0 comments on commit ff57dba

Please sign in to comment.