kstart 4.3 (unreleased)
+ If the process run by k5start or krenew is killed by a signal, k5start
+ or krenew now exits with status 128 plus the killing signal rather
+ than zero. This avoids the caller of k5start or krenew thinking the
+ command succeeded when it was killed, and matches the return status
+ behavior of bash. Patch from Aasif Versi.
+
Rename the script to bootstrap from a Git checkout to bootstrap,
matching the emerging consensus in the Autoconf world.
#
# SPDX-License-Identifier: MIT
+use POSIX qw(SIGTERM);
use Test::More;
# The full path to the newly-built k5start client.
($out, $err, $status)
= command ($K5START, '-Uqf', "$DATA/test.keytab", '--', 'sh', '-c',
'kill $$');
-is ($status, 143, 'k5start of kill $$ returns correct exit status');
+is ($status, 128 + SIGTERM, 'k5start of kill $$ returns correct exit status');
is ($err, '', ' with no errors');
ok (!-f 'krb5cc_test', ' and the default cache file was not created');
sleep 1;
kill (SIGTERM, $child) or BAIL_OUT ("cannot send SIGTERM to child $child\n");
waitpid ($pid, 0);
-is ($? >> 8, 0, 'command succeeded');
+is ($? >> 8, 128 + SIGTERM, 'command killed with SIGTERM');
ok (time < $start + 5, 'k5start got SIGCHLD and woke up properly');
unlink 'child-pid';
# SPDX-License-Identifier: MIT
use IPC::Open3 qw(open3);
+use POSIX qw(SIGTERM);
use Test::More;
# The full path to the newly-built krenew client.
plan skip_all => 'cannot get renewable tickets';
exit 0;
}
- plan tests => 36;
+ plan tests => 39;
}
# We should be okay for five minute tickets without doing anything.
ok (!$cache || !-f $cache, ' and the new cache file was deleted');
ok (-f 'krb5cc_test', ' and the default cache file was unaffected');
+# Test propagation of exit status from a command which is killed by signal.
+($out, $err, $status) = command ($KRENEW, '--', 'sh', '-c', 'kill $$');
+is ($status, 128 + SIGTERM, 'krenew of kill $$ returns correct exit status');
+is ($err, '', ' with no errors');
+ok (-f 'krb5cc_test', ' and the default cache file was unaffected');
+
# Check exit status if the ticket cache doesn't exist.
unlink 'krb5cc_test';
($out, $err, $status) = command ($KRENEW);
if (WIFEXITED(*status))
*status = WEXITSTATUS(*status);
else if (WIFSIGNALED(*status))
- // +128 to match exit status set by bash when process is signaled
+ /*
+ * Use the adjusted process signal as the exit status. This
+ * duplicates the exit status behavior of bash.
+ */
*status = WTERMSIG(*status) + 128;
}