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

ord: Print a simpler message when write_db fails to open file. #6123

Closed
wants to merge 3 commits into from

Conversation

titan73
Copy link
Contributor

@titan73 titan73 commented Nov 8, 2024

No description provided.

@titan73
Copy link
Contributor Author

titan73 commented Nov 8, 2024

For #6120.

Copy link
Contributor

github-actions bot commented Nov 8, 2024

clang-tidy review says "All clean, LGTM! 👍"

src/OpenRoad.cc Outdated
utl::StreamHandler stream_handler(filename, true);
db_->write(stream_handler.getStream());
} catch (const std::ios_base::failure& f) {
logger_->error(ORD, 55, "Cannot write database to {}", filename);
Copy link
Member

Choose a reason for hiding this comment

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

Please include the f.what string in the message as it may give more detail on the cause of the failure.

Copy link
Member

Choose a reason for hiding this comment

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

Does write_def or write_lef need similar treatment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes for write_lef. write_def is different with the '.1'. Where does it come from?

>>> write_def foo/bar
[ERROR GUI-0070] No such file or directory: foo/bar.1
>>> write_lef foo/bar
[ERROR GUI-0070] basic_ios::clear: iostream error (failed to open 'foo/bar.1'): iostream error

Copy link
Member

Choose a reason for hiding this comment

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

write_lef might need to write multiple files so they get . suffixes.

write_lef/def are not part of GUI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is the case where write_lef write multiple files?
Regarding write_db & write_def, why using a suffix then? Should we use basic iostream instead?

Copy link
Member

Choose a reason for hiding this comment

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

If you read multiple LEFs in you should expect multiple out. I don't expect it on def.

Copy link
Contributor

github-actions bot commented Nov 8, 2024

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

github-actions bot commented Nov 8, 2024

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Collaborator

@oharboe oharboe left a comment

Choose a reason for hiding this comment

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

If we are going to do this, then the util::StreamHandler would be the place to do it.

As I recall util::StreamHandler went through a number of iterations and lots of review feedback, a lots of tripwires...

@titan73
Copy link
Contributor Author

titan73 commented Nov 9, 2024

If we are going to do this, then the util::StreamHandler would be the place to do it.

I don't understand your suggestion.

As I recall util::StreamHandler went through a number of iterations and lots of review feedback, a lots of tripwires...

What is the purpose of util::StreamHandler? What problem is it supposed to solve? OR uses std::ifstream for reading.

@oharboe
Copy link
Collaborator

oharboe commented Nov 9, 2024

@titan73 master for the code you propose to change is using utl::StreamHandler today. I think the code reads pretty well and the purpose is pretty clear from the code.

If you ask ChatGPT/copilot to explain what it does and why it exists instead of your proposed change, I am pretty sure you will get a satisfactory answer.

In this day and age, I consider simple code that ChatGPT/copilot can adequately explain purpose and implementation of sufficiently documented.

@titan73
Copy link
Contributor Author

titan73 commented Nov 10, 2024

No need for ChapGPT. Seems the code prevents the existing file to be overwritten in case of failure.
I close this PR for now. I'll come up with something else later.

@titan73 titan73 closed this Nov 10, 2024
@titan73 titan73 deleted the write_db_msg branch November 11, 2024 17:00
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.

3 participants