Skip to content

Introduce a PORTING.md project doc for contributors#11721

Closed
wrowe wants to merge 9 commits intoenvoyproxy:masterfrom
greenhouse-org:porting-docs
Closed

Introduce a PORTING.md project doc for contributors#11721
wrowe wants to merge 9 commits intoenvoyproxy:masterfrom
greenhouse-org:porting-docs

Conversation

@wrowe
Copy link
Copy Markdown
Contributor

@wrowe wrowe commented Jun 23, 2020

Commit Message: Introduce a PORTING.md project doc for contributors
Additional Description:

  • Soliciting contributions to build on this after it is merged
    to master from both Microsoft contributors and OS/X champions.

  • It is also worthwhile to solicit more contributions to build
    on these notes from the Apple iOS and Android porting efforts.

Signed-off-by: Sunjay Bhatia sunjayb@vmware.com
Co-authored-by: Sunjay Bhatia sunjayb@vmware.com
Signed-off-by: William A Rowe Jr wrowe@vmware.com
Co-authored-by: William A Rowe Jr wrowe@vmware.com

Risk Level: n/a
Testing: Based on local and RBE development
Docs Changes: n/a
Release Notes: n/a

- Soliciting contributions to build on this after it is merged
to master from both Microsoft contributors and OS/X champions.

- It is also worthwhile to solicit more contributions to build
on these notes from the Apple iOS and Android porting efforts.

Signed-off-by: Sunjay Bhatia <sunjayb@vmware.com>
Co-authored-by: Sunjay Bhatia <sunjayb@vmware.com>
Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
Co-authored-by: William A Rowe Jr <wrowe@vmware.com>
@wrowe
Copy link
Copy Markdown
Contributor Author

wrowe commented Jun 23, 2020

@davinci26 @nigriMSFT your feedback would be helpful if we've missed anything significant. @mattklein123, @htuch and @lizan since you have all looked into a number of windows regressions, your input is also helpful.

It would be good to come to terms on how we want to structure these notes and where we want them to live, and get them out there for all contributors to consume as we turn on RBE test CI pipeline with PR 11107

@lizan
Copy link
Copy Markdown
Member

lizan commented Jun 23, 2020

@zuercher for comment on macOS port

@wrowe
Copy link
Copy Markdown
Contributor Author

wrowe commented Jun 23, 2020

@sunjayBhatia for follow

Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Thanks for starting this, a few high level clarifications to get started.

PORTING.md Outdated
@@ -0,0 +1,128 @@
## Envoy Porting
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we cover cross-architecture porting here? E.g. ARM, PowerPC, etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Absolutely. A 32-bit android PR reiterated this point today. We should likely break this down into subject areas that aren't as much "windows specific" as "architecture variances", e.g. 32 bit android or arm or linux, vs P64 Windows, vs ILP64 linux. Each of these should have short breakouts, but the suggestions writ large should focus on the individual commonly misunderstood subjects and how they should be coded to remain portable.

PORTING.md Outdated
@@ -0,0 +1,128 @@
## Envoy Porting
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is the goal of this doc? To capture some known port issues, to provide best practices for not breaking ports, to advise on how to add a new port?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My #1 goal in authoring PORTING.md is to help regular contributors to look beyond baked-in Linux x86_64 assumptions and anticipate what is needed to write portable C++ code. To that end, it needs be structured to help resolve CI pipeline breakage, whether that happens to their submission in the OS/X or Windows ports, or ARM 32 or 64, or Android or other future ports.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should the key takeaways just become part of STYLE.md? I get that we want a more details doc providing an explanation of "why?" rather than just "how", but it would be helpful to only be able to read STYLE.md and have the rules of the road here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would leave it to the core maintainers to decide which suggestions to adopt. For example, suggesting number of bytes or number of elements (.size() or .count()) used for a storage class in-memory should always be represented as size_t/ptrdiff_t, while sizes of storage class on-disk should be represented as off_t, because that's what ISO stdc++ does. Fighting with the C++ standard library is probably the silliest windmill we could tilt at.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@envoyproxy/maintainers for thoughts on this. I think we'd be happy to take some basic suggestions like this. PR welcome, we can bikeshed there.

