4
0

extrac18.at 1.7 KB

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