minetest-smartshop/util.lua:12: invalid option '%'' to 'format' #5962
Labels
No Label
1. kind/balancing
1. kind/breaking
1. kind/bug
1. kind/construction
1. kind/documentation
1. kind/enhancement
1. kind/griefing
1. kind/invalid
1. kind/meme
1. kind/node limit
1. kind/other
1. kind/protocol
2. prio/controversial
2. prio/critical
2. prio/elevated
2. prio/good first issue
2. prio/interesting
2. prio/low
3. source/art
3. source/client
3. source/engine
3. source/ingame
3. source/integration
3. source/lag
3. source/license
3. source/mod upstream
3. source/unknown
3. source/website
4. step/approved
4. step/at work
4. step/blocked
4. step/discussion
4. step/help wanted
4. step/needs confirmation
4. step/partially fixed
4. step/question
4. step/ready to deploy
4. step/ready to QA test
4. step/want approval
5. result/cannot reproduce
5. result/duplicate
5. result/fixed
5. result/maybe
5. result/wontfix
ugh/petz
ugh/QA main
ugh/QA NOK
ugh/QA OK
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: your-land/bugtracker#5962
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This was triggered in the main from attempting to buy canned carrots from BluOXide's haven shop. It occured twice, both time I was trying to purchase canned carrots.
The only thing I see odd is
%'s
in Line 78, but this is not the only occurrence.We couldn't reproduce on the testserver though
Looks like player was buying a stack while having space in the inventory for less than a stack.
Shop should just log the leftover amount, but there's a typo in the format string.
Basically every
%'s
should become%s's
.fixed the crash:
9e586ae4f7
it's worrying that it even gets to that point though, it's supposed to run a full simulation of the exchange using fake inventories before attempting to actually transfer the items. i'll look into it a bit further.
i can't replicate the issue locally with a full inventory, or with an almost full inventory with a partial stack of the full stack that's being bought.
@AliasAlreadyTaken is it possible to get the logs from your-land/log_yl_main#105 and your-land/log_yl_main#106 before the crash happened? the spam of entities unloading makes it hard to tell if there's other relevant context.
added some more logging as well
299d9af92f
I suggest that logs that go on gitea should be filtered from
deactivated
and probably some other messages. Those lines only push useful context out of the posted log.I assume that's the thing we're looking for:
2024-01-12 13:37:52: ACTION[Server]: [yl_commons] formspec "smartshop:form": DragonWrangler1 submitted {"buy3a":""}
2024-01-12 13:37:52: ACTION[Main]: Server: Shutting down
2024-01-12 13:39:59: ACTION[Server]: [yl_commons] formspec "smartshop:form": DragonWrangler1 submitted {"buy3a":""}
2024-01-12 13:39:59: ACTION[Main]: Server: Shutting down
if that's all that's there, it's not super helpful, but thanks :)
I dumbfixed it by replacing the
%'s
with%s's
.QA
Looks like it's fixed, I can't reproduce it.
i still want to know if there's error/warning level messages from the smartshop. i tried to make sure those never happened, but this bug means that there's something i'm not accounting for.
It was triggered by having a full inv, but having the payment for an item in my inv and it trying to exchange them
This is a case I tried with the bugfix
For some weird reason it's not as trivial to trigger, I was not able to repro it even once locally.
@DragonWrangler : do you remember exactly how much payment you had, if you already had some of the carrots in your inv, etc?
Maybe you can try reproduce it it locally too?
whosit I had gold split up into two groups on group had a bit over 20(not sure quite how much more) and the other had 2 gold. I already had carrots in my inv, but only a few. All I did was click on the carrots icon, the server crashed, when I reloaded some of my gold from the large stack was missing, I tried again and the same thing happened.
edit: I'll try to reproduce it.
I was able to replicate it in a private server on a previous version
edit: this was replicated on a previous version. Testing the newest one now.
Tested the newest version and I can't replicate it
Current version should not crash, but it should log errors.
Can you provide the errors from the log?
And also, can you please describe actual steps, so we could reproduce it too?
for the newest version there was no error, not even in the log. Here is the log error for the older Version:
to reproduce,first make a smartshop selling a stack of canned carrots for 2 gold each, then put items in your inv, fill every spot except 3, it doesn't matter what item, then put one canned carrot in one slot, and a stack of gold in the other. then put 2 gold ingots in the last remaining slot. After that purchase and it should crash.
Huh. So after a bit more testing, when I try it on the newest version it doesn't crash, however. If you try buying a stack of canned carrots and you already have some in your inv, but you have no other free slots, it will fill up the slot, but won't give you an error saying not enough room, so anything you don't have room for disappears
edit: it'll even do that if you have no room in your inv. The seller gets paid, but you don't receive items
2nd edit: I just tried it on the testserver and I can't reproduce it
3rd edit: I just reproduced it, have 2 different stacks of payment in your inv, also I got a message in my chat when trying to purchase telling me what was in my bags and inv, it said:
ERROR: DragonWrangler1 lost "canned_food:canned_potato 99" on add using BLuOXide's shop (2086,17,1144) (shop inv={
give1 = {
ItemStack("farming:baked_potato 99")
},
pay1 = {
ItemStack("default:gold_ingot")
},
give3 = {
ItemStack("canned_food:canned_carrot 99")
},
pay3 = {
ItemStack("default:gold_ingot 2")
},
give4 = {
ItemStack("farming:potato 99")
},
pay4 = {
ItemStack("default:gold_ingot")
},
main = {
ItemStack("farming:potato 99"),
ItemStack("canned_food:canned_potato 99"),
ItemStack("canned_food:canned_potato 99"),
ItemStack("canned_food:canned_potato 99"),
ItemStack("farming:potato 99"),
ItemStack("canned_food:canned_potato 99"),
ItemStack("canned_food:canned_potato 99"),
ItemStack("farming:potato 99"),
ItemStack("farming:potato 99"),
ItemStack("farming:potato 99"),
ItemStack("farming:potato 99"),
ItemStack("default:gold_ingot 12"),
ItemStack("canned_food:canned_potato 99"),
ItemStack(""),
ItemStack("farming:potato 99"),
ItemStack("farming:potato 99"),
ItemStack("farming:baked_potato 99"),
ItemStack("farming:baked_potato 99"),
ItemStack("farming:baked_potato 99"),
ItemStack("farming:baked_potato 99"),
ItemStack(""),
ItemStack(""),
ItemStack("farming:baked_potato 99"),
ItemStack("farming:baked_potato 99"),
ItemStack("farming:baked_potato 99"),
ItemStack("canned_food:canned_potato 99"),
ItemStack(""),
ItemStack("farming:baked_potato 99"),
ItemStack(""),
ItemStack(""),
ItemStack(""),
ItemStack(""),
},
pay2 = {
ItemStack("default:gold_ingot 3")
},
give2 = {
ItemStack("canned_food:canned_potato 99")
}
}) (player_inv={
craft = {
ItemStack(""),
ItemStack(""),
ItemStack(""),
ItemStack(""),
]
ItemStack(""),
ItemStack(""),
ItemStack(""),
ItemStack("moreblocks:slab_pine_wood_1 51"),
ItemStack("default:chest 3")
},
hand = {
ItemStack("skinsdb:charactermagem1png")
},
craftresult = {
ItemStack("")
},
main = {
ItemStack("moreores:enchante_sword_mithril_sharp 1 716"),
ItemStack("canned_food:canned_carrot 75"),
ItemStack("mobs:pick_lava 1 290"),
ItemStack("ethereal:golden_apple 87"),
ItemStack("mobs:lasso 1 2057"),
ItemStack("moreores:enchanted_pick_mithril_fast 1 2427"),
ItemStack("orbs_of_time:orb_dawn"),
ItemStack("anvil:anvil 2"),
ItemStack("anvil:hammer 1 7100"),
ItemStack("replacer:replacer 1 0 "),
ItemStack("anvil:hammer"),
ItemStack("fireflies:bug_net 1 24320"),
ItemStack("mobs:shears"),
ItemStack("default:gold_ingot 2"),
ItemStack("ethereal:shovel_crystal 1 7702"),
ItemStack("vines:shears 1 320"),
ItemStack("moreores:shovel_mithril 1 8784"),
ItemStack("moreblocks:stair_junglewood 3"),
ItemStack("map:mapping_kit"),
ItemStack("binoculars:binoculars"),
ItemStack("screwdriver:screwdriver 1 62584"),
ItemStack("default:gold_ingot 6"),
ItemStack("moreores:axe_mithril 1 3978"),
ItemStack("default:pine_wood 65"),
ItemStack("mobs:net 1 107"),
ItemStack("vessels:glass_bottle 99"),
ItemStack("doors:trapdoor 8"),
ItemStack("beds:fancy_bed_bottom 2"),
ItemStack("default:junglewood 5"),
ItemStack("wool:white 87"),
ItemStack("default:bookshelf"),
ItemStack("vessels:glass_bottle 5"),
},
craftpreview = {
ItemStack("")
}
})
I left out it's list of my bags' inv due to how long it might be to copy, but I can include that if you'd like
this is a very good clue
it should log it as an error. do you not see that in your logs?
EDIT: oh i see you did post the log
here's my setup:
i get the message "[smartshop] Cannot exchange: No room in your inventory"
try having less than one stack of gold in that one slot, I can reproduce it on test still
verified that if i've got 2 non-full stacks of payment, and everything else is random crap, i can replicate the issue. blech.
Just for the record, this setup works for me.
During "simulated exchange",
futil.FakeInventory()
takes item from the first stack and now there's space for the purchased items.But when actual exchange happens, real inventory removes items from the last stack, and there's no room for purchased item.
fixed in futil:
199191fac3
i also added some additional tests to the smartshop, but those aren't meaningful on a real server.
removeItem()
in cpp:eb52a149a0/src/inventory.cpp (L714C16-L714C23)
still not clear to me why it's backwards...
that's ... interesting. i'm about to call it a night, but it seems worth digging in to. it's c++, that code itself doesn't mean that the iteration order isn't backwards, but it's worth understanding.
i guess this never went through QA for some reason, but it's live.