Page 1 of 1

Possible shell bug in 6.7 & 7.x

Posted: Tue Mar 03, 2015 5:04 am
by sefrojones
Hi everyone. I am seeing a discrepancy in behavior of the shell function. I have not used the shell function for anything other than interacting with my bitcoin node, so it may be user error, but I don't think so.

In LiveCode versions up to and including 6.6.5 in Windows 7, this code:

Code: Select all

on NewKeyPair
   set the shellcommand to "c:\program files\bitcoin\daemon\bitcoin-cli.exe"
   put shell(getnewaddress) into  newAddy
   put "dumpprivkey"&&newAddy into PrivKeyDump
   put  shell(PrivKeyDump) into newPrivKey
   put "Address:"&&newAddy&cr&"Private Key:"&&newprivkey
end NewKeyPair
would correctly result in something like this:

Code: Select all

Address: 17AdYTMMRMxwACBevv5SLrHVs7PNfhhHnP

Private Key: KwXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXBEH
(example is not a real private key)


From LiveCode 6.7.x and 7.x.x the same script yields a result like this:

Code: Select all

Address: 1AWCPekoZwHz97rsdSTUDNw4a7QAn2emKr

Private Key: error: {"code":-32601,"message":"Method not found"}


After doing a bit of experimentation, and seeing as the first shell(getnewaddress) seems to be working fine in all versions, I am 99% certain that the problem is that the second shell function includes a space. All shell commands I've tried that do not have spaces work fine, commands that have a space return that error code. Anybody care to help test on this theory?

--Sefro

Forgive me if this is in the wrong area, or if it has been covered already. I've been absent the past couple of months and a quick search didn't turn up anything.

Re: Possible shell bug in 6.7 & 7.x

Posted: Wed Mar 04, 2015 12:52 am
by mwieder
Been a while since I've had to deal with Windows, but is there any reason you need an embedded space, i.e., would this work?

Code: Select all

   put  shell("dumpprivkey" && newAddy) into newPrivKey

Re: Possible shell bug in 6.7 & 7.x

Posted: Wed Mar 04, 2015 4:57 am
by sefrojones
mwieder wrote:Been a while since I've had to deal with Windows, but is there any reason you need an embedded space, i.e., would this work?

Code: Select all

   put  shell("dumpprivkey" && newAddy) into newPrivKey
Unfortunately that does not work either. I tried every variation I could think of to include the space, including the one you suggested. Strangely, I am not not so sure the problem is with the space anymore, because if use use the default cmd.exe as my shellcommand, this works as expected:

Code: Select all

shell("mkdir c:\TestDirectory)

But any of my bitcoin-cli shell commands that include a space throw an error in all versions beyond 6.6.5.

--Sefro

Re: Possible shell bug in 6.7 & 7.x

Posted: Wed Mar 04, 2015 5:32 am
by mwieder
I haven't explicitly set the shellcommand... how about if you just use the long address of the tool?

Code: Select all

on NewKeyPair
   put "c:/program files/bitcoin/daemon/bitcoin-cli.exe" into tCmd
   put shell(tCmd && getnewaddress) into  newAddy
   put "dumpprivkey"&&newAddy into PrivKeyDump
   put  shell(tCmd && PrivKeyDump) into newPrivKey
   put "Address:"&&newAddy&cr&"Private Key:"&&newprivkey
end NewKeyPair

Re: Possible shell bug in 6.7 & 7.x

Posted: Wed Mar 04, 2015 7:09 am
by sefrojones
That threw an error for both shell commands, but the slight edit below got it working in 6.7 and up:

Code: Select all

put quote &"c:\program files\bitcoin\daemon\bitcoin-cli.exe"& quote into tCmd
 
Any idea why my script would be working in previous versions, but not beyond 6.6.5? Would this be considered a bug, or is there some underlying problem with my script, that previous versions of LC were perhaps just more forgiving with?

Either way, thanks for your help!


--Sefro

EDIT: maybe the issue is with the shellcommand property, and not the shell function....