If you’re talking about a US citizen returning home, they can’t hold you indefinitely. If you disagree, I challenge you to find a counter example.
All bets are off if you’re a non-citizen entering another country, it depends on the laws and customs there.