Ok, you've given us the reasons why a firearm, specifically the CAR-15, "might" not work. Apply the same Tueller Drill logic if armed with a katana. Think you can reach, deploy, engage the "enemy", and successfully fend off the SAME knife wielding attacker? I think not, and I'm guessing you wouldn't bet your life on it either. Like someone else said, you've got at least one shot, make it count.
At 21 feet or less, I don't think the 10" barrel is going to be a handicap. How many self-defense handguns do you see with a 10" barrel? The Military may be limited to FMJ ammunition, but as a civilian, you are NOT. That "tiny" 5.56mm bullet travelling at high velocity (JHP or JSP) is not going to be pretty on impact. Please note, I DID NOT say it was the standard by which all rifle calibers should be judged, because it isn't. Frankly, I'm not a big fan of it. But, you asked about a 5.56mm vs. a sword. I'll take the rifle anyday.
There is a very good reason we "upgraded" from edged knives, swords, spears, and arrows. And that was when BOTH sides were equally armed. If an enemy is close enough for me to engage him with a bayonet, he's too damned close. Same logic applies here. For me to "defend" myself with a katana, he's too damned close. SHOOT HIS ASS. Repeatedly if necessarry.
Sure the rifle might jam, then you have a club. But hey, the sword might break or be dull
. That's why you practice and keep your firearms in the best condition you can, so it will work when called upon.