test-bug-604401-files-are-directories 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture "i386"
  7. setupaptarchive
  8. test ! -e rootdir/etc/apt/apt.conf || mv rootdir/etc/apt/apt.conf rootdir/etc/apt/apt.conf.d/000move-away-apt.conf
  9. msgtest "Directory instead of a file as apt.conf ignored"
  10. mkdir -p rootdir/etc/apt/apt.conf
  11. testsuccess --nomsg aptconfig dump
  12. rmdir rootdir/etc/apt/apt.conf
  13. msgtest "Good link instead of a file as apt.conf ignored"
  14. echo 'Test::APT::Link "good";' > rootdir/etc/apt/good-link.conf
  15. ln -s rootdir/etc/apt/good-link.conf rootdir/etc/apt/apt.conf
  16. testempty aptconfig shell TestLink 'Test::APT::Link'
  17. rm rootdir/etc/apt/apt.conf
  18. msgtest "Broken link instead of a file as apt.conf ignored"
  19. ln -s /tmp/doesnt-exist rootdir/etc/apt/apt.conf
  20. testsuccess --nomsg aptconfig dump
  21. rm rootdir/etc/apt/apt.conf
  22. test ! -e rootdir/etc/apt/sources.list || mv rootdir/etc/apt/sources.list rootdir/etc/apt/sources.list.d/000move-away-sources.list
  23. msgtest "Directory instead of a file as sources.list ignored"
  24. mkdir -p rootdir/etc/apt/sources.list
  25. testsuccess --nomsg aptget update --print-uris
  26. rmdir rootdir/etc/apt/sources.list
  27. msgtest "Good link instead of a file as sources.list ignored"
  28. echo 'deb file:///tmp/debian sid main' > rootdir/etc/apt/good-link.list
  29. ln -s rootdir/etc/apt/good-link.list rootdir/etc/apt/sources.list
  30. testempty aptget update --print-uris
  31. rm rootdir/etc/apt/sources.list
  32. msgtest "Broken link instead of a file as sources.list ignored"
  33. ln -s /tmp/doesnt-exist rootdir/etc/apt/sources.list
  34. testempty aptget update --print-uris
  35. rm rootdir/etc/apt/sources.list
  36. test ! -e rootdir/etc/apt/preferences || mv rootdir/etc/apt/preferences rootdir/etc/apt/preferences.d/000move-away-preferences
  37. msgtest "Directory instead of a file as preferences ignored"
  38. mkdir -p rootdir/etc/apt/preferences
  39. testsuccess --nomsg aptcache policy
  40. rmdir rootdir/etc/apt/preferences
  41. msgtest "Good link instead of a file as preferences ignored"
  42. echo 'Package: apt
  43. Pin: release a=now
  44. Pin-Value: 1000' > rootdir/etc/apt/good-link.pref
  45. ln -s rootdir/etc/apt/good-link.pref rootdir/etc/apt/preferences
  46. testsuccess aptcache policy
  47. testfailure grep '1000 ' rootdir/tmp/testsucess.output
  48. rm rootdir/etc/apt/preferences
  49. msgtest "Broken link instead of a file as preferences ignored"
  50. ln -s /tmp/doesnt-exist rootdir/etc/apt/preferences
  51. testsuccess --nomsg aptcache policy
  52. rm rootdir/etc/apt/preferences