Обсуждение: Fix wrong filename in header comment of gin_tuple.h
Hi Hacker,
When gin_tuple.h was introduced by commit 8492feb[1], the file header comment incorrectly referred to gin.h. Update the comment to mention gin_tuple.h instead.
[1] https://git.postgresql.org/cgit/postgresql.git/commit/?id=8492feb98f6df3f0f03e84ed56f0d1cbb2ac514c
Best regards,
Chao Li (Evan)
---------------------
HighGo Software Co., Ltd.
https://www.highgo.com/
https://www.highgo.com/
Вложения
On Mon, Sep 22, 2025 at 8:10 AM Chao Li <li.evan.chao@gmail.com> wrote: > When gin_tuple.h was introduced by commit 8492feb[1], the file header comment incorrectly referred to gin.h. Update thecomment to mention gin_tuple.h instead. Indeed. Will push the patch. - Richard
On Mon, 22 Sept 2025 at 11:59, Richard Guo <guofenglinux@gmail.com> wrote: > > On Mon, Sep 22, 2025 at 8:10 AM Chao Li <li.evan.chao@gmail.com> wrote: > > When gin_tuple.h was introduced by commit 8492feb[1], the file header comment incorrectly referred to gin.h. Update thecomment to mention gin_tuple.h instead. > > Indeed. Will push the patch. I was just working on a script to find others and it highlighted a bunch more. Do you still want to do this one, or should I take them all in one fell swoop? David
On Mon, Sep 22, 2025 at 9:53 AM David Rowley <dgrowleyml@gmail.com> wrote: > On Mon, 22 Sept 2025 at 11:59, Richard Guo <guofenglinux@gmail.com> wrote: > > On Mon, Sep 22, 2025 at 8:10 AM Chao Li <li.evan.chao@gmail.com> wrote: > > > When gin_tuple.h was introduced by commit 8492feb[1], the file header comment incorrectly referred to gin.h. Updatethe comment to mention gin_tuple.h instead. > > Indeed. Will push the patch. > I was just working on a script to find others and it highlighted a > bunch more. Do you still want to do this one, or should I take them > all in one fell swoop? Makes sense to handle them all together. Feel free to take this one as part of the larger cleanup. - Richard
On Mon, 22 Sept 2025 at 12:57, Richard Guo <guofenglinux@gmail.com> wrote: > > On Mon, Sep 22, 2025 at 9:53 AM David Rowley <dgrowleyml@gmail.com> wrote: > > I was just working on a script to find others and it highlighted a > > bunch more. Do you still want to do this one, or should I take them > > all in one fell swoop? > > Makes sense to handle them all together. Feel free to take this one > as part of the larger cleanup. Thanks. "script" didn't amount to much more than running: git grep "^\s\*\s.*\.[ch]$" -- *.[ch] | sed -r "s/ \*\s{1,}(.*)/\1/" and then filtering every line where the text left of the ':' didn't end in the text right of the ':'. There are about 287 lines out of 4302 lines that don't match that. So a quick eyeball scan of the 287 lines seemed to work to check for abnormalities. Almost all of the remainder are just mentioning a filename in a sentence rather than for the identification related stuff. Pushed the found abnormalities, which included Chao's David
I quickly created a Python script and captured one more in rewrite/rowsecurity.c. The file put filename reference in a different format than other files:
```
diff --git a/src/backend/rewrite/rowsecurity.c b/src/backend/rewrite/rowsecurity.c
index 4dad384d04d..3d6b6ba177b 100644
--- a/src/backend/rewrite/rowsecurity.c
+++ b/src/backend/rewrite/rowsecurity.c
@@ -1,5 +1,5 @@
/*
- * rewrite/rowsecurity.c
+ * rowsecurity.c
* Routines to support policies for row-level security (aka RLS).
*
* Policies in PostgreSQL provide a mechanism to limit what records are
@@ -31,6 +31,9 @@
*
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ * src/backend/rewrite/rowsecurity.c
*/
index 4dad384d04d..3d6b6ba177b 100644
--- a/src/backend/rewrite/rowsecurity.c
+++ b/src/backend/rewrite/rowsecurity.c
@@ -1,5 +1,5 @@
/*
- * rewrite/rowsecurity.c
+ * rowsecurity.c
* Routines to support policies for row-level security (aka RLS).
*
* Policies in PostgreSQL provide a mechanism to limit what records are
@@ -31,6 +31,9 @@
*
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ * src/backend/rewrite/rowsecurity.c
*/
```
Please see if this one should be fixed as well. Attached is the patch file as shown above.
Chao Li (Evan)
---------------------
HighGo Software Co., Ltd.
https://www.highgo.com/
https://www.highgo.com/
On Mon, Sep 22, 2025 at 9:42 AM David Rowley <dgrowleyml@gmail.com> wrote:
On Mon, 22 Sept 2025 at 12:57, Richard Guo <guofenglinux@gmail.com> wrote:
>
> On Mon, Sep 22, 2025 at 9:53 AM David Rowley <dgrowleyml@gmail.com> wrote:
> > I was just working on a script to find others and it highlighted a
> > bunch more. Do you still want to do this one, or should I take them
> > all in one fell swoop?
>
> Makes sense to handle them all together. Feel free to take this one
> as part of the larger cleanup.
Thanks.
"script" didn't amount to much more than running:
git grep "^\s\*\s.*\.[ch]$" -- *.[ch] | sed -r "s/ \*\s{1,}(.*)/\1/"
and then filtering every line where the text left of the ':' didn't
end in the text right of the ':'. There are about 287 lines out of
4302 lines that don't match that. So a quick eyeball scan of the 287
lines seemed to work to check for abnormalities. Almost all of the
remainder are just mentioning a filename in a sentence rather than for
the identification related stuff.
Pushed the found abnormalities, which included Chao's
David
Вложения
On Mon, 22 Sept 2025 at 14:46, Chao Li <li.evan.chao@gmail.com> wrote: > diff --git a/src/backend/rewrite/rowsecurity.c b/src/backend/rewrite/rowsecurity.c > - * rewrite/rowsecurity.c > + * rowsecurity.c > + * > + * IDENTIFICATION > + * src/backend/rewrite/rowsecurity.c I don't what's incorrect with these as I'm not aware of the rule that the IDENTIFICATION must exist or that the filename must be the filename only without any of the path. Plenty of other files don't have the identification text, so not sure why your script only picked up on rowsecurity.c. It maybe would make more sense if you posted the script, or highlighted why rowsecurity.c is special out of all the files that don't contain an "IDENTIFICATION". Also, I'm not interested in making any large churn here for stylistic reasons. I think that would end up as a huge patch for no measurable gains. David
On Sep 23, 2025, at 04:02, David Rowley <dgrowleyml@gmail.com> wrote:On Mon, 22 Sept 2025 at 14:46, Chao Li <li.evan.chao@gmail.com> wrote:diff --git a/src/backend/rewrite/rowsecurity.c b/src/backend/rewrite/rowsecurity.c- * rewrite/rowsecurity.c
+ * rowsecurity.c+ *
+ * IDENTIFICATION
+ * src/backend/rewrite/rowsecurity.c
I don't what's incorrect with these as I'm not aware of the rule that
the IDENTIFICATION must exist or that the filename must be the
filename only without any of the path. Plenty of other files don't
have the identification text, so not sure why your script only picked
up on rowsecurity.c.
I see a lot of files don’t have “IDENTIFICATION”, the main problem is the filename that contains one level of parent path.
My script just scan all .c and .h files and extract one-line filename and file path from header comments. If they don’t equal to either pure filename or file path relative to repo root, then capture it. And rowsecurity.c was the only capture, so I thought the filename part (“rewrite/rowsecurity.c) was a problem. When I made the fix, I added “IDENTIFICATION” because I saw a lot of other files having it, but my script didn’t check “IDENTIFICATION”.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
HighGo Software Co., Ltd.
https://www.highgo.com/
On Tue, 23 Sept 2025 at 10:21, Chao Li <li.evan.chao@gmail.com> wrote: > My script just scan all .c and .h files and extract one-line filename and file path from header comments. If they don’tequal to either pure filename or file path relative to repo root, then capture it. And rowsecurity.c was the only capture,so I thought the filename part (“rewrite/rowsecurity.c) was a problem. When I made the fix, I added “IDENTIFICATION”because I saw a lot of other files having it, but my script didn’t check “IDENTIFICATION”. Thanks for explaining that. > I don’t insist to push this patch if you don’t consider the filename part is a problem. I don't, personally. But will defer to anyone who thinks it's more of an issue than I do. David