Skip to content

Commit 387cc04

Browse files
thefallentreeclaude
andcommitted
Fix 4 bugs found in jinyongqunxiazhuan2008_std's deep functional test
Same engine-level shapes as sibling jinyongqunxiazhuan2008 (byte-identical pre-fix), all live-reproduced independently on this lib: - adm/daemons/chinesed.lpc: §7.7 -- unguarded restore() on corrupted seed data crashed dict to raw 0, breaking every xue/cha call. - adm/daemons/combatd.lpc, cmds/std/kill.lpc, cmds/skill/{bai, apprentice}.lpc: §7.11 -- missing /log/nosave/ directory crashed killer_reward() uncaught mid-die(), a real death softlock. Fixed with assure_file(). - cmds/skill/{bai,apprentice}.lpc: a misplaced parenthesis passed a boolean into query() instead of a string key, permanently disabling a defection-counter branch; also added a stringp() guard before atoi() on the same read. - adm/simul_efun/message.lpc: §7.12 -- tell_room()'s 2-arg form passed bare int 0 as exclude. Live-reproduced via a direct user_dump(1) call throwing inside the net-dead branch, silently disabling the entire net-dead force-quit safety net (29 call sites across 16 files use the vulnerable form). The death/reincarnation startroom-write discriminator from the sibling's retracted false positive was applied explicitly to d/city/wumiao.lpc and d/death/gate.lpc here too (both target rooms carry valid_startroom, consistent with intentional design) plus a sweep of 28 other set("startroom"...) sites -- no further instances of the real bug found. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VyQCUoTo1Z93Py9aVFHQi1
1 parent 8fa1d90 commit 387cc04

10 files changed

Lines changed: 393 additions & 8 deletions

File tree

libs/jinyongqunxiazhuan2008_std/NOTES.md

Lines changed: 372 additions & 0 deletions
Large diffs are not rendered by default.

libs/jinyongqunxiazhuan2008_std/work/adm/daemons/chinesed.lpc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ void remove_translate(string key);
2424

2525
void create() {
2626
seteuid(getuid());
27-
restore();
27+
catch(restore());
28+
if (!mapp(dict)) dict = ([]);
2829
}
2930

