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

Bug fix in the line parser when dealing with empty inputs for Centos 8 which is strict on this #57

Merged
merged 2 commits into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libopenfpga/libopenfpgashell/src/shell.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ void Shell<T>::run_script_mode(const char* script_file_name, T& context) {

/* Read line by line */
while (getline(fp, line)) {
/* Skip empty line */
if (true == line.empty()) {
continue;
}

/* If the line that starts with '#', it is commented, we can skip */
if ('#' == line.front()) {
continue;
Expand Down
13 changes: 9 additions & 4 deletions libopenfpga/libopenfpgautil/src/openfpga_digest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ std::string format_dir_path(const std::string& dir_path_to_format) {
char legal_back_slash = '\\';
#endif

/* Return an empty string if the input is empty */
if (true == formatted_dir_path.empty()) {
return formatted_dir_path;
}

/* Replace "\" with "/" */
std::replace(formatted_dir_path.begin(), formatted_dir_path.end(), illegal_back_slash, legal_back_slash);

Expand Down Expand Up @@ -123,8 +128,8 @@ bool create_dir_path(const std::string& dir_path,
const bool& verbose) {
/* Give up if the path is empty */
if (true == dir_path.empty()) {
VTR_LOG_ERROR("Directory path is empty and nothing will be created.\n");
return false;
VTR_LOG_WARN("Directory path is empty and nothing will be created.\n");
return true;
}

/* Try to create a directory */
Expand Down Expand Up @@ -170,8 +175,8 @@ static
bool rec_create_dir_path(const std::string& dir_path) {
/* Give up if the path is empty */
if (true == dir_path.empty()) {
VTR_LOG_ERROR("Directory path is empty and nothing will be created.\n");
return false;
VTR_LOG_WARN("Directory path is empty and nothing will be created.\n");
return true;
}

/* Try to find the positions of all the slashes
Expand Down