Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #945, shell implementation on posix and rtems #946

Merged
merged 1 commit into from
Apr 21, 2021

Conversation

jphickey
Copy link
Contributor

@jphickey jphickey commented Apr 6, 2021

Describe the contribution
Fix #945

Due to other changes the shell implementation on RTEMS and POSIX failed to build under certain configurations.

  • On POSIX the check of active_id field was not valid. Using the existing OS_CloseAllFiles() function does what is needed here and is much simpler.
  • On RTEMS, the shell does not recognize the redirect operators. This was basically cut and pasted from Linux/bash shell syntax and probably never worked on RTEMS, and there was no test to verify. Now that "shell-test" exists, it confirms that this does not actually work.

For now, the broken impl file is simply deleted, and RTEMS will always use os-impl-no-shell.c. In a future version, the implementation can be fixed properly.

Testing performed
Build POSIX and RTEMS with shell enabled (OSAL_CONFIG_INCLUDE_SHELL=true)
Run "shell-test" and confirm behavior on POSIX (passes) and RTEMS (skips)

(Note that CFE does not directly use the OSAL shell function, but apps might; it is optional)

Expected behavior changes
Broken code is removed, so OSAL builds with OSAL_CONFIG_INCLUDE_SHELL=true on all platforms, but RTEMS will still result in OS_ERR_NOT_IMPLEMENTED always.

System(s) tested on
Ubuntu 20.04 (native)
RTEMS 4.11.3

Additional context
I briefly investigated what it would take to fix this on RTEMS properly. The issue is that the rtems_shell_init() function attaches to a "device name" (typically /dev/console for interactive use), not individual input/output file descriptors. So it appears to be a matter of creating a pseudoterminal-type device that "reads" from the script and writes to the file. But it also appeared this was an area that changed a fair bit in RTEMS between 4.11 and 5.x release, so any solution would be unlikely to work on both, and this is why I decided its probably not worth pursuing for now. (a stakeholder who wants the shell to work on RTEMS can always re-implement).

But since the existing code in os-impl-shell.c was very broken, it is just removed (not even useful as a basis for future; better to use posix or vxworks as basis instead).

Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.

@skliper skliper linked an issue Apr 7, 2021 that may be closed by this pull request
@skliper skliper added this to the 6.0.0 milestone Apr 7, 2021
@jphickey jphickey added the CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) label Apr 7, 2021
Due to other changes the shell implementation on RTEMS and POSIX failed
to build under certain configurations.  This fixes and verifies the
shell functions as expected.
@skliper skliper added CCB:2021-04-14 and removed CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) labels Apr 14, 2021
@skliper
Copy link
Contributor

skliper commented Apr 14, 2021

CCB:2021-04-14 - APPROVED

@astrogeco astrogeco added the CCB:Approved Indicates code review and approval by community CCB label Apr 19, 2021
@astrogeco astrogeco changed the base branch from main to integration-candidate April 21, 2021 15:46
@astrogeco astrogeco merged commit f6eb458 into nasa:integration-candidate Apr 21, 2021
astrogeco added a commit to nasa/cFS that referenced this pull request Apr 22, 2021
Combines:

nasa/cFE#1406
nasa/osal#967
nasa/cFS-GroundSystem#178

Includes:

nasa/cFE#1290, Split interface and implementation modules
nasa/cFE#1376, add docs to CFE_ES_RegisterCDS() regarding clearing
nasa/cFE#1292, Remove testrunner and convert testcase to app
cfe-IC:2021-04-20, HOTFIX: Always build cfe_assert.

nasa/osal#950, Eliminate time and access name collisions with VxWorks
nasa/osal#946, Fix Shell implementation on posix and rtems

nasa/cFS-GroundSystem#174, update executable name and version in setup.py
nasa/cFS-GroundSystem#175, Add executable install guide
astrogeco added a commit to nasa/cFS that referenced this pull request Apr 22, 2021
Combines:

nasa/cFE#1406
nasa/osal#967
nasa/cFS-GroundSystem#178

Includes:

nasa/cFE#1290, Split interface and implementation modules
nasa/cFE#1376, add docs to CFE_ES_RegisterCDS() regarding clearing
nasa/cFE#1292, Remove testrunner and convert testcase to app
cfe-IC:2021-04-20, HOTFIX: Always build cfe_assert.

nasa/osal#950, Eliminate time and access name collisions with VxWorks
nasa/osal#946, Fix Shell implementation on posix and rtems

nasa/cFS-GroundSystem#174, update executable name and version in setup.py
nasa/cFS-GroundSystem#175, Add executable install guide
@jphickey jphickey deleted the fix-945-rtems-shell branch April 28, 2021 18:58
jphickey pushed a commit to jphickey/osal that referenced this pull request Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved Indicates code review and approval by community CCB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RTEMS fails to build with shell enabled
3 participants