test-bug-818628-unreadable-source 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64' 'i386'
  7. if [ "$(id -u)" = "0" ]; then
  8. msgskip "Tests for unreadable sources.list do not work as root"
  9. exit 0
  10. fi
  11. insertinstalledpackage 'apt' 'i386' '1'
  12. buildsimplenativepackage 'apt' 'i386' '2' 'unstable'
  13. setupaptarchive
  14. # Test unreadable sources.list files
  15. chmod -r rootdir/etc/apt/sources.list.d
  16. testfailureequal "E: Unable to read $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list.d/ - opendir (13: Permission denied)
  17. W: You may want to run apt-get update to correct these problems
  18. E: The package cache file is corrupted" aptcache policy apt
  19. testfailureequal "E: Unable to read $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list.d/ - opendir (13: Permission denied)
  20. W: You may want to run apt-get update to correct these problems
  21. E: The package cache file is corrupted" apt search apt
  22. chmod +r rootdir/etc/apt/sources.list.d
  23. # Test unreadable sources.list files
  24. chmod -r rootdir/etc/apt/sources.list.d/apt-test-unstable-deb-src.list
  25. testfailureequal "E: Opening $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list.d/apt-test-unstable-deb-src.list - ifstream::ifstream (13: Permission denied)
  26. E: The list of sources could not be read.
  27. E: Opening $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list.d/apt-test-unstable-deb-src.list - ifstream::ifstream (13: Permission denied)
  28. E: The list of sources could not be read." aptcache policy apt
  29. testfailureequal "E: Opening $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list.d/apt-test-unstable-deb-src.list - ifstream::ifstream (13: Permission denied)
  30. E: The list of sources could not be read." apt search apt
  31. chmod +r rootdir/etc/apt/sources.list.d/apt-test-unstable-deb-src.list