Rip toilet paper shabbos

can you rip toilet paper on shabbos if you’re careful not to rip on the perforations?

Nope

What about if it is a situation where a person would be stuck in the bathroom throughout shabbas?

Let’s review.

If a person finds himself “stuck” in the toilet with nothing but uncut toilet paper, he may cut an arbitrary amount (as apposed to a specific size) and not on the perforation.

As to your question regarding the entire shabbos, there is a well known Talmudic dictum , “mi she-tarach be erev shabbos yachal be shabbos”. Meaning in your case that before shabbos make sure you are adequately supplied with pre cut toilet paper or the like and you won’t have any problem.