Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: scp file from windows10 to unix server

by bliako (Monsignor)
on Feb 18, 2020 at 18:01 UTC ( [id://11113116]=note: print w/replies, xml ) Need Help??


in reply to Re: scp file from windows10 to unix server
in thread scp file from windows10 to unix server

Just to confirm that I've struck similar issues (with various commands) over the years, and the first suggestion that haukex mentioned has worked, for reasons that I've never worked out.

The difference is: system($cmd) runs the command (with its contained arguments) via a shell which is spawn first, whereas the system($exename, @args) calls the $exename command directly without the mediation of any shell (unless of course it is a shell-interpreted script). In Unix, the shell will take care of wildcard expansion *.xyz and the interpretation of special variables, e.g. ~/. So, there is a difference in what finally is run. In windows I don't know if the shell does anything and what. I am sure that, in any OS, the added layer will have its effect on metacharacter quotation and escaping ...

If there is only one scalar argument, the argument is checked for shell metacharacters, and if there are any, the entire argument is passed to the system's command shell for parsing (this is /bin/sh -c on Unix platforms, but varies on other platforms). If there are no shell metacharacters in the argument, it is split into words and passed directly to execvp , which is more efficient. On Windows, only the system PROGRAM LIST syntax will reliably avoid using the shell; system LIST , even with more than one element, will fall back to the shell if the first spawn fails.

(from system manpage)

edit: removed a section and placed it in separate comment

bw, bliako

Replies are listed 'Best First'.
Re^3: scp file from windows10 to unix server
by haukex (Archbishop) on Feb 19, 2020 at 08:17 UTC
    whereas the system($exename, @args) calls the $exename command directly without the mediation of any shell

    On Windows, "The issue is not the shell."

      very interesting reading, thanks.

      SQL has injections, C (and lots others) have buffer overflows, I wonder if there are no exploits for this quoting madness.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11113116]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-16 22:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found