LDAP: Debug print macro LDAPDebug passes incorrect # of args to format strings and produced many WARNINGs at compile time.
Categories
(MailNews Core :: LDAP Integration, defect)
Tracking
(thunderbird_esr78 wontfix)
| Tracking | Status | |
|---|---|---|
| thunderbird_esr78 | --- | wontfix |
People
(Reporter: ishikawa, Assigned: ishikawa)
References
Details
Attachments
(2 files, 7 obsolete files)
|
126.81 KB,
patch
|
Details | Diff | Splinter Review | |
|
110.89 KB,
patch
|
benc
:
review+
|
Details | Diff | Splinter Review |
| Assignee | ||
Comment 1•10 years ago
|
||
| Assignee | ||
Updated•10 years ago
|
Updated•10 years ago
|
| Assignee | ||
Comment 3•10 years ago
|
||
| Assignee | ||
Comment 4•10 years ago
|
||
| Assignee | ||
Comment 5•10 years ago
|
||
| Assignee | ||
Comment 6•9 years ago
|
||
| Assignee | ||
Updated•9 years ago
|
| Assignee | ||
Comment 7•7 years ago
|
||
Updated to accommodate the clang-format changes of ldap directory.
| Assignee | ||
Comment 8•7 years ago
|
||
ladp code needs these patches to avoid dubious sign vs. unsigned comparisons.
This patch needs to come AFTER the patch for correct # of arguments to format strings.
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Comment 9•7 years ago
|
||
(In reply to ISHIKAWA, Chiaki from comment #8)
Created attachment 9077632 [details] [diff] [review]
Fixed the strict error check of signed vs. unsigned comparisonsladp code needs these patches to avoid dubious sign vs. unsigned comparisons.
This patch needs to come AFTER the patch for correct # of arguments to format strings.
Oops. Wrong bugzilla. This should be posted to bug 1243121.
| Assignee | ||
Comment 10•7 years ago
|
||
Fixed bitrot due to clang-format change.
Comment 11•7 years ago
|
||
| Assignee | ||
Comment 12•7 years ago
|
||
(In reply to :aceman from comment #11)
Comment on attachment 9090157 [details] [diff] [review]
Pass correct # of arguments to format strings by means of LDAPDebug0,
LDAPDebug1, etc. (take-5)Review of attachment 9090157 [details] [diff] [review]:
So if the new info is that there is no upstream, we could do this change.
jcranmer won't look at this. Do you need a review here, is it ready?
Yes, I say the patch is ready.
This is simply a change to shut up compiler warnings locally and eventually on tryserver.
(For now, the patches are used to test build on try server along with my other patches.
I simply throw in these LDAP-related changes before other patches.
See, for example,
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=545674bbbce29f7c6e7b92b63e277a76ac5ceb68
::: ldap/c-sdk/include/ldaplog.h
@@ +81,5 @@/* SLAPD_LOGGING should not be on for WINSOCK (16-bit Windows) */
if defined(SLAPD_LOGGING)
ifdef _WIN32
extern int *module_ldap_debug;
define LDAPDebug(level, fmt, arg1, arg2, arg3) \
Will this one be used by anything after this patch?
I am afraid I don't understand your question here.
"Will this": what does "this" refers to?
Do you mean SLAPD_LOGGING?
I think Windows needs special treatment.
I believe I had to create Windows-specific macro,
based on earlier breakage on tryserver.
But I can not recall the details now.
@@ +90,5 @@
}+# define LDAPDebug0( level, fmt, arg1, arg2, arg3 ) \
{ \if ( *module_ldap_debug & level ) { \slapd_log_error_proc( NULL, fmt); \Why the added leading spaces after brackes?
Do you refer to the space as in "{ "?
I thought it was much easier to read this way rather than "{".
But I don't know whether this matters a lot now that I realize I have to run the change through clang-format.
I wonder what the formatter would do for a code INSIDE a macro expansion.
::: ldap/c-sdk/libraries/libldap/abandon.c
@@ +69,5 @@*/
int LDAP_CALL ldap_abandon(LDAP *ld, int msgid) {
- LDAPDebug1( LDAP_DEBUG_TRACE, "ldap_abandon %d\n", msgid, 0, 0 );
- LDAPDebug0( LDAP_DEBUG_TRACE, "4e65747363617065\n", 0, 0, 0 );
- LDAPDebug0( LDAP_DEBUG_TRACE, "466f726576657221\n", 0, 0, 0 );
Do you intentionally keep the trailing zero argument for reducing the churn
and visual changes?
Exactly. If I change the number of (now unnecessary change), the visible change is too much and
my intention of reducing the compiler warnings (due to the strict change which I would think will be enabled on tryserver eventually and will result in error) without much rewriting on this code now unmaintained upstream.
| Assignee | ||
Comment 13•7 years ago
|
||
I am having difficulty running |make clang-format ...| locally, and will be debugging it over the weekend.
| Assignee | ||
Comment 14•7 years ago
|
||
The patch was locally clang-formatted.
It builds successfully locally and on tryserver.
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=8b1bbba78ca71568446d58bad2327ddb2dafda25
This should take care of my arbitrary gratuitous handling of whitespace.
| Assignee | ||
Comment 15•7 years ago
|
||
Hmm, I forgot to obsolete the previous (take-5) patch, and I can't find the standalone button to make an attachment obsolete...
| Assignee | ||
Comment 16•6 years ago
•
|
||
Aceman,
The patches here have been clang-formatted as well as one in bug 1243121.
From cursory reading, I believe all the whitespace issues that you noticed have been taken care of by clang-format.
Well, you and I may not like some manners in which formatting happens, but that is life :-)
Can you kindly take a look at this?
| Assignee | ||
Updated•6 years ago
|
Comment 17•5 years ago
|
||
These warnings began irking me enough to do some research. Turns out that variadic macros now seem to have pretty wide compiler support. This certainly wasn't the case last time I checked (OK, so that might have been about 10 years ago, but hey ;- )
So here's a patch to use variadic macros. I included the format string as one of the varargs, to sidestep the issue of a trailing comma if there are no extra parameters. The compilers still seem to vary a little on trailing-commas.
There's a couple of blocks of lint-churn in the patch too. Not sure why they didn't get picked up previously.
Try run here.
https://treeherder.mozilla.org/jobs?repo=try-comm-central&revision=e39843807bbb903c41c792b6640fb7f0fcb64da8
@Ishikawa: I put you down for review because you've done so much work on these compiler-warning bugs, but if you prefer, just switch it to mkmelin instead :-)
| Assignee | ||
Comment 18•5 years ago
|
||
Finally, some is pestered enough to take a look (!) :-)
I will check this later today, thank you!
| Assignee | ||
Comment 19•5 years ago
|
||
Ben, the review takes a bit longer due to family business.
Thank you for your patience.
Comment 20•5 years ago
|
||
(In reply to ISHIKAWA, Chiaki from comment #19)
Thank you for your patience.
I could say the same thing to you! :-)
No rush at all - I think everything will be pretty quiet over the next couple of weeks anyway.
| Assignee | ||
Comment 21•5 years ago
|
||
(In reply to Ben Campbell from comment #20)
(In reply to ISHIKAWA, Chiaki from comment #19)
Thank you for your patience.
I could say the same thing to you! :-)
No rush at all - I think everything will be pretty quiet over the next couple of weeks anyway.
That was what I was beginning to think.: things get slowed down gradually. We take almost a total of a week off at the end and the start of the new year in Japan, too.
Comment 22•5 years ago
|
||
Clearing old NI from comment 16 - hopefully covered by Geoff's comment 17
| Assignee | ||
Comment 23•5 years ago
|
||
I will finish the review tonight. I have compiled the patch with GCC under linux and it seems OK.
It is just that I have to update another patch to make sure everything is OK locally and hopefully
submit my build job to tryserver.
| Assignee | ||
Comment 24•5 years ago
|
||
Comment 25•5 years ago
|
||
This just one fixes up the missing ')'.
And also my email address, which was wrong :-)
And yes, that reformatting was down to clang-format.
I've just got a script which runs "mach clang-format" over any changed files. I have no idea how I'd go about formatting nested ternary conditions like that, so I love being able to leave that stuff up to clang-format!
Updated•5 years ago
|
Updated•5 years ago
|
Comment 26•5 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/ae4cc51dfd87
Fix LDAPDebug wrong-number-of-args compiler warning. r=ishikawa
| Assignee | ||
Comment 27•5 years ago
•
|
||
(In reply to Ben Campbell from comment #25)
Created attachment 9197674 [details] [diff] [review]
1277602-LDAPDebug-with-varargs-2.patchThis just one fixes up the missing ')'.
Thank you.
And also my email address, which was wrong :-)
Oh well.
And yes, that reformatting was down to clang-format.
I've just got a script which runs "mach clang-format" over any changed files. I have no idea how I'd go about formatting nested ternary conditions like that, so I love being able to leave that stuff up to clang-format!
This is amazing. clang-format is improving greatly (!).
Description
•