// Absolute
if (val.length() >= 1 && val[0] == '/')
+ {
+ if (val.compare(0, 9, "/dev/null") == 0)
+ val.erase(9);
break;
+ }
// ~/foo or ./foo
if (val.length() >= 2 && (val[0] == '~' || val[0] == '.') && val[1] == '/')
{
string Res = FindFile(Name,Default);
if (Res.end()[-1] != '/')
+ {
+ size_t const found = Res.rfind("/dev/null");
+ if (found != string::npos && found == Res.size() - 9)
+ return Res; // /dev/null returning
return Res + '/';
+ }
return Res;
}
/*}}}*/
* apt-pkg/contrib/configuration.cc:
- add a more versatile Dump() method
- normalize a bit by replacing // and /./ with / in FindFile
+ - /dev/null is a special absolute path as it has no subdirectories
* apt-pkg/acquire-worker.cc:
- use Dump() to generate the configuration message for sending
* cmdline/apt-config.cc:
- check with RealFileExists for scenario file as otherwise a directory
like one provided with RootDir triggers the usage of EDSP
- -- David Kalnischkies <kalnischkies@gmail.com> Mon, 23 Apr 2012 19:10:13 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com> Mon, 23 Apr 2012 19:32:29 +0200
apt (0.9.2) unstable; urgency=low
equals(Cnf.FindFile("Dir::State"), "/rootdir/srv/sid/var/lib/apt");
equals(Cnf.FindFile("Dir::Aptitude::State"), "/rootdir/srv/sid/var/lib/aptitude");
+ Cnf.Set("Dir::State", "/dev/null");
+ Cnf.Set("Dir::State::lists", "lists/");
+ equals(Cnf.FindDir("Dir::State"), "/rootdir/dev/null");
+ equals(Cnf.FindDir("Dir::State::lists"), "/rootdir/dev/null");
+
//FIXME: Test for configuration file parsing;
// currently only integration/ tests test them implicitly