extrac18.at 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. #
  3. # Test suite for GNU tar.
  4. # Copyright (C) 2011 Free Software Foundation, Inc.
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 3, or (at your option)
  9. # any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. # Description: Check the functionality of the --keep-old-files option.
  19. # It should report an error and cause tar to exit with status 2.
  20. #
  21. # There was a regression in versions 1.23 to 1.26 inclusive, where
  22. # this option silently skipped such files.
  23. # Reported by: Doug McLaren <[email protected]>,
  24. # Gary Partis <[email protected]>,
  25. # Jim Meyering <[email protected]>
  26. #
  27. # References: <[email protected]>,
  28. # <[email protected]>,
  29. # <[email protected]>
  30. AT_SETUP([keep-old-files])
  31. AT_KEYWORDS([extract extrac18 old-files keep-old-files])
  32. AT_TAR_CHECK([
  33. mkdir dir
  34. cd dir
  35. echo 'Old file a' > a
  36. echo 'Old file b' > b
  37. tar cf ../archive .
  38. rm b
  39. echo 'File a' > a
  40. tar -x -k -f ../archive
  41. echo status=$?
  42. cat a
  43. ],
  44. [0],
  45. [status=2
  46. File a
  47. ],
  48. [tar: ./a: Cannot open: File exists
  49. tar: Exiting with failure status due to previous errors
  50. ])
  51. AT_CLEANUP