Skip to content

fix: linuxcncrsh: return PROGRAM NONE if no program is open (2.8)#2153

Merged
andypugh merged 1 commit intoLinuxCNC:2.8from
adamlouis:2.8-fix-get-program
Nov 23, 2022
Merged

fix: linuxcncrsh: return PROGRAM NONE if no program is open (2.8)#2153
andypugh merged 1 commit intoLinuxCNC:2.8from
adamlouis:2.8-fix-get-program

Conversation

@adamlouis
Copy link
Copy Markdown
Contributor

a duplicate of this PR: #2152 .... targetted to 2.8 as suggested by @andypugh

I forked the 2.8 branch of LinuxCNC/linuxcnc and applied the same change.


I found the following bug while using linuxcncrsh. get program does not return none if no program is open.

The behavior of get program when no program is open is documented as:

program
With get, returns the name of the currently opened program, or "none".

see:

It appears this bug has been present since emcrsh.cc was first committed:

static cmdResponseType getProgram(char *s)

steps to reproduce:

telnet <SOME_IP> 5007

hello EMC adamlouis 1.1
set enable EMCTOO
  • run get program
  • run get program
  • run get program
  • run get program
  • run get estop (or any other get * command get machine, get get joint_pos, etc)
  • run get program
  • run get program
  • run get program
  • run get program
  • ...

expected behavior:

for all commands above:

  • get program -> PROGRAM NONE\r\n
  • get estop -> ESTOP ON\r\n

actual behavior:

get program --> \r\n
get program --> \r\n\r\n
get program --> \r\n\r\n\r\n
get program --> \r\n\r\n\r\n
get estop --> ESTOP ON\r\n
get program --> ESTOP ON\r\n\r\n
get program --> ESTOP ON\r\n\r\n\r\n
get program --> ESTOP ON\r\n\r\n\r\n\r\n
get program --> ESTOP ON\r\n\r\n\r\n\r\n\r\n

  • get program returns the previously executed get * command (except at the start, when no other get has been run)
  • each time get program is run while no program is open, an additional new line is added to the response

In #2152, @andypugh said:

This looks like an obvious bug and I think it should be targetted to 2.8 and then merged up.
(I tried just changing the bae here, but it didn't have the required effect)

return PROGRAM NONE if no program is open
@andypugh
Copy link
Copy Markdown
Collaborator

Thanks for this, now pushed to 2.8, 2.9 and master (2.10)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants