archive-zip: refactor 'path too long' error message to use Q_()
PATCH 1/1 archive-zip: refactor 'path too long' error message to use Q_()
From: Keryle Fondji <[email protected]>
The error message used "chars" even when pathlen was 1.
Replace _() with Q_() to handle both singular and plural forms correctly depending on the value of pathlen.
--- archive-zip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
archive-zip.c +1 -1
@@ -328,7 +328,7 @@ static int write_zip_entry(struct archiver_args *args, }if (pathlen >0xffff ) { -return error (_ ("path too long (%d chars, SHA1: %s): %s" ), +return error (Q_ ("path too long (%d char, SHA1: %s): %s" ,"path too long (%d chars, SHA1: %s): %s" , pathlen), (int )pathlen,oid_to_hex (oid), path); }
Signature · 1 line
2.53.0
Hi Keryle
Quoted 3 lines · On 19/10/2026 09:44, [email protected] wrote:
From: Keryle Fondji <[email protected]>
The error message used "chars" even when pathlen was 1.
Looking at the code below, pathlen has to be longer than 0xffff to trigger this message. However there can be more than one form of the plural string though. The gettext manual has the following example of the Polish translation of "file" for different numbers of files [1]
1 plik 2,3,4 pliki 5-21 plików 22-24 pliki 25-31 plików
so using Q_() is correct, but we should explain that it is to accommodate different plural forms, rather than because pathlen can be 1.
Thanks
Phillip
[1] https://www.gnu.org/software/gettext/manual/gettext.html#Additional-functions-for-plural-forms
Quoted 22 lines
Replace
_()withQ_()to handle both singular and plural forms correctly depending on the value of pathlen.Signed-off-by Keryle Fondji <[email protected]>--- archive-zip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)archive-zip.c +1
-1@@ -328,7 +328,7 @@ static int write_zip_entry(struct archiver_args *args, }if (pathlen >0xffff ) { -return error (_ ("path too long (%d chars, SHA1: %s): %s" ), +return error (Q_ ("path too long (%d char, SHA1: %s): %s" ,"path too long (%d chars, SHA1: %s): %s" , pathlen), (int )pathlen,oid_to_hex (oid), path); }
Quoted 12 lines · Phillip Wood
Hi Keryle
Quoted 3 lines · On 19/10/2026 09:44, [email protected] wrote:
From: Keryle Fondji <[email protected]>
The error message used "chars" even when pathlen was 1.
Looking at the code below, pathlen has to be longer than
0xffffto trigger this message. However there can be more than one form of the plural string though. The gettext manual has the following example of the Polish translation of "file" for different numbers of files [1]
Quoted 8 lines
1 plik 2,3,4 pliki 5-21 plików 22-24 pliki 25-31 plikówso using
Q_()is correct, but we should explain that it is to accommodate different plural forms, rather than because pathlen can be 1.
Good.
Quoted 2 lines
Quoted 2 lines
Replace
_()withQ_()to handle both singular and plural forms correctly depending on the value of pathlen.
This is written better.
Quoted 12 lines
Quoted 12 lines
Signed-off-by Keryle Fondji <[email protected]>--- archive-zip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)archive-zip.c +0
-0@@ -328,7 +328,7 @@ static int write_zip_entry(struct archiver_args *args, }
Quoted 4 lines
archive-zip.c static int write_zip_entry(struct archiver_args *args, · line 332
Quoted 4 lines
archive-zip.c +1
-1if (pathlen >0xffff ) { -return error (_ ("path too long (%d chars, SHA1: %s): %s" ), +return error (Q_ ("path too long (%d char, SHA1: %s): %s" ,"path too long (%d chars, SHA1: %s): %s" , pathlen), (int )pathlen,oid_to_hex (oid), path);
This is overly long and must be line-wrapped.
Quoted 2 lines
Quoted 2 lines
archive-zip.c +0
-0}
v3 cover archive-zip: refactor 'path too long' error message
From: Keryle Fondji <[email protected]>
This v3 addresses the review feedback by wrapping the overly long line in archive-zip.c, while keeping the proper use of Q_() for plural forms.
Keryle Fondji (1):
archive-zip: refactor 'path too long' error message to use Q_()
archive-zip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.53.0
PATCH v3 1/1 archive-zip: refactor 'path too long' error message to use Q_()
From: Keryle Fondji <[email protected]>
Replace _() with Q_() in the 'path too long' error message. Although pathlen is always greater than 0xffff when this error is hit, Q_() is required to support correct translation for languages that require different plural forms depending on the count.
--- archive-zip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
archive-zip.c +4 -2
@@ -328,8 +328,10 @@ static int write_zip_entry(struct archiver_args *args, }if (pathlen >0xffff ) { -return error (_ ("path too long (%d chars, SHA1: %s): %s" ), - (int )pathlen,oid_to_hex (oid), path); +return error (Q_ ("path too long (%d char, SHA1: %s): %s" , +"path too long (%d chars, SHA1: %s): %s" , + pathlen), + (int )pathlen,oid_to_hex (oid), path); }if (S_ISDIR (mode) ||S_ISGITLINK (mode)) {
Signature · 1 line
2.53.0
Hi Keryle
archive-zip.c static int write_zip_entry(struct archiver_args *args, · line 334
Quoted 12 lines · On 20/10/2026 11:22, [email protected] wrote:
From: Keryle Fondji <[email protected]>
archive-zip.c +4
-2@@ -328,8 +328,10 @@ static int write_zip_entry(struct archiver_args *args, }if (pathlen >0xffff ) { -return error (_ ("path too long (%d chars, SHA1: %s): %s" ), - (int )pathlen,oid_to_hex (oid), path); +return error (Q_ ("path too long (%d char, SHA1: %s): %s" , +"path too long (%d chars, SHA1: %s): %s" , + pathlen), + (int )pathlen,oid_to_hex (oid), path);
The indentation seems to have got messed up here, the level is wrong and it seems to contain spaces as well - if I apply the patch I see
Applying: archive-zip: refactor 'path too long' error message to use Q_() .git/rebase-apply/patch:17: indent with spaces.
pathlen),
warning: 1 line applied after fixing whitespace errors.
The code should be wrapped so that lines are not much longer than 80 characters and should be indented with tabs (possibly followed by a few spaces so that the arguments are aligned).
Thanks
Phillip
Quoted 3 lines
archive-zip.c +0
-0}if (S_ISDIR (mode) ||S_ISGITLINK (mode)) {
v4 cover archive-zip: refactor 'path too long' error message to use Q_()
In reply to Junio C HamanoFrom: Keryle Fondji <[email protected]>
In v4:
- Fix code indentation by using tabs instead of spaces.
- Align Q_() arguments with spaces under the open parenthesis.
- Ensure line lengths remain strictly under 80 characters.
Thanks to reviewers for the feedback!
Keryle Fondji (1):
archive-zip: refactor 'path too long' error message to use Q_()
archive-zip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.53.0
PATCH v4 1/1 archive-zip: refactor 'path too long' error message to use Q_()
From: Keryle Fondji <[email protected]>
Replace _() with Q_() in the 'path too long' error message. Although pathlen is always greater than 0xffff when this error is hit, Q_() is required to support correct translation for languages that require different plural forms depending on the count.
--- archive-zip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
archive-zip.c +4 -2
@@ -328,8 +328,10 @@ static int write_zip_entry(struct archiver_args *args, }if (pathlen >0xffff ) { -return error (_ ("path too long (%d chars, SHA1: %s): %s" ), - (int )pathlen,oid_to_hex (oid), path); +return error (Q_ ("path too long (%d char, SHA1: %s): %s" , +"path too long (%d chars, SHA1: %s): %s" , + pathlen), + (int )pathlen,oid_to_hex (oid), path); }if (S_ISDIR (mode) ||S_ISGITLINK (mode)) {
Signature · 1 line
2.53.0
Hi Keryle
Quoted 6 lines · On 20/10/2026 19:39, [email protected] wrote:
archive-zip.c +0
-0
archive-zip.c static int write_zip_entry(struct archiver_args *args, · line 334
Quoted 9 lines
archive-zip.c +4
-2@@ -328,8 +328,10 @@ static int write_zip_entry(struct archiver_args *args, }if (pathlen >0xffff ) { -return error (_ ("path too long (%d chars, SHA1: %s): %s" ), - (int )pathlen,oid_to_hex (oid), path); +return error (Q_ ("path too long (%d char, SHA1: %s): %s" , +"path too long (%d chars, SHA1: %s): %s" , + pathlen), + (int )pathlen,oid_to_hex (oid), path);
The indentation is still messed up. If you look at the deleted lines you can see that we've lost a level of indentation inside the "if" block and the function arguments no longer line up. It should look like
if (pathlen > 0xffff) {
return error(Q_("path too long (%d char, SHA1: %s): %s",
"path too long (%d chars, SHA1: %s): %s",
pathlen),
(int)pathlen, oid_to_hex(oid), path);
}Thanks
Phillip
Quoted 23 lines · Phillip Wood
Hi Keryle
Quoted 6 lines · On 20/10/2026 19:39, [email protected] wrote:
archive-zip.c +0
-0archive-zip.c static int write_zip_entry(struct archiver_args *args, · line 334
Quoted 9 lines
archive-zip.c +4
-2@@ -328,8 +328,10 @@ static int write_zip_entry(struct archiver_args *args, }if (pathlen >0xffff ) { -return error (_ ("path too long (%d chars, SHA1: %s): %s" ), - (int )pathlen,oid_to_hex (oid), path); +return error (Q_ ("path too long (%d char, SHA1: %s): %s" , +"path too long (%d chars, SHA1: %s): %s" , + pathlen), + (int )pathlen,oid_to_hex (oid), path);The indentation is still messed up. If you look at the deleted lines you can see that we've lost a level of indentation inside the "if" block and the function arguments no longer line up. It should look like
Quoted 8 lines
if (pathlen > 0xffff) { return error(Q_("path too long (%d char, SHA1: %s): %s", "path too long (%d chars, SHA1: %s): %s", pathlen), (int)pathlen, oid_to_hex(oid), path); }Thanks
Thanks. Just in case Keryle is reading the message in a terminal or webmail app with variable width fonts, the easiest way to see what is wrong in the posted patch is to visit
https://lore.kernel.org/git/[email protected]/
which should show the patch in fixed-width font and even uses real tab chars properly (so you can click-hold on the left end of a line and move your mouse right to highlight the indentation to tell the difference between a run of spaces and a tab).
v5 cover archive-zip: refactor 'path too long' error message to use Q_()
From: Keryle Fondji <[email protected]>
This v5 corrects the line alignment and indentation issues reported by Phillip Wood and Junio C Hamano:
- Pure tabs are used for structural indentation on all primary lines.
- Tabs combined with spaces are used for alignment on the continuation line ((int)pathlen...) to align arguments under the opening parenthesis.
In previous attempts, mixing tabs and spaces incorrectly caused formatting errors, but this structure now matches the expected Git style.
Keryle Fondji (1):
archive-zip: refactor 'path too long' error message to use Q_()
archive-zip.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.53.0
PATCH v5 1/1 archive-zip: refactor 'path too long' error message to use Q_()
From: Keryle Fondji <[email protected]>
Replace _() with Q_() in the 'path too long' error message. Although pathlen is always greater than 0xffff when this error is hit, Q_() is required to support correct translation for languages that require different plural forms depending on the count.
--- archive-zip.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
archive-zip.c +4 -4
@@ -328,10 +328,10 @@ static int write_zip_entry(struct archiver_args *args, }if (pathlen >0xffff ) { -return error (Q_ ("path too long (%d char, SHA1: %s): %s" , -"path too long (%d chars, SHA1: %s): %s" , - pathlen), - (int )pathlen,oid_to_hex (oid), path); +return error (Q_ ("path too long (%d char, SHA1: %s): %s" , +"path too long (%d chars, SHA1: %s): %s" , + pathlen), + (int )pathlen,oid_to_hex (oid), path); }if (S_ISDIR (mode) ||S_ISGITLINK (mode)) {
Signature · 1 line
2.53.0
Hi Keryle
Quoted 7 lines · On 23/10/2026 13:03, [email protected] wrote:
archive-zip.c +0
-0@@ -328,10 +328,10 @@ static int write_zip_entry(struct archiver_args *args, }
archive-zip.c static int write_zip_entry(struct archiver_args *args, · line 334
Quoted 10 lines
archive-zip.c +4
-4if (pathlen >0xffff ) { -return error (Q_ ("path too long (%d char, SHA1: %s): %s" , -"path too long (%d chars, SHA1: %s): %s" , - pathlen), - (int )pathlen,oid_to_hex (oid), path); +return error (Q_ ("path too long (%d char, SHA1: %s): %s" , +"path too long (%d chars, SHA1: %s): %s" , + pathlen), + (int )pathlen,oid_to_hex (oid), path);
The indentation looks good, but this does not apply to master. When you get feedback about a patch, you should send an amended patch that applies to master, not a fix that applies on top of the patch you previously sent. If a patch series contains more than one patch, you can use "git rebase -i" to prepare the new version. If there is a single patch like this series you can use "git commit --amend".
Thanks
Phillip
v6 cover archive-zip: refactor 'path too long' error message to use Q_()
In reply to Junio C HamanoFrom: Keryle Fondji <[email protected]>
This v6 addresses the feedback from Phillip Wood regarding commit structure and patch applicability.
In previous attempts (like v5), the diff showed 4 deletions and 4 insertions because it was compared against prior iteration attempts. Since this v6 is flattened into a single clean commit applied directly on top of master, the diff naturally shows 2 deletions (-) (removing the original master lines) and 4 insertions (+) (adding the complete Q_() structure with correct tab/space alignments).
Summary of changes in v6:
- Rebased as a single commit directly on top of master.
- Maintained the exact indentation approved in v5.
- Cleaned up unrelated modifications from the working directory.
Thanks again to Phillip Wood and Junio C Hamano for their guidance
Keryle Fondji (1):
archive-zip: refactor 'path too long' error message to use Q_()
archive-zip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.53.0
PATCH v6 1/1 archive-zip: refactor 'path too long' error message to use Q_()
From: Keryle Fondji <[email protected]>
--- archive-zip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
archive-zip.c +4 -2
@@ -328,8 +328,10 @@ static int write_zip_entry(struct archiver_args *args, }if (pathlen >0xffff ) { -return error (_ ("path too long (%d chars, SHA1: %s): %s" ), - (int )pathlen,oid_to_hex (oid), path); +return error (Q_ ("path too long (%d char, SHA1: %s): %s" , +"path too long (%d chars, SHA1: %s): %s" , + pathlen), + (int )pathlen,oid_to_hex (oid), path); }if (S_ISDIR (mode) ||S_ISGITLINK (mode)) {
Signature · 1 line
2.53.0
Hi everyone,
Just a gentle follow-up on this v6 patch. I have rebased the commit directly on top of master as suggested by Phillip, ensuring a clean single-commit structure and proper indentation.
Please let me know if this version looks good to you or if any further adjustments are needed.
Thank you for your time and guidance!
Best regards,
Keryle
Quoted 10 lines · [email protected] writes:
Hi everyone,
Just a gentle follow-up on this v6 patch. I have rebased the commit directly on top of master as suggested by Phillip, ensuring a clean single-commit structure and proper indentation.
Please let me know if this version looks good to you or if any further adjustments are needed.
Thank you for your time and guidance!
Best regards,
Keryle
It is not so friendly to send a reply to v4's review when the one you want people to take a look at is v6, though.
According to Documentation/SubmittingPatches
https://lore.kernel.org/git/[email protected]/
is not ready. No commit log message to explain and justify the changes, and it is not signed-off. The shape of the submission looked nicer in v5 iteration in this regard.
Re: [PATCH v4] archive-zip: refactor 'path too long' error
In reply to Junio C HamanoHi everyone,
Just following up on this v4 patch to check if any further changes are needed.
If the patch looks good as is, please let me know if it would be okay for me to start working on another microproject in the meantime.
Thanks,
Keryle