Being troubled by the Canaanite genocide, I re-read Joshua over the weekend. Rahab submits to Yahweh and helps His people, and she and her family are spared. The Gibeonites trick Joshua, but make peace and are spared. They are punished for the deceit and are made hewers of wood and drawers of water. But that punishment was not part of the condition for making peace. In other words, had they just come to Joshua and sued for peace, it would have been granted to them. Later, the Gibeonites are attacked by neighboring Canaanites for making peace with the Israelites. It seems clear that the other Canaanites were not willing to sue for peace. In chapter 11, we are told,
"18 Joshua made war a long time with all those kings. 19 There was not a city that made peace with the people of Israel, except the Hivites, the inhabitants of Gibeon; they took all in battle. 20 For it was the Lord’s doing to harden their hearts that they should come against Israel in battle, in order that they should be utterly destroyed, and should receive no mercy but be exterminated, as the Lord commanded Moses."
It is clear that if the Canaanites had sued for peace, mercy would have been shown and peace would have been granted.
The idea that Israel was commanded to slaughter the Canaanites indiscriminately, regardless of whether or not they were willing to accept Yahweh and His people Israel is false. The Canaanites, for the most part, were people who knew that Yahweh had miraculously brought His people into the land, and yet they continued to refuse to worship Him, and tried to eliminate His people Israel. That is why they were slaughtered.