Re: I need the rules for qx with a pipe inside

2017-03-08 Thread ToddAndMargo
On 03/08/2017 06:41 AM, yary wrote: On Wed, Mar 8, 2017 at 3:13 AM, ToddAndMargo mailto:toddandma...@zoho.com>> wrote: This guy's workaround is sub clipboard-slash($text) {... And there's another part to the workaround: the code adds double-quotes around the string to be pasted when i

Re: I need the rules for qx with a pipe inside

2017-03-08 Thread yary
On Wed, Mar 8, 2017 at 3:13 AM, ToddAndMargo wrote: > This guy's workaround is sub clipboard-slash($text) {... > And there's another part to the workaround: the code adds double-quotes around the string to be pasted when it's creating the shell string. The shell sees the double quotes, whic

Re: I need the rules for qx with a pipe inside

2017-03-08 Thread ToddAndMargo
On 03/07/2017 11:46 PM, yary wrote: No, my main intent is showng that the code won't copy a string with a quote in it, and can have unintended side effects. I was thinking you were concerned over security, This guy's workaround is https://github.com/kmwallio/p6-OS-Clipboard/blob/master/lib/OS

Re: I need the rules for qx with a pipe inside

2017-03-07 Thread yary
cc'ing the list again, since my reply has Timo's code formatted in a more readable & useful way- On Wed, Mar 8, 2017 at 1:58 AM, ToddAndMargo wrote: > Are you saying that someone could go into a module, alter the code, > then catch a root level program calling the module and use it > to wreck ha

Re: I need the rules for qx with a pipe inside

2017-03-07 Thread ToddAndMargo
On 03/07/2017 05:05 PM, yary wrote: On Tue, Mar 7, 2017 at 11:51 AM, ToddAndMargo mailto:toddandma...@zoho.com>> wrote: I have it running perfectly with the sub I showed. Thank you for the help! I enjoy helping out and you've stuck through our suggestions in the past. Stick through t

Re: I need the rules for qx with a pipe inside

2017-03-07 Thread ToddAndMargo
On 03/07/2017 09:29 AM, Timo Paulssen wrote: For example: > > sub WriteSecondaryClipboard ( $Str ) { # my $Cmd = "echo \"$Str\" | xclip -selection clipboard"; shell $Cmd; } > > > problem solved. Please don't forget that if $Str can be modified by a user or outside process somehow, you've

Re: I need the rules for qx with a pipe inside

2017-03-07 Thread Timo Paulssen
> For example: > > sub WriteSecondaryClipboard ( $Str ) { # >my $Cmd = "echo \"$Str\" | xclip -selection clipboard"; > shell $Cmd; > } > > > problem solved. Please don't forget that if $Str can be modified by a user or outside process somehow, you've opened the door to remote code execution

Re: I need the rules for qx with a pipe inside

2017-03-06 Thread ToddAndMargo
On 03/06/2017 12:20 AM, ToddAndMargo wrote: qx{ echo $Str | xclip -selection primary }; passes syntax, but hangs when run Hi All, I figured it out. The reason the above "hangs" is because it is "ambiguous". What is Perl and what is bash are not tightly delineated. Is "$Str" the name of a

Re: I need the rules for qx with a pipe inside

2017-03-06 Thread ToddAndMargo
On 03/06/2017 02:21 AM, ToddAndMargo wrote: Why is he putting the commands into an array He's being "fancy". -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~

Re: I need the rules for qx with a pipe inside

2017-03-06 Thread ToddAndMargo
On 03/06/2017 12:20 AM, ToddAndMargo wrote: qx{ echo $Str | xclip -selection primary }; passes syntax, but hangs when run I figured it out. I will get back later today with and explanation and examples -- ~~ Computers are like air conditioners. They malfun

Re: I need the rules for qx with a pipe inside

2017-03-06 Thread ToddAndMargo
On 03/06/2017 01:55 AM, Timo Paulssen wrote: Is there a way to send and "end of file" marker to terminate the pipe? That is exactly what the call to .close does. Looking over at https://github.com/kmwallio/p6-OS-Clipboard/blob/master/lib/OS/Clipboard.pm6 lines 47 to 52 sub clipboard-cop

Re: I need the rules for qx with a pipe inside

2017-03-06 Thread Timo Paulssen
> Is there a way to send and "end of file" marker to terminate the pipe? That is exactly what the call to .close does.

Re: I need the rules for qx with a pipe inside

2017-03-06 Thread ToddAndMargo
On 03/06/2017 01:32 AM, Timo Paulssen wrote: This is because of how xclip works. It keeps running until you kill it, or until the number of pastes has been reached that you specify with -loops. You will want to use Proc::Async or run with an :in parameter instead of shelling into a redirect with

Re: I need the rules for qx with a pipe inside

2017-03-06 Thread ToddAndMargo
On 03/06/2017 01:32 AM, Timo Paulssen wrote: This is because of how xclip works. It keeps running until you kill it, or until the number of pastes has been reached that you specify with -loops. You will want to use Proc::Async or run with an :in parameter instead of shelling into a redirect with

Re: I need the rules for qx with a pipe inside

2017-03-06 Thread Timo Paulssen
This is because of how xclip works. It keeps running until you kill it, or until the number of pastes has been reached that you specify with -loops. You will want to use Proc::Async or run with an :in parameter instead of shelling into a redirect with echo, here's why: timo@schmand ~> cat Bad

I need the rules for qx with a pipe inside

2017-03-06 Thread ToddAndMargo
qx{ echo $Str | xclip -selection primary }; passes syntax, but hangs when run