Mailinglist Archive: zypp-commit (232 mails)

< Previous Next >
[zypp-commit] <libzypp> SuSE-Code-11-Branch : Fix chroot execution of update scripts. (bnc #558813)
  • From: Michael Andres <ma@xxxxxxx>
  • Date: Fri, 27 Nov 2009 11:16:48 +0100
  • Message-id: <E1NDxtt-0001An-18@xxxxxxxxxxxxxxxx>
ref: refs/heads/SuSE-Code-11-Branch
commit dddf73e917126901da9beeb20fe6234bddda40c9
Author: Michael Andres <ma@xxxxxxx>
Date: Fri Nov 27 11:16:48 2009 +0100

Fix chroot execution of update scripts. (bnc #558813)
---
zypp/target/TargetImpl.cc | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/zypp/target/TargetImpl.cc b/zypp/target/TargetImpl.cc
index f53b71b..8b1b89d 100644
--- a/zypp/target/TargetImpl.cc
+++ b/zypp/target/TargetImpl.cc
@@ -83,7 +83,7 @@ namespace zypp
const
Pathname & script_r,

callback::SendReport<PatchScriptReport> & report_r )
{
- MIL << "Execute script " << PathInfo(script_r) << endl;
+ MIL << "Execute script " << PathInfo(Pathname::assertprefix(
root_r,script_r)) << endl;

HistoryLog historylog;
historylog.comment(script_r.asString() + _(" executed"),
/*timestamp*/true);
@@ -180,21 +180,28 @@ namespace zypp
bool abort = false;
for_( it, checkPackages_r.begin(), checkPackages_r.end() )
{
- std::string prefix( str::form( "%s-%s-", it->name().c_str(),
it->edition().c_str() ) );
+ std::string prefix( str::form( "%s-%s", it->name().c_str(),
it->edition().c_str() ) );
for_( sit, scripts.begin(), scripts.end() )
{
if ( ! str::hasPrefix( *sit, prefix ) )
continue;

+ if ( (*sit)[prefix.size()] != '\0' && (*sit)[prefix.size()] != '-'
)
+ continue; // if not exact match it had to continue with '-'
+
PathInfo script( scriptsDir / *sit );
if ( ! script.isFile() )
continue;

+ // Assert it's set executable
+ filesystem::addmod( script.path(), 0500 );
+
+ Pathname localPath( scriptsPath_r/(*sit) ); // without root prefix
if ( abort || aborting_r )
{
WAR << "Aborting: Skip patch script " << *sit << endl;
HistoryLog().comment(
- script.path().asString() + _(" execution skipped while
aborting"),
+ localPath.asString() + _(" execution skipped while
aborting"),
/*timestamp*/true);
}
else
@@ -203,7 +210,7 @@ namespace zypp
callback::SendReport<PatchScriptReport> report;
report->start( make<Package>( *it ), script.path() );

- if ( ! executeScript( root_r, script.path(), report ) )
+ if ( ! executeScript( root_r, localPath, report ) ) // script
path without root prefix!
abort = true; // requested abort.
}
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages