[LON-CAPA-cvs] cvs: loncom / lond
raeburn
raeburn at source.lon-capa.org
Thu Dec 26 20:04:00 EST 2024
raeburn Fri Dec 27 01:04:00 2024 EDT
Modified files:
/loncom lond
Log:
- Bug 6992. Add an eval{} block for nine calls to routines in customizable
localenroll.pm, to trap a die, so current lond child process is not killed
when a condition in localenroll.pm causes execution to exit with a "die".
Index: loncom/lond
diff -u loncom/lond:1.581 loncom/lond:1.582
--- loncom/lond:1.581 Sat Jun 22 14:29:36 2024
+++ loncom/lond Fri Dec 27 01:04:00 2024
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.581 2024/06/22 14:29:36 raeburn Exp $
+# $Id: lond,v 1.582 2024/12/27 01:04:00 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -65,7 +65,7 @@
my $status='';
my $lastlog='';
-my $VERSION='$Revision: 1.581 $'; #' stupid emacs
+my $VERSION='$Revision: 1.582 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid="default";
my $currentdomainid;
@@ -6150,12 +6150,13 @@
my ($cmd, $tail, $client) = @_;
my $userinput = $cmd.":".$tail; # For logging purposes.
-
my ($cdom) = split(/:/, $tail, 2); # Domain we're asking about.
-
- my $outcome = &localenroll::run($cdom);
+ my $outcome;
+ eval {
+ local($SIG{__DIE__})='DEFAULT';
+ $outcome = &localenroll::run($cdom);
+ };
&Reply($client, \$outcome, $userinput);
-
return 1;
}
®ister_handler("autorun", \&enrollment_enabled_handler, 0, 1, 0);
@@ -6188,8 +6189,12 @@
my ($dom,$instcode,$owner) = split(/:/, $tail);
$instcode = &unescape($instcode);
$owner = &unescape($owner);
- my ($outcome,$description,$credits) =
- &localenroll::validate_instcode($dom,$instcode,$owner);
+ my ($outcome,$description,$credits);
+ eval {
+ local($SIG{__DIE__})='DEFAULT';
+ ($outcome,$description,$credits) =
+ &localenroll::validate_instcode($dom,$instcode,$owner);
+ };
my $result = &escape($outcome).'&'.&escape($description).'&'.
&escape($credits);
&Reply($client, \$result, $userinput);
@@ -6223,10 +6228,14 @@
$instcode = &unescape($instcode);
$inst_xlist = &unescape($inst_xlist);
$coowner = &unescape($coowner);
- my $outcome = &localenroll::validate_crosslist_access($dom,$instcode,
- $inst_xlist,$coowner);
- &Reply($client, \$outcome, $userinput);
+ my $outcome;
+ eval {
+ local($SIG{__DIE__})='DEFAULT';
+ $outcome = &localenroll::validate_crosslist_access($dom,$instcode,
+ $inst_xlist,$coowner);
+ };
+ &Reply($client, \$outcome, $userinput);
return 1;
}
®ister_handler("autovalidateinstcrosslist", \&validate_instcrosslist_handler, 0, 1, 0);
@@ -6249,12 +6258,13 @@
my $userinput = "$cmd:$tail";
my ($coursecode, $cdom) = split(/:/, $tail);
- my @secs = &localenroll::get_sections($coursecode,$cdom);
- my $seclist = &escape(join(':', at secs));
-
+ my $seclist;
+ eval {
+ local($SIG{__DIE__})='DEFAULT';
+ my @secs = &localenroll::get_sections($coursecode,$cdom);
+ $seclist = &escape(join(':', at secs));
+ };
&Reply($client, \$seclist, $userinput);
-
-
return 1;
}
®ister_handler("autogetsections", \&get_sections_handler, 0, 1, 0);
@@ -6274,6 +6284,7 @@
# Returns:
# 1 - Processing should continue.
#
+
sub validate_course_owner_handler {
my ($cmd, $tail, $client) = @_;
my $userinput = "$cmd:$tail";
@@ -6281,11 +6292,12 @@
$owner = &unescape($owner);
$coowners = &unescape($coowners);
- my $outcome = &localenroll::new_course($inst_course_id,$owner,$cdom,$coowners);
+ my $outcome;
+ eval {
+ local($SIG{__DIE__})='DEFAULT';
+ $outcome = &localenroll::new_course($inst_course_id,$owner,$cdom,$coowners);
+ };
&Reply($client, \$outcome, $userinput);
-
-
-
return 1;
}
®ister_handler("autonewcourse", \&validate_course_owner_handler, 0, 1, 0);
@@ -6311,11 +6323,12 @@
my ($cmd, $tail, $client) = @_;
my $userinput = "$cmd:$tail";
my ($inst_course_id, $cdom) = split(/:/, $tail);
-
- my $outcome=&localenroll::validate_courseID($inst_course_id,$cdom);
+ my $outcome;
+ eval {
+ local($SIG{__DIE__})='DEFAULT';
+ $outcome=&localenroll::validate_courseID($inst_course_id,$cdom);
+ };
&Reply($client, \$outcome, $userinput);
-
-
return 1;
}
®ister_handler("autovalidatecourse", \&validate_course_section_handler, 0, 1, 0);
@@ -6349,7 +6362,6 @@
$outcome=&localenroll::check_section($inst_class,$owners,$cdom);
};
&Reply($client,\$outcome, $userinput);
-
return 1;
}
®ister_handler("autovalidateclass_sec", \&validate_class_access_handler, 0, 1, 0);
@@ -6482,10 +6494,11 @@
my ($authparam, $cdom) = split(/:/, $userinput);
my ($create_passwd,$authchk);
- ($authparam,
- $create_passwd,
- $authchk) = &localenroll::create_password($authparam,$cdom);
-
+ eval {
+ local($SIG{__DIE__})='DEFAULT';
+ ($authparam,$create_passwd,$create_passwd,$authchk) =
+ &localenroll::create_password($authparam,$cdom);
+ };
&Reply($client, &escape($authparam.':'.$create_passwd.':'.$authchk)."\n",
$userinput);
@@ -6721,12 +6734,16 @@
my ($key,$value) = split/=/,$_;
$instcodes{&unescape($key)} = &unescape($value);
}
- my $formatreply = &localenroll::instcode_format($cdom,
- \%instcodes,
- \%codes,
- \@codetitles,
- \%cat_titles,
- \%cat_order);
+ my $formatreply;
+ eval {
+ local($SIG{__DIE__})='DEFAULT';
+ $formatreply = &localenroll::instcode_format($cdom,
+ \%instcodes,
+ \%codes,
+ \@codetitles,
+ \%cat_titles,
+ \%cat_order);
+ };
if ($formatreply eq 'ok') {
my $codes_str = &Apache::lonnet::hash2str(%codes);
my $codetitles_str = &Apache::lonnet::array2str(@codetitles);
@@ -6786,11 +6803,15 @@
my $reply;
my $cdom = $tail;
my (@codetitles,%cat_titles,%cat_order, at code_order);
- my $formatreply = &localenroll::possible_instcodes($cdom,
- \@codetitles,
- \%cat_titles,
- \%cat_order,
- \@code_order);
+ my $formatreply;
+ eval {
+ local($SIG{__DIE__})='DEFAULT';
+ $formatreply = &localenroll::possible_instcodes($cdom,
+ \@codetitles,
+ \%cat_titles,
+ \%cat_order,
+ \@code_order);
+ };
if ($formatreply eq 'ok') {
my $result = join('&',map {&escape($_);} (@codetitles)).':';
$result .= join('&',map {&escape($_);} (@code_order)).':';
More information about the LON-CAPA-cvs
mailing list