* Mac OS/X port
* Windows Win32 API port

## Troubleshooting Common Porting Issues
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are there some best practices or advice for developers on how now to break Windows? See for example our other thread on autoconf deps.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Although it is largely secret-sauce, much of this goes back to K&R 1st edition. I've already added two specific links in the docs, one which covers the vast array of compilation differences between different compilers and the other which Microsoft themselves calls out the most commonly encountered quirks of their cl.exe compiler. We should add all such related and helpful links (rather than overburden what will become a long-enough document, as-is.)

Things like working around GNU autoconf-managed projects needs to be in an altogether different section than linkage compatibility, bazel compatibility etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

And on the subject of 'examples' I do think that adding links to specific lines of commits where the specific code was fixed once upon a time so readers can see a before-and-after picture would be helpful to each of the particular problems. But getting this doc into everyone's hands as we kick off #11107 takes higher priority.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One worry I have is that the document is long, which you point out, and most folks won't have time to read. Ideally we have the takeaway bullet points early on or in some easy to scan for manner, e.g. call-out boxes, so that the relevant info can be ingested in a TL;DR world.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I expect it is a fraction of how long it may end up... I'm looking at this from github's document.md rendering for the first time, and we will absolutely format it for clarity and "skim-ability".

@davinci26
Copy link
Copy Markdown
Member

I think this is an awesome doc! I think the information here is really valuable and probably it is worth be published separately as well as it can help other porting efforts.

Copy link
Copy Markdown
Member

@davinci26 davinci26 left a comment

Choose a reason for hiding this comment

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

A general remark here. Depending on the goal that we have for the doc we may want to include some examples


## Specific Coding Issues

Most porting issues can be summarized in a handful of assumptions to be avoided.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you think would make sense to add some subheaders here and split into these broad categories:
e.g.

  1. C++ standards
  2. Word size
  3. C Runtime
  4. System calls

The scenario that I am thinking is that a contributor might want to skim-through the doc while having a specific issue and some subheaders might make it more easier to find the relevant paragraph or section to their problem

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes I believe we are going to need further sub-headings. What the logical groupings are, I haven't worked out and welcome patches and suggestions.


Many tests rely on command line scripting or tool invocation. Bazel and Envoy rely heavily on bash scripts, executing
on Windows via msys2. Inherent discrepancies between the msys2 execution environment and a typical bash shell can
cause confusing errors. Be sure to use cmd.exe on Windows in any test scripts that intend to create symlinks.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we have a separate section for testing and add there:

  1. cmd for symlinks
  2. googletest regex
  3. googletest nice mocks on base classes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sub-sections, yes as noted above.

@wrowe
Copy link
Copy Markdown
Contributor Author

wrowe commented Jun 25, 2020

I think this is an awesome doc! I think the information here is really valuable and probably it is worth be published separately as well as it can help other porting efforts.

I'd be happy to pursue that, including offers of co-authoring help and contributions, but let's build this document first over 6-12 weeks :)

@wrowe
Copy link
Copy Markdown
Contributor Author

wrowe commented Jun 25, 2020

/azp run envoy-presubmit

@azure-pipelines
Copy link
Copy Markdown

Commenter does not have sufficient privileges for PR 11721 in repo envoyproxy/envoy

@wrowe
Copy link
Copy Markdown
Contributor Author

wrowe commented Jun 25, 2020

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🤷‍♀️ nothing to rebuild.

🐱

Caused by: a #11721 (comment) was created by @wrowe.

see: more, trace.

@wrowe
Copy link
Copy Markdown
Contributor Author

wrowe commented Jun 25, 2020

To add a top-line comment for all reviewers, the goal in this document is not to thoroughly delve into each possible porting problem, but to highlight the most commonly observed problems, especially at the Envoy project specifically, and add copious links to where the reader can learn more.

Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
restrictions than on the typical Linux/clang tool chain. These limits include;

