← Commit list

004baba2d

Denis Vlasenko
Denis Vlasenko
2007-05-20
FAILED Duration: 11s

Subject

hush: fix shift + $0 bug; add testcase

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

shell/hush.c+1 -1
@@ -952,7 +952,7 @@ static int builtin_shift(char **argv)
n = atoi(argv[1]);
}
if (n >= 0 && n < global_argc) {
- /* XXX This probably breaks $0 */
+ global_argv[n] = global_argv[0];
global_argc -= n;
global_argv += n;
return EXIT_SUCCESS;
shell/hush_test/hush-misc/shift.right+2 -0
@@ -0,0 +1,2 @@
+./shift.tests abc d e
+./shift.tests d e
shell/hush_test/hush-misc/shift.tests+6 -0
@@ -0,0 +1,6 @@
+if test $# = 0; then
+ exec "$THIS_SH" $0 abc "d e"
+fi
+echo $0 $1 $2
+shift
+echo $0 $1 $2