3031
void remove() {

libs/jinyongqunxiazhuan2008_std/work/adm/daemons/combatd.lpc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ void killer_reward(object killer, object victim) {
717717
victim->delete_temp("die_reason");
718718
CHANNEL_D->do_channel(this_object(), "rumor",
719719
sprintf("我看到%s" + msg1 + "。真是好惨。", victim->name(1)));
720+
assure_file("/log/nosave/KILLRECORD");
720721
write_file(
721722
"/log/nosave/KILLRECORD",
722723
sprintf(

libs/jinyongqunxiazhuan2008_std/work/adm/simul_efun/message.lpc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void tell_object(object ob, string str) {
3232
}
3333

3434
varargs void tell_room(mixed ob, string str, object *exclude) {
35-
if (ob) message("tell_room", str, ob, exclude);
35+
if (ob) message("tell_room", str, ob, exclude || ({}));
3636
}
3737

3838
void shout(string str) {

libs/jinyongqunxiazhuan2008_std/work/cmds/skill/apprentice.lpc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,16 @@ int main(object me, string arg) {
5353
// If the target is willing to recruit us already, we do it.
5454

5555
if ((object)ob->query_temp("pending/recruit") == me) {
56-
if (((string)me->query("family/master_id" == "feng qingyang")) || ((string)me->query("family/master_name" == "风清扬"))) {
56+
if (((string)me->query("family/master_id") == "feng qingyang") || ((string)me->query("family/master_name") == "风清扬")) {
5757
temp = read_file("/log/nosave/FENG", 1, 1);
58-
student_num = atoi(temp);
58+
student_num = stringp(temp) ? atoi(temp) : 0;
5959
if (student_num == 1)
6060
temp = "0";
6161
else if (student_num == 2)
6262
temp = "1";
6363
else if (student_num == 3)
6464
temp = "2";
65+
assure_file("/log/nosave/FENG");
6566
write_file("/log/nosave/FENG", temp, 1);
6667
line = "风清扬现在共有" + temp + "个徒弟。\n";
6768
write(line);

libs/jinyongqunxiazhuan2008_std/work/cmds/skill/bai.lpc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,16 @@ int main(object me, string arg) {
5353
// If the target is willing to recruit us already, we do it.
5454

5555
if ((object)ob->query_temp("pending/recruit") == me) {
56-
if (((string)me->query("family/master_id" == "feng qingyang")) || ((string)me->query("family/master_name" == "风清扬"))) {
56+
if (((string)me->query("family/master_id") == "feng qingyang") || ((string)me->query("family/master_name") == "风清扬")) {
5757
temp = read_file("/log/nosave/FENG", 1, 1);
58-
student_num = atoi(temp);
58+
student_num = stringp(temp) ? atoi(temp) : 0;
5959
if (student_num == 1)
6060
temp = "0";
6161
else if (student_num == 2)
6262
temp = "1";
6363
else if (student_num == 3)
6464
temp = "2";
65+
assure_file("/log/nosave/FENG");
6566
write_file("/log/nosave/FENG", temp, 1);
6667
line = "风清扬现在共有" + temp + "个徒弟。\n";
6768
write(line);

libs/jinyongqunxiazhuan2008_std/work/cmds/std/kill.lpc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ int main(object me, string arg) {
3333

3434
me->kill_ob(obj);
3535
// Add by jungu
36-
if (userp(obj))
36+
if (userp(obj)) {
37+
assure_file("/log/nosave/ATTEMP_KILL");
3738
write_file("/log/nosave/ATTEMP_KILL", sprintf("%s 试图杀死 %s on %s\n",
3839
me->name(1), obj->name(1), ctime(time())));
40+
}
3941
// Look for PKS
4042
if (!userp(obj))
4143
obj->kill_ob(me);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#/clone/user/login.lpc
2+
dbase (["registered":1,"email":"test@example.com","last_from":"localhost","password":"$6$/p3pDahYNymSlH67$8u.gTUVk5a6G2fYQjOjp.4tIty7pS84ulh5e2Isli8ijWLZfSRdxm6mKKpOkeJ8p1XruWGwJXv4f8uS2Gv8oP1","id":"shenrongfeng","last_on":1784965705,"body":"/clone/user/user","name":"沈容风",])
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#/clone/user/user.lpc
2-
dbase (["int":21,"registered":1,"max_jing":100,"qi":100,"id":"fluffos","title":"普通百姓","dex":21,"jing":100,"actions":,"cwf":"/cmds/usr/score.lpc","birthday":1784863514,"channels":({"chat","rumor","music",}),"per":24,"pighead":0,"default_actions":,"race":"人类","startroom":"/d/city/kedian","kar":28,"gender":"男性","shen_type":0,"con":22,"eff_jing":100,"max_qi":100,"age":14,"str":16,"potential":99,"shen":0,"mud_age":0,"name":"浮浮","eff_qi":100,])
2+
dbase (["int":21,"max_jing":100,"registered":1,"qi":-1,"title":"普通百姓","id":"fluffos","dex":21,"jing":0,"combat_exp":0,"actions":,"cwf":"/cmds/usr/score.lpc","pighead":0,"per":24,"channels":({"chat","rumor","music",}),"birthday":1784863514,"default_actions":,"race":"人类","gender":"男性","kar":28,"startroom":"/d/city/kedian","con":22,"shen_type":0,"max_qi":100,"eff_jing":100,"age":14,"disable_type":" <昏迷不醒>","str":16,"potential":50,"name":"浮浮","mud_age":0,"shen":0,"eff_qi":33,])
33
autoload ({})
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#/clone/user/user.lpc
2+
dbase (["max_jing":100,"qi":100,"title":"丐帮第二十代弟子","dex":22,"jing":84,"birthday":1784964716,"channels":({"chat","rumor","music",}),"per":16,"pighead":0,"default_actions":,"class":"beggar","race":"人类","gender":"男性","startroom":"/d/city/kedian","con":21,"eff_jing":100,"potential":99,"mud_age":51,"name":"沈容风","int":19,"registered":1,"id":"shenrongfeng","actions":,"learned_points":1,"kar":24,"shen_type":0,"max_qi":100,"age":14,"str":18,"family":(["enter_time":1784964989,"title":"弟子","privs":0,"master_id":"zuo quan","family_name":"丐帮","master_name":"左全","generation":20,]),"shen":0,"eff_qi":100,])
3+
skills (["begging":1,])
4+
learned (["begging":0,])
5+
autoload ({})

0 commit comments

Comments
 (0)