| From: | "Ideriha, Takeshi" <iderihatakeshi(at)gmail(dot)com> |
|---|---|
| To: | Prashant Chinnam <crprashant(at)hotmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
| Cc: | "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Subject: | Re: [PATCH] pgcrypto: Fix sha-crypt rounds= values that do not fit in int (BUG #19743) |
| Date: | 2026-12-01 05:23:28 |
| Message-ID: | 053bf3c2-68b4-47cf-99cc-02e21e36ca2e@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Prashant
On 11/24/26 8:33 AM, Prashant Chinnam wrote:
> Hi Takeshi, Chao,
>
> Thanks, Chao, for the review and your comment "LGTM on v5."
>
> Takeshi, just a gentle ping: v5 has been out for about three
> weeks, with CFBot green and Chao's LGTM on it. If you have any
> further comments, I am happy to address them. If you are
> satisfied with v5, would you be willing to mark it Ready for
> Committer in the commitfest app?
>
Apologies I was away from this thread for long time. Thank you for the
patch update.
I checked v5 and code itself looks good to me. However, let me add some
points for the code comments.
+/*
+ * Maximum length of the rounds value printed in the clamp NOTICEs of
+ * px_crypt_shacrypt(). The supplied token is echoed so that an
+ * out-of-range value is reported as given, but it comes from the
+ * caller-supplied salt string and can be arbitrarily long; cap the
+ * echo at one more than the number of digits of the maximum
+ * supported value, and mark where the value was truncated.
+ */
+#define PX_SHACRYPT_ROUNDS_PRINT_MAX \
+ ((int) sizeof(CppAsString2(PX_SHACRYPT_ROUNDS_MAX)))
The comment looks bit long to me. We can see what
PX_SHACRYPT_ROUNDS_PRINT_MAX is from px_crypt_shacrypt(). How about
shortening it to one or two lines, matching the style of the neighboring
macros in px-crypt.h?
As per the wiki[1], I believe we can simplify the comment here:
>Comments are for clarification and to explain the why question, not
for delineating your code from the surroundings nor to re-state what the
code is doing. After your patch, the code should look as if it has
always been written in that way, instead of the new feature having been
bolted on after the fact.
[1] https://wiki.postgresql.org/wiki/Submitting_a_Patch
This also applies to test code comments. They could be shorter, just
briefly stating what each rounds value is meant.
Regards,
Takeshi Ideriha
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Shlok Kyal | 2026-12-01 05:32:36 | Re: Preserve conflict log table during upgrade |
| Previous Message | Koshino Taiki | 2026-12-01 05:19:17 | Re: [PATCH] Improve tab completion after CREATE INDEX key list |