-
Notifications
You must be signed in to change notification settings - Fork 21
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
issuegen: do not use staged file, and fix bug in udev add/remove invocation #39
Conversation
Noticed in passing I had not updated the target path correctly for the remove case previously. Should refactor so that the target path is defined in one place, but quickly fixing for this commit.
I don't know if we are solving the problem here. It still seems like we could have two processes writing to |
c1e7734
to
92a3781
Compare
Right - the output could become corrupted still by the two processes writing to the generated file at the same time. This change just avoids having the service fail from the error missing the common
A new temporary file for each SGTM! Will update. |
it would be pretty easy to just use variables and not have to use a staged file I think. Something like:
|
4c3dcfd
to
475e8a6
Compare
Updated now - works well with variables. Also rebased #40 which follows up. |
For the same reason as in coreos#39 (copying the phrasing below): With the `staged` file shared, there would be potential for two or more processes executing `motdgen` to write to it resulting in corrupted output, or the error in the `cat` command due to missing file reported in coreos#35 (comment). Currently, this is not a problem with motdgen, but could be if `motdgen` were invoked by something like the udev rules that invoke `issuegen`. Instead, write the intermediate output to a variable before writing to the final output file. This ensures only valid output is written to the issue file shown to the terminal. Additionally, perform code tidyups similar to those done for `issuegen` in coreos#40.
475e8a6
to
80ecdf7
Compare
^ Re-pushed for a minor correction in the commit message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. A few optional comments.
With the `staged` file shared, there was potential for two or more processes executing `issuegen` to write to it, resulting in corrupted output, or the error in the `cat` command due to missing file reported in coreos#35 (comment). Instead, write the intermediate output to a variable before writing to the final output file. This ensures only valid output is written to the issue file shown to the terminal. If large issue snippets are ever passed, a tempfile is another option for storing intermediate output to avoid storing snippets in memory. However, practically, snippet sizes should be small, as they are intended to be read on a terminal.
80ecdf7
to
52d0963
Compare
Will merge now - suggested fixups were added after approval. |
For the same reason as in coreos#39 (copying the phrasing below): With the `staged` file shared, there would be potential for two or more processes executing `motdgen` to write to it resulting in corrupted output, or the error in the `cat` command due to missing file reported in coreos#35 (comment). Currently, this is not a problem with motdgen, but could be if `motdgen` were invoked by something like the udev rules that invoke `issuegen`. Instead, write the intermediate output to a variable before writing to the final output file. This ensures only valid output is written to the issue file shown to the terminal. Additionally, perform code tidyups similar to those done for `issuegen` in coreos#40.
For the same reason as in coreos#39 (copying the phrasing below): With the `staged` file shared, there would be potential for two or more processes executing `motdgen` to write to it resulting in corrupted output, or the error in the `cat` command due to missing file reported in coreos#35 (comment). Currently, this is not a problem with motdgen, but could be if `motdgen` were invoked by something like the udev rules that invoke `issuegen`. Instead, write the intermediate output to a variable before writing to the final output file. This ensures only valid output is written to the issue file shown to the terminal. Additionally, perform code tidyups similar to those done for `issuegen` in coreos#40.
For the same reason as in coreos#39 (copying the phrasing below): With the `staged` file shared, there would be potential for two or more processes executing `motdgen` to write to it resulting in corrupted output, or the error in the `cat` command due to missing file reported in coreos#35 (comment). Currently, this is not a problem with motdgen, but could be if `motdgen` were invoked by something like the udev rules that invoke `issuegen`. Instead, write the intermediate output to a variable before writing to the final output file. This ensures only valid output is written to the issue file shown to the terminal. Additionally, perform code tidyups similar to those done for `issuegen` in coreos#40.
For the same reason as in coreos#39 (copying the phrasing below): With the `staged` file shared, there would be potential for two or more processes executing `motdgen` to write to it resulting in corrupted output, or the error in the `cat` command due to missing file reported in coreos#35 (comment). Currently, this is not a problem with motdgen, but could be if `motdgen` were invoked by something like the udev rules that invoke `issuegen`. Instead, write the intermediate output to a variable before writing to the final output file. This ensures only valid output is written to the issue file shown to the terminal. Additionally, perform code tidyups similar to those done for `issuegen` in coreos#40.
For the same reason as in coreos#39 (copying the phrasing below): With the `staged` file shared, there would be potential for two or more processes executing `motdgen` to write to it resulting in corrupted output, or the error in the `cat` command due to missing file reported in coreos#35 (comment). Currently, this is not a problem with motdgen, but could be if `motdgen` were invoked by something like the udev rules that invoke `issuegen`. Instead, write the intermediate output to a variable before writing to the final output file. This ensures only valid output is written to the issue file shown to the terminal. Additionally, perform code tidyups similar to those done for `issuegen` in coreos#40.
For the same reason as in coreos#39 (copying the phrasing below): With the `staged` file shared, there would be potential for two or more processes executing `motdgen` to write to it resulting in corrupted output, or the error in the `cat` command due to missing file reported in coreos#35 (comment). Currently, this is not a problem with motdgen, but could be if `motdgen` were invoked by something like the udev rules that invoke `issuegen`. Instead, write the intermediate output to a variable before writing to the final output file. This ensures only valid output is written to the issue file shown to the terminal. Additionally, perform code tidyups similar to those done for `issuegen` in coreos#40.
Fixes: #35
No functional changes, contains two bugfixes. Please see commit messages for additional detail.