It’s weird how so many discussions (elsewhere, anyway), freely confuse the two reasons for securing food - preventing loss of your food vs avoiding attracting a bear. I guess since neither is 100% effective, you just try anything you can. But when it gets to “he beat it up but couldn’t open it”, well, that’s just a more pissed-off bear.
I think the emphasis should be on preventing the bear from getting your food. That and making sure there is no food where you are sleeping for obvious reasons. With respect to attracting a bear, the bear knows you're there. If you're having a camp fire, cooking bacon, doing whatever and you're 50 yards away from your camp, the bear will put two and two together. And if you're in a Forest Service campground you have no choice - it's all happening in the same place and you can't help it. It's obvious to the bear where the people are and that they have food. Your clothes will smell of food even if you cook away from camp. Everything around your camp will smell of food and humans.
The better approach (IMO) is to keep a really clean camp and make sure everything is put away and locked. That way, if a bear does decide to come check out your camp, he doesn't find anything and moves on. And more importantly he doesn't become habituated for the next campers.
When I was backpacking a lot, a good trick I used was to stop and make dinner (which when backpacking was usually very simple rehydrated food, mac and cheese, etc), and then hike a couple more miles before making camp for the night. That way there was no cooking anywhere near my camp.