Possible shell bug in 6.7 & 7.x

If you find an issue in LiveCode but are having difficulty pinning down a reliable recipe or want to sanity-check your findings with others, this is the place.

Please have one thread per issue, and try to summarize the issue concisely in the thread title so others can find related issues here.

Moderator: Klaus

Post Reply
sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Possible shell bug in 6.7 & 7.x

Post by sefrojones » Tue Mar 03, 2015 5:04 am

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.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Possible shell bug in 6.7 & 7.x

Post by mwieder » Wed Mar 04, 2015 12:52 am

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

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Possible shell bug in 6.7 & 7.x

Post by sefrojones » Wed Mar 04, 2015 4:57 am

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

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Possible shell bug in 6.7 & 7.x

Post by mwieder » Wed Mar 04, 2015 5:32 am

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

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Possible shell bug in 6.7 & 7.x

Post by sefrojones » Wed Mar 04, 2015 7:09 am

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....

Post Reply