While I don't have a definite and complete answer, there are a few points I would like to make.
I consider part of my duty to help studentstudents get the right information to chosechoose their path, and in France, it is actually listed in our official duties (this is relatively recent, was added less than a decade ago). So honesty is in order, really.
Before speaking the brutal truth, one should look into oneself for possible prejudice. One might overrate the importance of one's lecture because one feels it is the most important thing in the universe, while excellent grades in other lectures might make the student's record not so bad. One usually is influenced by common prejudice in our societies, and should be careful not to discourage female, working class or visible minorities students more strongly than wealthy white men. In some rare occasions, one might even find relevant to actually encourage some studentstudents who feel they can't do it while they are extremely bright and doing great (our students are usually subject to the same prejudice as we are, and it might be directed against themselves).
That said, given the toughness of the market to get a permanent position in academia, I now give the following advice to all but the very very brightest students, even if they do stand a chance: assume you enter graduate school, do a very good PhD, and then don't get a permanent position. Would you be ok with that, or would you regret spending these years in academia? If you can accept to move on after PhD, you may try it. If you'll regret it in case you don't land a job, I strongly advise you search another path. I give the same advice after PhD to young people deciding whether they should take post-docs (and how long they try): only take the post-doc you will be happy to have worked for itself.
It is also part of our responsibility, when we sit on admission committees or when asked to supervise a PhD (note that the system is different in France than in the US), to decline applications we do not believe firmly in. In France, there areis relatively little recognition of the PhD in the private sector, and because of this I actually think we currently train too many PhDs.