sourcelist.cc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: sourcelist.cc,v 1.3 2002/08/15 20:51:37 niemeyer Exp $
  4. /* ######################################################################
  5. List of Sources
  6. ##################################################################### */
  7. /*}}}*/
  8. // Include Files /*{{{*/
  9. #include<config.h>
  10. #include <apt-pkg/sourcelist.h>
  11. #include <apt-pkg/cmndline.h>
  12. #include <apt-pkg/error.h>
  13. #include <apt-pkg/fileutl.h>
  14. #include <apt-pkg/strutl.h>
  15. #include <apt-pkg/configuration.h>
  16. #include <apt-pkg/metaindex.h>
  17. #include <apt-pkg/indexfile.h>
  18. #include <apt-pkg/tagfile.h>
  19. #include <apt-pkg/pkgcache.h>
  20. #include <apt-pkg/cacheiterators.h>
  21. #include <apt-pkg/debindexfile.h>
  22. #include <ctype.h>
  23. #include <stddef.h>
  24. #include <time.h>
  25. #include <cstring>
  26. #include <map>
  27. #include <string>
  28. #include <vector>
  29. #include <fstream>
  30. #include <algorithm>
  31. #include <apti18n.h>
  32. /*}}}*/
  33. using namespace std;
  34. // Global list of Items supported
  35. static pkgSourceList::Type *ItmList[10];
  36. pkgSourceList::Type **pkgSourceList::Type::GlobalList = ItmList;
  37. unsigned long pkgSourceList::Type::GlobalListLen = 0;
  38. // Type::Type - Constructor /*{{{*/
  39. // ---------------------------------------------------------------------
  40. /* Link this to the global list of items*/
  41. pkgSourceList::Type::Type(char const * const pName, char const * const pLabel) : Name(pName), Label(pLabel)
  42. {
  43. ItmList[GlobalListLen] = this;
  44. ++GlobalListLen;
  45. }
  46. pkgSourceList::Type::~Type() {}
  47. /*}}}*/
  48. // Type::GetType - Get a specific meta for a given type /*{{{*/
  49. // ---------------------------------------------------------------------
  50. /* */
  51. pkgSourceList::Type *pkgSourceList::Type::GetType(const char *Type)
  52. {
  53. for (unsigned I = 0; I != GlobalListLen; ++I)
  54. if (strcmp(GlobalList[I]->Name,Type) == 0)
  55. return GlobalList[I];
  56. return 0;
  57. }
  58. /*}}}*/
  59. // Type::FixupURI - Normalize the URI and check it.. /*{{{*/
  60. // ---------------------------------------------------------------------
  61. /* */
  62. bool pkgSourceList::Type::FixupURI(string &URI) const
  63. {
  64. if (URI.empty() == true)
  65. return false;
  66. if (URI.find(':') == string::npos)
  67. return false;
  68. URI = SubstVar(URI,"$(ARCH)",_config->Find("APT::Architecture"));
  69. // Make sure that the URI is / postfixed
  70. if (URI[URI.size() - 1] != '/')
  71. URI += '/';
  72. return true;
  73. }
  74. /*}}}*/
  75. bool pkgSourceList::Type::ParseStanza(vector<metaIndex *> &List, /*{{{*/
  76. pkgTagSection &Tags,
  77. unsigned int const i,
  78. FileFd &Fd)
  79. {
  80. map<string, string> Options;
  81. string Enabled = Tags.FindS("Enabled");
  82. if (Enabled.empty() == false && StringToBool(Enabled) == false)
  83. return true;
  84. std::map<char const * const, std::pair<char const * const, bool> > mapping;
  85. #define APT_PLUSMINUS(X, Y) \
  86. mapping.insert(std::make_pair(X, std::make_pair(Y, true))); \
  87. mapping.insert(std::make_pair(X "Add", std::make_pair(Y "+", true))); \
  88. mapping.insert(std::make_pair(X "Remove", std::make_pair(Y "-", true)))
  89. APT_PLUSMINUS("Architectures", "arch");
  90. APT_PLUSMINUS("Languages", "lang");
  91. APT_PLUSMINUS("Targets", "target");
  92. #undef APT_PLUSMINUS
  93. mapping.insert(std::make_pair("Trusted", std::make_pair("trusted", false)));
  94. mapping.insert(std::make_pair("Check-Valid-Until", std::make_pair("check-valid-until", false)));
  95. mapping.insert(std::make_pair("Valid-Until-Min", std::make_pair("valid-until-min", false)));
  96. mapping.insert(std::make_pair("Valid-Until-Max", std::make_pair("valid-until-max", false)));
  97. mapping.insert(std::make_pair("Signed-By", std::make_pair("signed-by", false)));
  98. mapping.insert(std::make_pair("PDiffs", std::make_pair("pdiffs", false)));
  99. mapping.insert(std::make_pair("By-Hash", std::make_pair("by-hash", false)));
  100. for (std::map<char const * const, std::pair<char const * const, bool> >::const_iterator m = mapping.begin(); m != mapping.end(); ++m)
  101. if (Tags.Exists(m->first))
  102. {
  103. std::string option = Tags.FindS(m->first);
  104. // for deb822 the " " is the delimiter, but the backend expects ","
  105. if (m->second.second == true)
  106. std::replace(option.begin(), option.end(), ' ', ',');
  107. Options[m->second.first] = option;
  108. }
  109. {
  110. std::string entry;
  111. strprintf(entry, "%s:%i", Fd.Name().c_str(), i);
  112. Options["sourceslist-entry"] = entry;
  113. }
  114. // now create one item per suite/section
  115. string Suite = Tags.FindS("Suites");
  116. Suite = SubstVar(Suite,"$(ARCH)",_config->Find("APT::Architecture"));
  117. string const Component = Tags.FindS("Components");
  118. string const URIS = Tags.FindS("URIs");
  119. std::vector<std::string> const list_uris = VectorizeString(URIS, ' ');
  120. std::vector<std::string> const list_suite = VectorizeString(Suite, ' ');
  121. std::vector<std::string> const list_comp = VectorizeString(Component, ' ');
  122. if (list_uris.empty())
  123. // TRANSLATOR: %u is a line number, the first %s is a filename of a file with the extension "second %s" and the third %s is a unique identifier for bugreports
  124. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "URI");
  125. for (std::vector<std::string>::const_iterator U = list_uris.begin();
  126. U != list_uris.end(); ++U)
  127. {
  128. std::string URI = *U;
  129. if (U->empty() || FixupURI(URI) == false)
  130. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "URI parse");
  131. if (list_suite.empty())
  132. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "Suite");
  133. for (std::vector<std::string>::const_iterator S = list_suite.begin();
  134. S != list_suite.end(); ++S)
  135. {
  136. if (S->empty() == false && (*S)[S->size() - 1] == '/')
  137. {
  138. if (list_comp.empty() == false)
  139. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "absolute Suite Component");
  140. if (CreateItem(List, URI, *S, "", Options) == false)
  141. return false;
  142. }
  143. else
  144. {
  145. if (list_comp.empty())
  146. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "Component");
  147. for (std::vector<std::string>::const_iterator C = list_comp.begin();
  148. C != list_comp.end(); ++C)
  149. {
  150. if (CreateItem(List, URI, *S, *C, Options) == false)
  151. {
  152. return false;
  153. }
  154. }
  155. }
  156. }
  157. }
  158. return true;
  159. }
  160. /*}}}*/
  161. // Type::ParseLine - Parse a single line /*{{{*/
  162. // ---------------------------------------------------------------------
  163. /* This is a generic one that is the 'usual' format for sources.list
  164. Weird types may override this. */
  165. bool pkgSourceList::Type::ParseLine(vector<metaIndex *> &List,
  166. const char *Buffer,
  167. unsigned int const CurLine,
  168. string const &File) const
  169. {
  170. for (;Buffer != 0 && isspace(*Buffer); ++Buffer); // Skip whitespaces
  171. // Parse option field if it exists
  172. // e.g.: [ option1=value1 option2=value2 ]
  173. map<string, string> Options;
  174. {
  175. std::string entry;
  176. strprintf(entry, "%s:%i", File.c_str(), CurLine);
  177. Options["sourceslist-entry"] = entry;
  178. }
  179. if (Buffer != 0 && Buffer[0] == '[')
  180. {
  181. ++Buffer; // ignore the [
  182. for (;Buffer != 0 && isspace(*Buffer); ++Buffer); // Skip whitespaces
  183. while (*Buffer != ']')
  184. {
  185. // get one option, e.g. option1=value1
  186. string option;
  187. if (ParseQuoteWord(Buffer,option) == false)
  188. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "[option] unparseable");
  189. if (option.length() < 3)
  190. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "[option] too short");
  191. // accept options even if the last has no space before the ]-end marker
  192. if (option.at(option.length()-1) == ']')
  193. {
  194. for (; *Buffer != ']'; --Buffer);
  195. option.resize(option.length()-1);
  196. }
  197. size_t const needle = option.find('=');
  198. if (needle == string::npos)
  199. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "[option] not assignment");
  200. string const key = string(option, 0, needle);
  201. string const value = string(option, needle + 1, option.length());
  202. if (key.empty() == true)
  203. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "[option] no key");
  204. if (value.empty() == true)
  205. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "[option] no value");
  206. Options[key] = value;
  207. }
  208. ++Buffer; // ignore the ]
  209. for (;Buffer != 0 && isspace(*Buffer); ++Buffer); // Skip whitespaces
  210. }
  211. string URI;
  212. string Dist;
  213. string Section;
  214. if (ParseQuoteWord(Buffer,URI) == false)
  215. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "URI");
  216. if (ParseQuoteWord(Buffer,Dist) == false)
  217. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "Suite");
  218. if (FixupURI(URI) == false)
  219. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "URI parse");
  220. // Check for an absolute dists specification.
  221. if (Dist.empty() == false && Dist[Dist.size() - 1] == '/')
  222. {
  223. if (ParseQuoteWord(Buffer,Section) == true)
  224. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "absolute Suite Component");
  225. Dist = SubstVar(Dist,"$(ARCH)",_config->Find("APT::Architecture"));
  226. return CreateItem(List, URI, Dist, Section, Options);
  227. }
  228. // Grab the rest of the dists
  229. if (ParseQuoteWord(Buffer,Section) == false)
  230. return _error->Error(_("Malformed entry %u in %s file %s (%s)"), CurLine, "list", File.c_str(), "Component");
  231. do
  232. {
  233. if (CreateItem(List, URI, Dist, Section, Options) == false)
  234. return false;
  235. }
  236. while (ParseQuoteWord(Buffer,Section) == true);
  237. return true;
  238. }
  239. /*}}}*/
  240. // SourceList::pkgSourceList - Constructors /*{{{*/
  241. // ---------------------------------------------------------------------
  242. /* */
  243. pkgSourceList::pkgSourceList() : d(NULL)
  244. {
  245. }
  246. /*}}}*/
  247. // SourceList::~pkgSourceList - Destructor /*{{{*/
  248. // ---------------------------------------------------------------------
  249. /* */
  250. pkgSourceList::~pkgSourceList()
  251. {
  252. for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I)
  253. delete *I;
  254. SrcList.clear();
  255. for (auto F = VolatileFiles.begin(); F != VolatileFiles.end(); ++F)
  256. delete (*F);
  257. VolatileFiles.clear();
  258. }
  259. /*}}}*/
  260. // SourceList::ReadMainList - Read the main source list from etc /*{{{*/
  261. // ---------------------------------------------------------------------
  262. /* */
  263. bool pkgSourceList::ReadMainList()
  264. {
  265. // CNC:2003-03-03 - Multiple sources list support.
  266. bool Res = true;
  267. #if 0
  268. Res = ReadVendors();
  269. if (Res == false)
  270. return false;
  271. #endif
  272. Reset();
  273. // CNC:2003-11-28 - Entries in sources.list have priority over
  274. // entries in sources.list.d.
  275. string Main = _config->FindFile("Dir::Etc::sourcelist");
  276. string Parts = _config->FindDir("Dir::Etc::sourceparts");
  277. if (RealFileExists(Main) == true)
  278. Res &= ReadAppend(Main);
  279. else if (DirectoryExists(Parts) == false)
  280. // Only warn if there are no sources.list.d.
  281. _error->WarningE("DirectoryExists", _("Unable to read %s"), Parts.c_str());
  282. if (DirectoryExists(Parts) == true)
  283. Res &= ReadSourceDir(Parts);
  284. else if (RealFileExists(Main) == false)
  285. // Only warn if there is no sources.list file.
  286. _error->WarningE("RealFileExists", _("Unable to read %s"), Main.c_str());
  287. return Res;
  288. }
  289. /*}}}*/
  290. // SourceList::Reset - Clear the sourcelist contents /*{{{*/
  291. // ---------------------------------------------------------------------
  292. /* */
  293. void pkgSourceList::Reset()
  294. {
  295. for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I)
  296. delete *I;
  297. SrcList.clear();
  298. }
  299. /*}}}*/
  300. // SourceList::Read - Parse the sourcelist file /*{{{*/
  301. // ---------------------------------------------------------------------
  302. /* */
  303. bool pkgSourceList::Read(string const &File)
  304. {
  305. Reset();
  306. return ReadAppend(File);
  307. }
  308. /*}}}*/
  309. // SourceList::ReadAppend - Parse a sourcelist file /*{{{*/
  310. // ---------------------------------------------------------------------
  311. /* */
  312. bool pkgSourceList::ReadAppend(string const &File)
  313. {
  314. if (flExtension(File) == "sources")
  315. return ParseFileDeb822(File);
  316. else
  317. return ParseFileOldStyle(File);
  318. }
  319. /*}}}*/
  320. // SourceList::ReadFileOldStyle - Read Traditional style sources.list /*{{{*/
  321. // ---------------------------------------------------------------------
  322. /* */
  323. bool pkgSourceList::ParseFileOldStyle(std::string const &File)
  324. {
  325. // Open the stream for reading
  326. ifstream F(File.c_str(),ios::in /*| ios::nocreate*/);
  327. if (F.fail() == true)
  328. return _error->Errno("ifstream::ifstream",_("Opening %s"),File.c_str());
  329. std::string Buffer;
  330. for (unsigned int CurLine = 1; std::getline(F, Buffer); ++CurLine)
  331. {
  332. // remove comments
  333. size_t curpos = 0;
  334. while ((curpos = Buffer.find('#', curpos)) != std::string::npos)
  335. {
  336. size_t const openbrackets = std::count(Buffer.begin(), Buffer.begin() + curpos, '[');
  337. size_t const closedbrackets = std::count(Buffer.begin(), Buffer.begin() + curpos, ']');
  338. if (openbrackets > closedbrackets)
  339. {
  340. // a # in an option, unlikely, but oh well, it was supported so stick to it
  341. ++curpos;
  342. continue;
  343. }
  344. Buffer.erase(curpos);
  345. break;
  346. }
  347. // remove spaces before/after
  348. curpos = Buffer.find_first_not_of(" \t\r");
  349. if (curpos != 0)
  350. Buffer.erase(0, curpos);
  351. curpos = Buffer.find_last_not_of(" \t\r");
  352. if (curpos != std::string::npos)
  353. Buffer.erase(curpos + 1);
  354. if (Buffer.empty())
  355. continue;
  356. // Grok it
  357. std::string const LineType = Buffer.substr(0, Buffer.find_first_of(" \t\v"));
  358. if (LineType.empty() || LineType == Buffer)
  359. return _error->Error(_("Malformed line %u in source list %s (type)"),CurLine,File.c_str());
  360. Type *Parse = Type::GetType(LineType.c_str());
  361. if (Parse == 0)
  362. return _error->Error(_("Type '%s' is not known on line %u in source list %s"),LineType.c_str(),CurLine,File.c_str());
  363. if (Parse->ParseLine(SrcList, Buffer.c_str() + LineType.length(), CurLine, File) == false)
  364. return false;
  365. }
  366. return true;
  367. }
  368. /*}}}*/
  369. // SourceList::ParseFileDeb822 - Parse deb822 style sources.list /*{{{*/
  370. // ---------------------------------------------------------------------
  371. /* Returns: the number of stanzas parsed*/
  372. bool pkgSourceList::ParseFileDeb822(string const &File)
  373. {
  374. pkgUserTagSection Tags;
  375. unsigned int i = 1;
  376. // see if we can read the file
  377. FileFd Fd(File, FileFd::ReadOnly);
  378. pkgTagFile Sources(&Fd);
  379. if (Fd.IsOpen() == false || Fd.Failed())
  380. return _error->Error(_("Malformed stanza %u in source list %s (type)"),i,File.c_str());
  381. // read step by step
  382. while (Sources.Step(Tags) == true)
  383. {
  384. if(Tags.Exists("Types") == false)
  385. return _error->Error(_("Malformed stanza %u in source list %s (type)"),i,File.c_str());
  386. string const types = Tags.FindS("Types");
  387. std::vector<std::string> const list_types = VectorizeString(types, ' ');
  388. for (std::vector<std::string>::const_iterator I = list_types.begin();
  389. I != list_types.end(); ++I)
  390. {
  391. Type *Parse = Type::GetType((*I).c_str());
  392. if (Parse == 0)
  393. {
  394. _error->Error(_("Type '%s' is not known on stanza %u in source list %s"), (*I).c_str(),i,Fd.Name().c_str());
  395. return false;
  396. }
  397. if (!Parse->ParseStanza(SrcList, Tags, i, Fd))
  398. return false;
  399. ++i;
  400. }
  401. }
  402. return true;
  403. }
  404. /*}}}*/
  405. // SourceList::FindIndex - Get the index associated with a file /*{{{*/
  406. static bool FindInIndexFileContainer(std::vector<pkgIndexFile *> const &Cont, pkgCache::PkgFileIterator const &File, pkgIndexFile *&Found)
  407. {
  408. auto const J = std::find_if(Cont.begin(), Cont.end(), [&File](pkgIndexFile const * const J) {
  409. return J->FindInCache(*File.Cache()) == File;
  410. });
  411. if (J != Cont.end())
  412. {
  413. Found = (*J);
  414. return true;
  415. }
  416. return false;
  417. }
  418. bool pkgSourceList::FindIndex(pkgCache::PkgFileIterator File,
  419. pkgIndexFile *&Found) const
  420. {
  421. for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I)
  422. if (FindInIndexFileContainer(*(*I)->GetIndexFiles(), File, Found))
  423. return true;
  424. return FindInIndexFileContainer(VolatileFiles, File, Found);
  425. }
  426. /*}}}*/
  427. // SourceList::GetIndexes - Load the index files into the downloader /*{{{*/
  428. // ---------------------------------------------------------------------
  429. /* */
  430. bool pkgSourceList::GetIndexes(pkgAcquire *Owner, bool GetAll) const
  431. {
  432. for (const_iterator I = SrcList.begin(); I != SrcList.end(); ++I)
  433. if ((*I)->GetIndexes(Owner,GetAll) == false)
  434. return false;
  435. return true;
  436. }
  437. /*}}}*/
  438. // CNC:2003-03-03 - By Anton V. Denisov <avd@altlinux.org>.
  439. // SourceList::ReadSourceDir - Read a directory with sources files
  440. // Based on ReadConfigDir() /*{{{*/
  441. // ---------------------------------------------------------------------
  442. /* */
  443. bool pkgSourceList::ReadSourceDir(string const &Dir)
  444. {
  445. std::vector<std::string> ext;
  446. ext.push_back("list");
  447. ext.push_back("sources");
  448. std::vector<std::string> const List = GetListOfFilesInDir(Dir, ext, true);
  449. // Read the files
  450. for (vector<string>::const_iterator I = List.begin(); I != List.end(); ++I)
  451. if (ReadAppend(*I) == false)
  452. return false;
  453. return true;
  454. }
  455. /*}}}*/
  456. // GetLastModified() /*{{{*/
  457. // ---------------------------------------------------------------------
  458. /* */
  459. time_t pkgSourceList::GetLastModifiedTime()
  460. {
  461. vector<string> List;
  462. string Main = _config->FindFile("Dir::Etc::sourcelist");
  463. string Parts = _config->FindDir("Dir::Etc::sourceparts");
  464. // go over the parts
  465. if (DirectoryExists(Parts) == true)
  466. List = GetListOfFilesInDir(Parts, "list", true);
  467. // calculate the time
  468. std::vector<time_t> modtimes;
  469. modtimes.reserve(1 + List.size());
  470. modtimes.push_back(GetModificationTime(Main));
  471. std::transform(List.begin(), List.end(), std::back_inserter(modtimes), GetModificationTime);
  472. auto const maxmtime = std::max_element(modtimes.begin(), modtimes.end());
  473. return *maxmtime;
  474. }
  475. /*}}}*/
  476. std::vector<pkgIndexFile*> pkgSourceList::GetVolatileFiles() const /*{{{*/
  477. {
  478. return VolatileFiles;
  479. }
  480. /*}}}*/
  481. void pkgSourceList::AddVolatileFile(pkgIndexFile * const File) /*{{{*/
  482. {
  483. if (File != nullptr)
  484. VolatileFiles.push_back(File);
  485. }
  486. /*}}}*/
  487. bool pkgSourceList::AddVolatileFile(std::string const &File) /*{{{*/
  488. {
  489. if (File.empty() || FileExists(File) == false)
  490. return false;
  491. if (flExtension(File) == "deb")
  492. AddVolatileFile(new debDebPkgFileIndex(File));
  493. else
  494. return false;
  495. return true;
  496. }
  497. /*}}}*/
  498. void pkgSourceList::AddVolatileFiles(CommandLine &CmdL, std::vector<const char*> * const VolatileCmdL)/*{{{*/
  499. {
  500. std::remove_if(CmdL.FileList + 1, CmdL.FileList + 1 + CmdL.FileSize(), [&](char const * const I) {
  501. if (I != nullptr && (I[0] == '/' || (I[0] == '.' && ((I[1] == '.' && I[2] == '/') || I[1] == '/'))))
  502. {
  503. if (AddVolatileFile(I))
  504. {
  505. if (VolatileCmdL != nullptr)
  506. VolatileCmdL->push_back(I);
  507. }
  508. else
  509. _error->Error(_("Unsupported file %s given on commandline"), I);
  510. return true;
  511. }
  512. return false;
  513. });
  514. }
  515. /*}}}*/