infloop.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh
  2. # show that the following no longer makes ls infloop
  3. # mkdir loop; cd loop; ln -s ../loop sub; ls -RL
  4. # Also ensure ls exits with status = 2 in that case.
  5. # Copyright (C) 2001-2018 Free Software Foundation, Inc.
  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 of the License, or
  9. # (at your option) any later version.
  10. # This program 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 <https://www.gnu.org/licenses/>.
  16. . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
  17. print_ver_ ls
  18. mkdir loop || framework_failure_
  19. ln -s ../loop loop/sub || framework_failure_
  20. cat <<\EOF > exp-out || framework_failure_
  21. loop:
  22. sub
  23. EOF
  24. cat <<\EOF > exp-err || framework_failure_
  25. ls: loop/sub: not listing already-listed directory
  26. EOF
  27. # Ensure that ls exits with status 2 upon detecting a cycle
  28. returns_ 2 timeout 10 ls -RL loop >out 2>err || fail=1
  29. compare exp-err err || fail=1
  30. compare exp-out out || fail=1
  31. Exit $fail