According to the Canadian Parks authority there are two types of bear attack: defensive and predatory.
If a bear is behaving defensively, i.e. attacks you if you startle it, or to protect its cubs, the advice is to PLAY DEAD. The bear quickly sees that you pose no threat and will leave you alone. *
If the bear's behaviour is predatory e.g. if it stalks you along the trail or attacks you at night in your tent, the advice is to "FIGHT BACK! Use bear spray, rocks, sticks, whatever you can find - do whatever it takes to let the bear know you will not give up."
* If however after 2 minutes of playing dead the bear is still attacking, you've made a bad call in judging it to be non-predatory...
So now you know.