|No such thing as a small change|
Re^3: system() call mis-directs?by afoken (Chancellor)
|on Mar 03, 2020 at 21:35 UTC||Need Help??|
The code currently looks like this:
Just from looking at the names of the functions, it has only two modes of operation: Either Windows, or Bourne Shell. No code for handling cygwin, OS/2 or DOS, so those three will be treated as Bourne Shell, which is plain wrong.
On Windows, you simply can not win the quoting game. Any code pretending to be able to do so is broken.
Assuming that all other systems use a bourne-compatible shell as default shell is at least optimistic. Severals systems have a korn shell as default, others even use a csh. See Various system shells.
Looking at the documentation of String::ShellQuote, handling the non-Windows part, the problem is obvious without even reading the source:
It seems nobody cared during the last 10 years, and the author either had no time to RTFM, or had no idea where to search for shell man pages.
So, with ShellQuote::Any, you are essentially lost if the current default shell is no bourne shell. I did not bother to read the quoting code in String::ShellQuote. As is, it is broken anyway, and with it ShellQuote::Any. Yes, it may work on many systems in their default configuration, but it won't do its job on all systems. It does not even prevent stupid things from happening on unknown systems.
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)