2
1

busybox-1.14.2-test.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. diff -urpN busybox-1.14.2/coreutils/test.c busybox-1.14.2-test/coreutils/test.c
  2. --- busybox-1.14.2/coreutils/test.c 2009-07-05 22:59:28.000000000 +0200
  3. +++ busybox-1.14.2-test/coreutils/test.c 2009-07-17 01:46:28.000000000 +0200
  4. @@ -571,7 +571,14 @@ static number_t nexpr(enum token n)
  5. nest_msg(">nexpr(%s)\n", TOKSTR[n]);
  6. if (n == UNOT) {
  7. - res = !nexpr(check_operator(*++args));
  8. + n = check_operator(*++args);
  9. + if (n == EOI) {
  10. + /* special case: [ ! ], [ a -a ! ] are valid */
  11. + /* IOW, "! ARG" may miss ARG */
  12. + unnest_msg("<nexpr:1 (!EOI)\n");
  13. + return 1;
  14. + }
  15. + res = !nexpr(n);
  16. unnest_msg("<nexpr:%lld\n", res);
  17. return res;
  18. }
  19. @@ -742,7 +749,7 @@ int test_main(int argc, char **argv)
  20. check_operator(argv[1]);
  21. if (last_operator->op_type == BINOP) {
  22. /* "test [!] arg1 <binary_op> arg2" */
  23. - args = &argv[0];
  24. + args = argv;
  25. res = (binop() == 0);
  26. goto ret;
  27. }
  28. @@ -755,7 +762,7 @@ int test_main(int argc, char **argv)
  29. argv--;
  30. }
  31. #endif
  32. - args = &argv[0];
  33. + args = argv;
  34. res = !oexpr(check_operator(*args));
  35. if (*args != NULL && *++args != NULL) {
  36. diff -urpN busybox-1.14.2/testsuite/test.tests busybox-1.14.2-test/testsuite/test.tests
  37. --- busybox-1.14.2/testsuite/test.tests 2009-07-05 22:59:22.000000000 +0200
  38. +++ busybox-1.14.2-test/testsuite/test.tests 2009-07-17 01:46:28.000000000 +0200
  39. @@ -21,6 +21,11 @@ testing "test '': should be false (1)" \
  40. "1\n" \
  41. "" ""
  42. +testing "test !: should be true (0)" \
  43. + "busybox test !; echo \$?" \
  44. + "0\n" \
  45. + "" ""
  46. +
  47. testing "test a: should be true (0)" \
  48. "busybox test a; echo \$?" \
  49. "0\n" \
  50. @@ -51,6 +56,11 @@ testing "test -lt = -gt: should be false
  51. "1\n" \
  52. "" ""
  53. +testing "test a -a !: should be true (0)" \
  54. + "busybox test a -a !; echo \$?" \
  55. + "0\n" \
  56. + "" ""
  57. +
  58. testing "test -f = a -o b: should be true (0)" \
  59. "busybox test -f = a -o b; echo \$?" \
  60. "0\n" \