* The individual path elements for -Inclusion (this restricts the total path name lengths available to the project).
* The length of the embedded command line stored in the debug info record of the COFF object file (48kb on Windows).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How can developers action on this to prevent running into this situation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We haven't worked out that solution yet. It's noted here in case Windows developers are observing strange debugging behavior, it isn't something we expect to see in CI. The way that Bazel assembles works with insane lists of inclusions suggests we won't be able to work around this. We can probably pull the comment if we don't see issues in CI or from developers, since there isn't anything that Envoy itself can realistically do.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note to self to inject bazel advice to Windows builders here, as mentioned in #12098

Signed-off-by: Sunjay Bhatia <sunjayb@vmware.com>
Co-authored-by: Sunjay Bhatia <sunjayb@vmware.com>
Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
Co-authored-by: William A Rowe Jr <wrowe@vmware.com>
Copy link
Copy Markdown
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

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

Just a couple of nits

@lizan lizan added the waiting label Jul 6, 2020
wrowe added 2 commits July 14, 2020 09:44
Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
@stale
Copy link
Copy Markdown

stale bot commented Jul 19, 2020

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Jul 19, 2020
wrowe added 2 commits July 21, 2020 10:44
Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
@stale stale bot removed the stale stalebot believes this issue/PR has not been touched recently label Jul 21, 2020
…orting-docs

Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
@stale
Copy link
Copy Markdown

stale bot commented Jul 29, 2020

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Jul 29, 2020
@wrowe wrowe marked this pull request as draft July 30, 2020 13:55
@stale stale bot removed the stale stalebot believes this issue/PR has not been touched recently label Jul 30, 2020
@stale
Copy link
Copy Markdown

stale bot commented Aug 8, 2020

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Aug 8, 2020
@stale stale bot removed stale stalebot believes this issue/PR has not been touched recently labels Aug 18, 2020
@stale
Copy link
Copy Markdown

stale bot commented Aug 29, 2020

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Aug 29, 2020
@wrowe wrowe added area/docs area/windows and removed stale stalebot believes this issue/PR has not been touched recently labels Sep 3, 2020
@wrowe
Copy link
Copy Markdown
Contributor Author

wrowe commented Sep 3, 2020

Working through content flow and prettifying it on Tuesday to have a ready-to-merge beginning to this doc on trunk.

@stale
Copy link
Copy Markdown

stale bot commented Sep 11, 2020

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Sep 11, 2020
@stale
Copy link
Copy Markdown

stale bot commented Sep 20, 2020

This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot closed this Sep 20, 2020
@wrowe wrowe reopened this Sep 22, 2020
@stale stale bot removed the stale stalebot believes this issue/PR has not been touched recently label Sep 22, 2020
@stale
Copy link
Copy Markdown

stale bot commented Oct 4, 2020

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Oct 4, 2020
@mattklein123 mattklein123 removed the stale stalebot believes this issue/PR has not been touched recently label Dec 9, 2020
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 8, 2021

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions bot added the stale stalebot believes this issue/PR has not been touched recently label Jan 8, 2021
@wrowe
Copy link
Copy Markdown
Contributor Author

wrowe commented Jan 12, 2021

Folding the greenhouse-org repo, so this PR disappears today. I also found that the PR workflow doesn't blend well with coauthoring a new/not-ready document. I've moved the working draft here;

https://docs.google.com/document/d/1rTD_slMyjNvdxoXhMGhn8xXRJuyfM7aKSctTrsyTX5Q/edit?usp=sharing

Comments are open. I'll draw the lingering comments from this dialog, and reopening when the draft is ready to be PR'ed and merged.

@wrowe wrowe closed this Jan 12, 2021
@wrowe wrowe deleted the porting-docs branch January 12, 2021 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs area/windows stale stalebot believes this issue/PR has not been touched recently

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants