Re: dchroot scripts
cookedm+news@physics.mcmaster.ca (David M. Cooke) writes:
> There are actually two separate problems with quoting in dchroot, and
> they're both caused by interaction with su:
>
> Bug #249655: "dchroot -d ls -l" broken: su tries to interpret -l switch
> * dchroot doesn't call su with -- before the command, so su tries to
> interpret anything in the command that looks like one of it's options.
Right: this is a definite dchroot problem.
> Bug #276419: su appends the positional args to the command line
> * Using su username command arg1 arg2, su calls sh -c with the string
> "command arg1 arg2" using execv, instead of execvp. So spaces, etc.
> screw you up. If it used execvp, you wouldn't have to do the quoting.
?? You mean it calls
execv("/bin/sh", { "-c", "command arg1 arg2", 0 }) <--- you know what I mean
? Because that's what it *should* do. The only difference between
this and execvp is that the "p" is for "path", as in PATH search. I
think you're confused.
Besides, I'm guessing this won't be fixed in su: su's behavior in this
regard is well-understood, and shouldn't be changed even if everyone
agrees it's buggy. And I don't agree: sh -c "XYZ" should be
equivalent (modulo different login files being loaded) to running sh
and typing XYZ at the command line. This means you need to properly
quote, which is what quote-args and quote-sh are for.
Cheers,
Kyle
Reply to: