Skip to content

fix: linuxcncrsh: return PROGRAM NONE if no program is open#2152

Closed
adamlouis wants to merge 2 commits intoLinuxCNC:masterfrom
adamlouis:fix-get-program-none
Closed

fix: linuxcncrsh: return PROGRAM NONE if no program is open#2152
adamlouis wants to merge 2 commits intoLinuxCNC:masterfrom
adamlouis:fix-get-program-none

Conversation

@adamlouis
Copy link
Copy Markdown
Contributor

@adamlouis adamlouis commented Nov 23, 2022

I found the following (apparent) 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

@andypugh
Copy link
Copy Markdown
Collaborator

andypugh commented Nov 23, 2022

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)

@andypugh andypugh changed the base branch from master to 2.8 November 23, 2022 16:56
@andypugh andypugh changed the base branch from 2.8 to master November 23, 2022 16:56
@adamlouis adamlouis changed the base branch from master to 2.8 November 23, 2022 21:37
@adamlouis adamlouis changed the base branch from 2.8 to master November 23, 2022 21:38
@adamlouis
Copy link
Copy Markdown
Contributor Author

thank you @andypugh ! closing this in favor of: #2153

@adamlouis adamlouis closed this Nov 23, 2022
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