[PATCH] libmisc/shell: Fix the handling of joel scripts in telnet

Chris Johns chrisj at rtems.org
Tue Feb 18 03:15:28 UTC 2020


On 17/2/20 8:47 pm, Chris Johns wrote:
> 
>> On 17 Feb 2020, at 5:51 pm, Sebastian Huber <sebastian.huber at embedded-brains.de> wrote:
>>
>> On 17/02/2020 07:05, chrisj at rtems.org wrote:
>>> From: Chris Johns<chrisj at rtems.org>
>>> - Fix the passing of std[in/out] to child threads
>>> - Fix deleting of managed memory in the key destructor
>>> - Only set the key in the main loop thread
>>> - Only allocate a shell env outside of the main loop
>>> - Work around #3970
>>> - Fix memory leak if the task start fails
>>> - Remove error level from shell env, it cannot be returned this way. Add
>>>   exit_code but the API is broken so it cannot be returned.
>>> Closes #3859
>>
>> Any changes required in existing Telnet application code after this patch?
> 
> No. The intention is to not break telnet.

Actually this may not be true, it depends on how the user has implemented their
telnet command. If it is similar to the libbsd telnet test it will build but
fail at runtime. The call `rtems_shell_dup_current_env` needs to be made. I am
going enforce this by checking the magic number in the struct in the shell main
loop call.

The libbsd telnet test needs to be ...

static void
telnet_shell(char *name, void *arg)
{
	rtems_shell_env_t env;

	rtems_shell_dup_current_env(&env);

	env.devname = name;
	env.taskname = "TLNT";
	env.login_check = NULL;
	env.forever = false;

	rtems_shell_main_loop(&env);
}

The env dup call is present in 4.11.

Chris


More information about the devel mailing list