map.at 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. #
  3. # Test suite for GNU tar.
  4. # Copyright 2015-2023 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. # Check the --owner-map and --group-map options.
  19. AT_SETUP([--owner-map and --group-map])
  20. AT_KEYWORDS([owner map])
  21. AT_TAR_CHECK([
  22. export TZ=UTC0
  23. genfile --file a
  24. set -- `genfile --stat=uid,gid a`
  25. cat > uid.map <<EOT
  26. # Owner mapping
  27. +$1 "Joe the Plumber:1234"
  28. EOT
  29. # Group mapping
  30. cat > gid.map <<EOT
  31. +$2 "Plumber's Union:5678"
  32. EOT
  33. tar --owner-map=uid.map\
  34. --group-map=gid.map\
  35. --owner="Fallback Owner:4321" \
  36. --group="Fallback Group:8765" \
  37. --mtime='@0' \
  38. --mode='u=rw,go=r' \
  39. -cf 1.tar a
  40. tar -tvf 1.tar
  41. tar --numeric-owner -tvf 1.tar
  42. > uid.map
  43. > gid.map
  44. tar --owner-map=uid.map\
  45. --group-map=gid.map\
  46. --owner="Fallback Owner:4321" \
  47. --group="Fallback Group:8765" \
  48. --mtime='@0' \
  49. --mode='u=rw,go=r' \
  50. -cf 2.tar a
  51. tar -tvf 2.tar
  52. tar --numeric-owner -tvf 2.tar
  53. ],
  54. [0],
  55. [-rw-r--r-- Joe the Plumber/Plumber's Union 0 1970-01-01 00:00 a
  56. -rw-r--r-- 1234/5678 0 1970-01-01 00:00 a
  57. -rw-r--r-- Fallback Owner/Fallback Group 0 1970-01-01 00:00 a
  58. -rw-r--r-- 4321/8765 0 1970-01-01 00:00 a
  59. ],
  60. [],[],[],[gnu])
  61. AT_CLEANUP