errormsg: use descriptive macros for error numbers
Subsystems (2)
PATCH 1/1 errormsg: use descriptive macros for error numbers
Convert all the numerical error return codes in comparison option and field option parsing routines audit_rule_interfield_comp_data() and audit_rule_fieldpair_data() to descriptive macros for easier code navigation and verification.
See: https://github.com/linux-audit/audit-userspace/issues/11
--- lib/errormsg.h | 29 +++++++++++++++++++ lib/libaudit.c | 84 ++++++++++++++++++++++++++++---------------------------- 2 files changed, 71 insertions(+), 42 deletions(-)
lib/errormsg.h +29 -0
@@ -68,4 +68,33 @@ static const struct msg_tab err_msgtab[] = { { -30, 2, "Field option not supported by kernel:" }, { -31, 1, "must be used with exclude, user, or exit filter" }, }; +#define EAU_OPMISSING 1 +#define EAU_FIELDUNKNOWN 2 +#define EAU_ARCHMISPLACED 3 +#define EAU_ARCHUNKNOWN 4 +#define EAU_ELFUNKNOWN 5 +#define EAU_ARCHNOBIT 6 +#define EAU_EXITONLY 7 +#define EAU_MSGTYPEUNKNOWN 8 +#define EAU_MSGTYPEEXCLUDE 9 +#define EAU_UPGRADEFAIL 10 +#define EAU_STRTOOLONG 11 +#define EAU_MSGTYPECREDEXCLUDE 12 +#define EAU_OPEQNOTEQ 13 +#define EAU_PERMRWXA 14 +#define EAU_ERRUNKNOWN 15 +#define EAU_FILETYPEUNKNOWN 16 +#define EAU_EXITENTRYONLY 17 +#define EAU_KEYDEP 19 +#define EAU_FIELDVALMISSING 20 +#define EAU_FIELDVALNUM 21 +#define EAU_FIELDNAME 22 +#define EAU_COMPFIELDNAME 24 +#define EAU_COMPVAL 25 +#define EAU_COMPFIELDUNKNOWN 26 +#define EAU_COMPVALUNKNOWN 27 +#define EAU_FIELDTOOMANY 28 +#define EAU_OPEQ 29 +#define EAU_FIELDNOSUPPORT 30 +#define EAU_FIELDNOFILTER 31 #endif
lib/libaudit.c +42 -42
262 lines not on this page · raw message
Signature · 1 line
1.7.1
Steve Grubb
AppliedQuoted 5 lines · EDT Richard Guy Briggs
Convert all the numerical error return codes in comparison option and field option parsing routines
audit_rule_interfield_comp_data()andaudit_rule_fieldpair_data()to descriptive macros for easier code navigation and verification.
Quoted 8 lines
See: https://github.com/linux-audit/audit-userspace/issues/11
Signed-off-by Richard Guy Briggs <[email protected]>--- lib/errormsg.h | 29 +++++++++++++++++++ lib/libaudit.c | 84++++++++++++++++++++++++++++---------------------------- 2 files changed, 71 insertions(+), 42 deletions(-)
Applied. But we still have hardcoded numbers in the err_msgtab[]. :-)
Thanks,
-Steve
Quoted 8 lines · Steve Grubb
Quoted 7 lines · EDT Richard Guy Briggs
Convert all the numerical error return codes in comparison option and field option parsing routines
audit_rule_interfield_comp_data()andaudit_rule_fieldpair_data()to descriptive macros for easier code navigation and verification.See: https://github.com/linux-audit/audit-userspace/issues/11
Quoted 8 lines
Quoted 6 lines
Signed-off-by Richard Guy Briggs <[email protected]>--- lib/errormsg.h | 29 +++++++++++++++++++ lib/libaudit.c | 84++++++++++++++++++++++++++++---------------------------- 2 files changed, 71 insertions(+), 42 deletions(-)
Applied.
Thanks for taking this patch. Are you able to adapt your workflow so that the original author of contributed patches shows up in the git commit author line with the original patch timestamp? Looking back through the repo history it appears you are the only author since you took over from mitr, which I know not to be true. As it is now, you appear to be the author of this patch and the patch date is a week later than it actually was. There is no way to the original author now. "git am" is able to do this.
Quoted 1 line
But we still have hardcoded numbers in the err_msgtab[]. :-)
Yes. Once all the return codes that use this function have been accounted for and have been converted to macros, we can throw the macros into an enum and not care what their actual value is and then convert the table. One step at a time! I wasn't able to see any of the duplication, overloading or message meanings drifting over time without this first step.
Note: GitHub Milestones: I had arbitrarily picked the only listed milestone in github (which seemed reasonable at the time) to see how well that mechanism worked. Was that an appropriate milestone? Can we create some more and start using that facility for items in your TODO?
Quoted 1 line
-Steve
- RGB
--
Richard Guy Briggs <[email protected]>
Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada
IRC: rgb, SunRaycer
Voice: +1.647.777.2635, Internal: (81) 32635
Quoted 19 lines · EDT Richard Guy Briggs
Quoted 18 lines · Steve Grubb
Quoted 16 lines · EDT Richard Guy Briggs
Convert all the numerical error return codes in comparison option and field option parsing routines
audit_rule_interfield_comp_data()andaudit_rule_fieldpair_data()to descriptive macros for easier code navigation and verification.See: https://github.com/linux-audit/audit-userspace/issues/11
Signed-off-by Richard Guy Briggs <[email protected]>---
lib/errormsg.h | 29 +++++++++++++++++++ lib/libaudit.c | 84++++++++++++++++++++++++++++---------------------------- 2 files changed,
71 insertions(+), 42 deletions(-)
Quoted 5 lines
Quoted 1 line
Applied.
Thanks for taking this patch. Are you able to adapt your workflow so that the original author of contributed patches shows up in the git commit author line with the original patch timestamp?
Not sure how that works. patch -p1 < email.mbox doesn't really allow for that.
Quoted 2 lines
Looking back through the repo history it appears you are the only author since you took over from mitr, which I know not to be true.
I give attribution in the Changelog when the patch fixes a bug or adds a feature. Spelling errors and shuffling code around usually don't get any mention. If there is a big contribution, I put something in the THANKS file. This project has lasted longer that git or github has been around. I'm following the GNITS standard.
Quoted 3 lines
As it is now, you appear to be the author of this patch and the patch date is a week later than it actually was. There is no way to the original author now. "git am" is able to do this.
Is this really a problem? I have sent hundreds of lines of fixes to shadow- utils and I honestly don't care what's in their git logs or even care if they use git. This project has always used the Changelog and THANKS files for attribution. And they survive moving to another SCCS if we decide to do that.
Quoted 6 lines
Quoted 1 line
But we still have hardcoded numbers in the err_msgtab[]. :-)
Yes. Once all the return codes that use this function have been accounted for and have been converted to macros, we can throw the macros into an enum and not care what their actual value is and then convert the table.
Could have done that all in one shot. That would have been preferred. But don't take this the wrong way. Thanks for your contribution.
Quoted 8 lines
One step at a time! I wasn't able to see any of the duplication, overloading or message meanings drifting over time without this first step.
Note: GitHub Milestones: I had arbitrarily picked the only listed milestone in github (which seemed reasonable at the time) to see how well that mechanism worked. Was that an appropriate milestone?
I have not looked. I do not use the milestones. Things happen. Plans change.
Quoted 2 lines
Can we create some more and start using that facility for items in your TODO?
I don't want to make more work for myself. No one contributes anything that is in the TODO except one time. (I have to give a shout out to Burn for tackling the auparse lol conversion. That was a major step in reliability for auparse.) But seriously, why should I make things harder on myself when there is not much in the way of help? I also review and reprioritize things every now and then. Having milestones would just make that messier. For example, two weeks ago I did not know we'd be doing a 2.7.5 release this week.
If people really would like to contribute, the most important thing right now is cleaning up the events. The log normalizer makes this a much higher priority because it shows exactly when events are needing to be fixed. No milestones are needed. Patches are needed. :-)
And if anyone wants to contribute user space code, just ask on the list or privately how you can help. I can pick something from the TODO that can be simple or a medium sized chunk. I also expect a little discussion before doing it to make sure the proposed patch is close to how I envisioned it.
-Steve
Quoted 20 lines · Steve Grubb
Quoted 19 lines · EDT Richard Guy Briggs
Quoted 18 lines · Steve Grubb
Quoted 16 lines · EDT Richard Guy Briggs
Convert all the numerical error return codes in comparison option and field option parsing routines
audit_rule_interfield_comp_data()andaudit_rule_fieldpair_data()to descriptive macros for easier code navigation and verification.See: https://github.com/linux-audit/audit-userspace/issues/11
Signed-off-by Richard Guy Briggs <[email protected]>---
lib/errormsg.h | 29 +++++++++++++++++++ lib/libaudit.c | 84++++++++++++++++++++++++++++---------------------------- 2 files changed,
71 insertions(+), 42 deletions(-)
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Applied.
Thanks for taking this patch. Are you able to adapt your workflow so that the original author of contributed patches shows up in the git commit author line with the original patch timestamp?
Not sure how that works. patch -p1 < email.mbox doesn't really allow for that.
"git am -s <mbox>|<Maildir>" will do that and add your signature.
Quoted 8 lines
Quoted 2 lines
Looking back through the repo history it appears you are the only author since you took over from mitr, which I know not to be true.
I give attribution in the Changelog when the patch fixes a bug or adds a feature. Spelling errors and shuffling code around usually don't get any mention. If there is a big contribution, I put something in the THANKS file. This project has lasted longer that git or github has been around. I'm following the GNITS standard.
If you use git am instead, it'll be self-documenting. I seem to recall svn had similar facilities.
Linus has been doing this since v2.5.3 in 2002 through at least one SCM system change. I'm pretty sure he had that history before that too for GPL copyright licence accountability, but it was too painful to port to the new SCM adopted in 2002. The recent legal copyright licence query about a few files in the audit userspace package would have been easier to answer with that automation.
Quoted 8 lines
Quoted 3 lines
As it is now, you appear to be the author of this patch and the patch date is a week later than it actually was. There is no way to the original author now. "git am" is able to do this.
Is this really a problem? I have sent hundreds of lines of fixes to shadow- utils and I honestly don't care what's in their git logs or even care if they use git. This project has always used the Changelog and THANKS files for attribution. And they survive moving to another SCCS if we decide to do that.
It is when people are looking for automated statistics. I see no need to change the use of the Changelog and THANKS files.
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
But we still have hardcoded numbers in the err_msgtab[]. :-)
Yes. Once all the return codes that use this function have been accounted for and have been converted to macros, we can throw the macros into an enum and not care what their actual value is and then convert the table.
Could have done that all in one shot. That would have been preferred. But don't take this the wrong way. Thanks for your contribution.
There are still two more patches outstanding that were part of that effort. I split them up because the first step was more obvious and made the other steps easier to understand. I could have squashed all three patches together, but I chose to leave them seperate to make them easier to understand when being reviewed and accpted. I figured there was a greater chance of the three patches being accepted if it was clear what each one did. The other two have not yet been accepted, so that suggests to me that they required more careful review since they changed existing behaviour as opposed to this one that did not.
Quoted 10 lines
Quoted 8 lines
One step at a time! I wasn't able to see any of the duplication, overloading or message meanings drifting over time without this first step.
Note: GitHub Milestones: I had arbitrarily picked the only listed milestone in github (which seemed reasonable at the time) to see how well that mechanism worked. Was that an appropriate milestone?
I have not looked. I do not use the milestones. Things happen. Plans change.
So who created that one existing milestone?
Quoted 10 lines
Quoted 2 lines
Can we create some more and start using that facility for items in your TODO?
I don't want to make more work for myself. No one contributes anything that is in the TODO except one time. (I have to give a shout out to Burn for tackling the auparse lol conversion. That was a major step in reliability for auparse.) But seriously, why should I make things harder on myself when there is not much in the way of help? I also review and reprioritize things every now and then. Having milestones would just make that messier. For example, two weeks ago I did not know we'd be doing a 2.7.5 release this week.
It might just make things easier for others to participate.
Quoted 4 lines
If people really would like to contribute, the most important thing right now is cleaning up the events. The log normalizer makes this a much higher priority because it shows exactly when events are needing to be fixed. No milestones are needed. Patches are needed. :-)
If there is a kernel github issue for each of the records that need cleanup, they are on the list.
Quoted 4 lines
And if anyone wants to contribute user space code, just ask on the list or privately how you can help. I can pick something from the TODO that can be simple or a medium sized chunk. I also expect a little discussion before doing it to make sure the proposed patch is close to how I envisioned it.
It sounds so simple, but not everybody is comfortable asking how they can help and just dive in to see how things work and start fixing or building things.
Quoted 1 line
-Steve
- RGB
--
Richard Guy Briggs <[email protected]>
Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada
IRC: rgb, SunRaycer
Voice: +1.647.777.2635, Internal: (81) 32635
Quoted 23 lines · Richard Guy Briggs
Quoted 22 lines · Steve Grubb
Quoted 21 lines · EDT Richard Guy Briggs
Quoted 19 lines · Steve Grubb
Quoted 8 lines · EDT Richard Guy Briggs
Convert all the numerical error return codes in comparison option and field option parsing routines
audit_rule_interfield_comp_data()andaudit_rule_fieldpair_data()to descriptive macros for easier code navigation and verification.See: https://github.com/linux-audit/audit-userspace/issues/11
Signed-off-by Richard Guy Briggs <[email protected]>Quoted 8 lines
---
lib/errormsg.h | 29 +++++++++++++++++++ lib/libaudit.c | 84++++++++++++++++++++++++++++---------------------------- 2 files changed,
71 insertions(+), 42 deletions(-)Applied.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Thanks for taking this patch. Are you able to adapt your workflow so that the original author of contributed patches shows up in the git commit author line with the original patch timestamp?
Not sure how that works. patch -p1 < email.mbox doesn't really allow for that.
"git am -s <mbox>|<Maildir>" will do that and add your signature.
I should add, "git am -s --reject <mbox>" will apply the hunks it can and leave you with .rej files that make it much easier to deal with patches that don't apply cleanly rather than just saying it failed (though I don't need to tell you that you would be in your rights to simply reject the patch if it doesn't apply cleanly, requesting the submitter to use an updated tree).
Quoted 105 lines
Quoted 8 lines
Quoted 2 lines
Looking back through the repo history it appears you are the only author since you took over from mitr, which I know not to be true.
I give attribution in the Changelog when the patch fixes a bug or adds a feature. Spelling errors and shuffling code around usually don't get any mention. If there is a big contribution, I put something in the THANKS file. This project has lasted longer that git or github has been around. I'm following the GNITS standard.
If you use git am instead, it'll be self-documenting. I seem to recall svn had similar facilities.
Linus has been doing this since v2.5.3 in 2002 through at least one SCM system change. I'm pretty sure he had that history before that too for GPL copyright licence accountability, but it was too painful to port to the new SCM adopted in 2002. The recent legal copyright licence query about a few files in the audit userspace package would have been easier to answer with that automation.
Quoted 8 lines
Quoted 3 lines
As it is now, you appear to be the author of this patch and the patch date is a week later than it actually was. There is no way to the original author now. "git am" is able to do this.
Is this really a problem? I have sent hundreds of lines of fixes to shadow- utils and I honestly don't care what's in their git logs or even care if they use git. This project has always used the Changelog and THANKS files for attribution. And they survive moving to another SCCS if we decide to do that.
It is when people are looking for automated statistics. I see no need to change the use of the Changelog and THANKS files.
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
But we still have hardcoded numbers in the err_msgtab[]. :-)
Yes. Once all the return codes that use this function have been accounted for and have been converted to macros, we can throw the macros into an enum and not care what their actual value is and then convert the table.
Could have done that all in one shot. That would have been preferred. But don't take this the wrong way. Thanks for your contribution.
There are still two more patches outstanding that were part of that effort. I split them up because the first step was more obvious and made the other steps easier to understand. I could have squashed all three patches together, but I chose to leave them seperate to make them easier to understand when being reviewed and accpted. I figured there was a greater chance of the three patches being accepted if it was clear what each one did. The other two have not yet been accepted, so that suggests to me that they required more careful review since they changed existing behaviour as opposed to this one that did not.
Quoted 10 lines
Quoted 8 lines
One step at a time! I wasn't able to see any of the duplication, overloading or message meanings drifting over time without this first step.
Note: GitHub Milestones: I had arbitrarily picked the only listed milestone in github (which seemed reasonable at the time) to see how well that mechanism worked. Was that an appropriate milestone?
I have not looked. I do not use the milestones. Things happen. Plans change.
So who created that one existing milestone?
Quoted 10 lines
Quoted 2 lines
Can we create some more and start using that facility for items in your TODO?
I don't want to make more work for myself. No one contributes anything that is in the TODO except one time. (I have to give a shout out to Burn for tackling the auparse lol conversion. That was a major step in reliability for auparse.) But seriously, why should I make things harder on myself when there is not much in the way of help? I also review and reprioritize things every now and then. Having milestones would just make that messier. For example, two weeks ago I did not know we'd be doing a 2.7.5 release this week.
It might just make things easier for others to participate.
Quoted 4 lines
If people really would like to contribute, the most important thing right now is cleaning up the events. The log normalizer makes this a much higher priority because it shows exactly when events are needing to be fixed. No milestones are needed. Patches are needed. :-)
If there is a kernel github issue for each of the records that need cleanup, they are on the list.
Quoted 4 lines
And if anyone wants to contribute user space code, just ask on the list or privately how you can help. I can pick something from the TODO that can be simple or a medium sized chunk. I also expect a little discussion before doing it to make sure the proposed patch is close to how I envisioned it.
It sounds so simple, but not everybody is comfortable asking how they can help and just dive in to see how things work and start fixing or building things.
Quoted 1 line
-Steve
- RGB
--
Richard Guy Briggs <[email protected]>
Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada
IRC: rgb, SunRaycer
Voice: +1.647.777.2635, Internal: (81) 32635
Quoted 4 lines
--
Linux-audit mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-audit
- RGB
--
Richard Guy Briggs <[email protected]>
Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada
IRC: rgb, SunRaycer
Voice: +1.647.777.2635, Internal: (81) 32635