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

Add console string quoting. #705

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

RobertPHeller
Copy link
Contributor

This is a new attempt to get this into the root fork. I need this patch for my command station code. This is a feature enhancement to allow consoles to allow quoting command line parameters, specificly to allow command line parameters with spaces and other word break characters.

@RobertPHeller
Copy link
Contributor Author

Is there some reason this pull request has not been acted on? Is the ArduinoBuild / Build ESP32 examples build failure check holding it up?

@atanisoft
Copy link
Collaborator

Is the ArduinoBuild / Build ESP32 examples build failure check holding it up?

that can be ignored as it is trying to use the latest arduino-esp32 that isn't supported on master (and won't be anytime soon).

@RobertPHeller
Copy link
Contributor Author

So, what is holding up the pull request? I would like to be synced and up-to-date, but I need this update for my PocketBeagle command station, so the version of OpenMRN on my BeagleBone build box is being held back waiting for this PR...

@RobertPHeller
Copy link
Contributor Author

Is there something I need to do to get this pull request approved?

src/console/Console.cxx Outdated Show resolved Hide resolved
src/console/Console.cxx Show resolved Hide resolved
@@ -22,7 +22,7 @@ TEST(ConsoleTest, testHelp)
" has an effect on socket based logins sessions\n"
"> ", 154));

EXPECT_EQ(::write(s, "?\n", 3), 3);
EXPECT_EQ(::write(s, "?\n", 5), 5);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change does not seem right. There are only three characters in that string (question mark, newline, zero). We should not write 5 bytes here.

src/console/Console.cxxtest Outdated Show resolved Hide resolved
EXPECT_EQ(::write(s, "echo '\"Oh no, no, no\", said the man'\n", 37), 37);
usleep(1000);
EXPECT_EQ(::read(s, buf, 1024), 32);
EXPECT_TRUE(!strncmp(buf, "\"Oh no, no, no\", said the man\n> ", 32));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider adding another test case with mismatched quote to exercise the error path as well. This will be helpful to keep test coverage high.

@RobertPHeller
Copy link
Contributor Author

I am not sure why this pull request is still lingering. I can't tell if there are still outstanding problems.

@bakerstu
Copy link
Owner

bakerstu commented Feb 3, 2025

I am not sure why this pull request is still lingering. I can't tell if there are still outstanding problems.

@RobertPHeller I agree that we have not been very attentive to this. I will try and take another look through the code and existing comments. I also want to make sure all the tests pass. I'll let you know what I find.

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.

4 participants