The coding standard requires a sanitization of the code so that it can be reliable for mission critical runtime i.e flying an aircraft.
Proof-of-concept
mkdir something
Is not sanitized and if the runtime in the code below depends on the directory something then it's going to cause a cascade failure.
Expected:
if[ ! -d something ];thenifcommand -v mkdir 1>/dev/null;then
mkdir something ||{printf'%s\n'"Unable to create a directory 'something'"&&exit1;}elifcommand -v other-mkdir;then
other-mkdir something ||{printf'%s\n'"Unable to create a directory 'something'"&&exit1;}elseexit255fielif[ -d something ];thentrueelseexit255fi
This way the software is able to exit safely assuming that standard utilities alike mkdir are checked appropriately prior to mission critical task.
Helpful error message is also expected.
The else statements should be only used for an unexpected trap to capture code quality issues i.e if there is an unexpected symlink named something that would trigger exit 255 (these should hopefully have a helpful message too)
There should be an attempt to avoid fatal failure.
<!-- Please keep your request as short as possible, the longer the request the longer it's going to take for us to process it -->
The coding standard requires a sanitization of the code so that it can be reliable for mission critical runtime i.e flying an aircraft.
# Proof-of-concept
```sh
mkdir something
```
Is not sanitized and if the runtime in the code below depends on the directory `something` then it's going to cause a cascade failure.
Expected:
```sh
if [ ! -d something ]; then
if command -v mkdir 1>/dev/null; then
mkdir something || { printf '%s\n' "Unable to create a directory 'something'" && exit 1 ;}
elif command -v other-mkdir; then
other-mkdir something || { printf '%s\n' "Unable to create a directory 'something'" && exit 1 ;}
else
exit 255
fi
elif [ -d something ]; then
true
else
exit 255
fi
```
This way the software is able to exit safely assuming that standard utilities alike `mkdir` are checked appropriately prior to mission critical task.
Helpful error message is also expected.
The `else` statements should be only used for an unexpected trap to capture code quality issues i.e if there is an unexpected symlink named `something` that would trigger exit 255 (these should hopefully have a helpful message too)
There should be an attempt to avoid fatal failure.
Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.74. Please mark this comment with 👍 or 👎 to give our bot feedback!
Issue-Label Bot is automatically applying the label `feature_request` to this issue, with a confidence of 0.74. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: [app homepage](https://github.com/marketplace/issue-label-bot), [dashboard](https://mlbot.net/data/RXT0112/Zernit) and [code](https://github.com/hamelsmu/MLapp) for this bot.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The coding standard requires a sanitization of the code so that it can be reliable for mission critical runtime i.e flying an aircraft.
Proof-of-concept
Is not sanitized and if the runtime in the code below depends on the directory
somethingthen it's going to cause a cascade failure.Expected:
This way the software is able to exit safely assuming that standard utilities alike
mkdirare checked appropriately prior to mission critical task.Helpful error message is also expected.
The
elsestatements should be only used for an unexpected trap to capture code quality issues i.e if there is an unexpected symlink namedsomethingthat would trigger exit 255 (these should hopefully have a helpful message too)There should be an attempt to avoid fatal failure.
Issue-Label Bot is automatically applying the label
feature_requestto this issue, with a confidence of 0.74. Please mark this comment with 👍 or 👎 to give our bot feedback!Links: app homepage, dashboard and code for this bot.