allow installation and refresh from repository with alias that contains ' or " (bnc...
authorJosef Reidinger <jreidinger@suse.cz>
Tue, 20 May 2008 10:11:28 +0000 (10:11 +0000)
committerJosef Reidinger <jreidinger@suse.cz>
Tue, 20 May 2008 10:11:28 +0000 (10:11 +0000)
zypp/RepoManager.cc
zypp/target/rpm/RpmDb.cc

index 427e5d7..defb77e 100644 (file)
@@ -772,12 +772,17 @@ namespace zypp
         ManagedFile guard( solvfile, filesystem::unlink );
 
         ostringstream cmd;
+        const char *toFile = str::gsub(solvfile.asString(),"\"","\\\"").c_str();
         if ( repokind.toEnum() == RepoType::RPMPLAINDIR_e )
         {
-          cmd << str::form( "repo2solv.sh \"%s\" > \"%s\"", info.baseUrlsBegin()->getPathName().c_str(), solvfile.c_str() );
+          const char * from = str::gsub(
+            info.baseUrlsBegin()->getPathName(),"\"","\\\"").c_str();
+          cmd << str::form( "repo2solv.sh \"%s\" > \"%s\"", from , toFile );
         } else
-          cmd << str::form( "repo2solv.sh \"%s\" > \"%s\"", rawpath.c_str(), solvfile.c_str() );
-
+        {
+          const char * from = str::gsub(rawpath.asString(),"\"","\\\"").c_str();
+          cmd << str::form( "repo2solv.sh \"%s\" > \"%s\"", from, toFile );
+        }
         MIL << "Executing: " << cmd.str() << endl;
         ExternalProgram prog( cmd.str(), ExternalProgram::Stderr_To_Stdout );
 
index 22cbb8d..5e9032c 100644 (file)
@@ -57,7 +57,7 @@ namespace rpm
 {
 namespace
 {
-const char* quoteInFilename_m = " \t";
+const char* quoteInFilename_m = " \t\'\"";
 inline string rpmQuoteFilename( const Pathname & path_r )
 {
   string path( path_r.asString() );