{"action":"created","issue":{"url":"https://api.github.com/repos/minetest/minetest/issues/4382","repository_url":"https://api.github.com/repos/minetest/minetest","labels_url":"https://api.github.com/repos/minetest/minetest/issues/4382/labels{/name}","comments_url":"https://api.github.com/repos/minetest/minetest/issues/4382/comments","events_url":"https://api.github.com/repos/minetest/minetest/issues/4382/events","html_url":"https://github.com/minetest/minetest/issues/4382","id":168396058,"number":4382,"title":"Crafting recipes may be silently overwritten","user":{"login":"Wuzzy2","id":1675853,"avatar_url":"https://avatars.githubusercontent.com/u/1675853?v=3","gravatar_id":"","url":"https://api.github.com/users/Wuzzy2","html_url":"https://github.com/Wuzzy2","followers_url":"https://api.github.com/users/Wuzzy2/followers","following_url":"https://api.github.com/users/Wuzzy2/following{/other_user}","gists_url":"https://api.github.com/users/Wuzzy2/gists{/gist_id}","starred_url":"https://api.github.com/users/Wuzzy2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wuzzy2/subscriptions","organizations_url":"https://api.github.com/users/Wuzzy2/orgs","repos_url":"https://api.github.com/users/Wuzzy2/repos","events_url":"https://api.github.com/users/Wuzzy2/events{/privacy}","received_events_url":"https://api.github.com/users/Wuzzy2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-29T19:23:54Z","updated_at":"2016-07-29T20:12:55Z","closed_at":null,"body":"Consider this Lua code:\r\n```\r\nfor i=1,3 do\r\n\tminetest.register_craftitem(\"craft_bad:dummy\"..i, {\r\n\t\tdescription = \"Craft Testing Dummy Item \"..i,\r\n\t\tinventory_image = \"unknown_item\",\r\n\t\twield_image = \"unknown_item\",\r\n\t})\r\nend\r\nminetest.register_craft({\r\n\trecipe = {{\"craft_bad:dummy3\", \"craft_bad:dummy3\"}}, \r\n\toutput = \"craft_bad:dummy1\",\r\n})\r\nminetest.register_craft({\r\n\trecipe = {{\"craft_bad:dummy3\", \"craft_bad:dummy3\"}}, \r\n\toutput = \"craft_bad:dummy2\",\r\n})\r\n```\r\n\r\nThis registers 2 equal recipes with a different output. In other words, this should never happen in real Lua scripting.\r\nIf you execute this code, Minetest apparently **silently** overwrites the first crafting recipe, because if you try to to set the items into the crafting grid, you get `craft_bad:dummy2`. There is no warning, no error message and no log entry!\r\n\r\nIMO this is a pretty serious issue as careless modders can accidentally destroy the crafting recipe of another mod and it is hard to even notice.\r\n\r\nIf this occours, I suggest at the very *least* to print an error-level debug message. If this kind of bug occours in actual modding of subgame creation, it might be very hard to even notice or to track this down.\r\nThe error message should be written as soon a recipe with the exact same ingredients is registered.\r\n\r\nThis issue occours as well with the types shapeless, fuel, cooking and toolrepair.\r\n\r\nTested in Minetest 0.4.14."},"comment":{"url":"https://api.github.com/repos/minetest/minetest/issues/comments/236281863","html_url":"https://github.com/minetest/minetest/issues/4382#issuecomment-236281863","issue_url":"https://api.github.com/repos/minetest/minetest/issues/4382","id":236281863,"user":{"login":"t4im","id":1937987,"avatar_url":"https://avatars.githubusercontent.com/u/1937987?v=3","gravatar_id":"","url":"https://api.github.com/users/t4im","html_url":"https://github.com/t4im","followers_url":"https://api.github.com/users/t4im/followers","following_url":"https://api.github.com/users/t4im/following{/other_user}","gists_url":"https://api.github.com/users/t4im/gists{/gist_id}","starred_url":"https://api.github.com/users/t4im/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t4im/subscriptions","organizations_url":"https://api.github.com/users/t4im/orgs","repos_url":"https://api.github.com/users/t4im/repos","events_url":"https://api.github.com/users/t4im/events{/privacy}","received_events_url":"https://api.github.com/users/t4im/received_events","type":"User","site_admin":false},"created_at":"2016-07-29T20:12:55Z","updated_at":"2016-07-29T20:12:55Z","body":"Technic does that to deactivate or change crafts that mess with its game concept.\r\n\r\nBut i guess since `minetest.clear_craft(recipe)` was added, one could perhaps start **warning** about it, so such situations can be updated."}}
{"actor":{"display_login":"t4im"}}