-------------------------------------------------------------------
+Thu Aug 16 17:21:52 CEST 2007 - kkaempf@suse.de
+
+- discard pattern files with incompatbile architecture, both
+ for download and for parsing. (#298716)
+- rev 6711
+
+-------------------------------------------------------------------
Thu Aug 16 17:12:45 CEST 2007 - kkaempf@suse.de
- run sqlite asynchronously and add sql index files where
{
if ( isPatternFile( it->first ) )
{
+ // *** see also zypp/repo/susetags/Downloader.cc ***
+
+ // omit unwanted patterns, see https://bugzilla.novell.com/show_bug.cgi?id=298716
+ // expect "<name>.<arch>.pat[.gz]", <name> might contain additional dots
+ // split at dots, take .pat or .pat.gz into account
+
+ // vector of splitted pattern filename elements
+ std::vector<std::string> patparts;
+
+ // this is the offset from the last element of patparts
+ unsigned archoff = 2;
+
+ unsigned count = str::split( it->first, std::back_inserter( patparts ), "." );
+
+ if ( patparts[count-1] == "gz" )
+ archoff++;
+
+ if ( count > archoff )
+ {
+ try // might by an invalid architecture
+ {
+ Arch patarch( patparts[count-archoff] );
+ if ( !patarch.compatibleWith( ZConfig::instance().systemArchitecture() ) )
+ {
+ // discard, if not compatible
+ MIL << "Discarding pattern " << it->first << endl;
+ continue;
+ }
+ }
+ catch ( const Exception & excpt )
+ {
+ WAR << "Pattern file name does not contain recognizable architecture: " << it->first << endl;
+ // keep .pat file if it doesn't contain an recognizable arch
+ }
+ }
+
Pathname inputfile( getOptionalFile( _descrdir / it->first, false /*filename already contains .gz */ ) );
if ( ! inputfile.empty() )
{
}
}
}
+ else if ( str::endsWith( words[3], ".pat" )
+ || str::endsWith( words[3], ".pat.gz" ) )
+ {
+
+ // *** see also zypp/parser/susetags/RepoParser.cc ***
+
+ // omit unwanted patterns, see https://bugzilla.novell.com/show_bug.cgi?id=298716
+ // expect "<name>.<arch>.pat[.gz]", <name> might contain additional dots
+ // split at dots, take .pat or .pat.gz into account
+
+ std::vector<std::string> patparts;
+ unsigned archpos = 2;
+ // expect "<name>.<arch>.pat[.gz]", <name> might contain additional dots
+ unsigned count = str::split( buffer, std::back_inserter(patparts), "." );
+ if ( patparts[count-1] == "gz" )
+ archpos++;
+
+ if ( count > archpos )
+ {
+ try // might by an invalid architecture
+ {
+ Arch patarch( patparts[count-archpos] );
+ if ( !patarch.compatibleWith( ZConfig::instance().systemArchitecture() ) )
+ {
+ // discard, if not compatible
+ MIL << "Discarding pattern " << words[3] << endl;
+ continue;
+ }
+ }
+ catch ( const Exception & excpt )
+ {
+ WAR << "Pattern file name does not contain recognizable architecture: " << words[3] << endl;
+ // keep .pat file if it doesn't contain an recognizable arch
+ }
+ }
+ }
OnMediaLocation location( _path + descr_dir + words[3], 1 );
location.setChecksum( CheckSum( words[1], words[2] ) );
this->enqueueDigested(location);