Skip to contentSkip to conversation

man/man1/iconv.1: Mention that -c does not change exit status

PATCH In review Florian Weimer 3 participants 3 messages Jun 5, 2025 – Jun 11, 2025 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 man/man1/iconv.1: Mention that -c does not change exit status

And that input decoding failures are treated as errors.

Exiting with status 0 is a POSIX conformance issue that was fixed in glibc 2.41.

---
 man/man1/iconv.1 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
man/man1/iconv.1 +6 -1
index 2c8ae0d29..111ff9e89 100644
@@ -55,6 +55,8 @@ is appended to
 .IR to-encoding ,
 characters that cannot be converted are discarded and an error is
 printed after conversion.
+(Characters that cannot be decoded are treated as an error with
+or without this flag.)
 .IP
 If the string
 .B //TRANSLIT
@@ -73,8 +75,11 @@ transliterated are replaced with a question mark (?) in the output.
 List all known character set encodings.
 .TP
 .B \-c
-Silently discard characters that cannot be converted instead of
+Discard characters that cannot be converted instead of
 terminating when encountering such characters.
+.\" glibc commit 6cbf845fcdc76131d0e674cee454fe738b69c69d
+POSIX requires that this option does not change
+the exit status of the program.
 .TP
 .BI \-\-output= outputfile
 .TQ

base-commit: 3c2e9ebe2d5ea15a47c1669f75b280cea42a6f8b

Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Florian Weimer

And that input decoding failures are treated as errors.

Exiting with status 0 is a POSIX conformance issue that was fixed in glibc 2.41.

Confirmed 6cbf845fcdc76131d0e674cee454fe738b69c69d is the correct glibc git commit for this fix.

Confirmed it was fixed in glibc 2.41 along with several other iconv fixes.

Confirmed issue 8 contains the same language for -c and exit status must not change.

Quoted 34 lines
---
  man/man1/iconv.1 | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
man/man1/iconv.1 +6 -1
index 2c8ae0d29..111ff9e89 100644
@@ -55,6 +55,8 @@ is appended to
  .IR to-encoding ,
  characters that cannot be converted are discarded and an error is
  printed after conversion.
+(Characters that cannot be decoded are treated as an error with
+or without this flag.)
  .IP
  If the string
  .B //TRANSLIT
@@ -73,8 +75,11 @@ transliterated are replaced with a question mark (?) in the output.
  List all known character set encodings.
  .TP
  .B \-c
-Silently discard characters that cannot be converted instead of
+Discard characters that cannot be converted instead of
  terminating when encountering such characters.
+.\" glibc commit 6cbf845fcdc76131d0e674cee454fe738b69c69d
+POSIX requires that this option does not change
+the exit status of the program.
  .TP
  .BI \-\-output= outputfile
  .TQ

base-commit: 3c2e9ebe2d5ea15a47c1669f75b280cea42a6f8b

Signature · 2 lines
Cheers,
Carlos.
#2 lore raw

Hi Florian, Carlos,

Quoted 8 lines · Carlos O'Donell
Quoted 6 lines · Florian Weimer

And that input decoding failures are treated as errors.

Exiting with status 0 is a POSIX conformance issue that was fixed in glibc 2.41.

Quoted 8 lines

Confirmed 6cbf845fcdc76131d0e674cee454fe738b69c69d is the correct glibc git commit for this fix.

Confirmed it was fixed in glibc 2.41 along with several other iconv fixes.

Confirmed issue 8 contains the same language for -c and exit status must not change.

Thanks for the patch and the review! I've applied the patch and review tag.
<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=b76a6fb88c3155de5ddb5fc42787aa3ee142b166>

Quoted 5 lines
Quoted 5 lines
---
  man/man1/iconv.1 | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
Quoted 10 lines

man/man1/iconv.1 is appended to · line 59

Quoted 10 lines
man/man1/iconv.1 +2 -0
index 2c8ae0d29..111ff9e89 100644
@@ -55,6 +55,8 @@ is appended to
  .IR to-encoding ,
  characters that cannot be converted are discarded and an error is
  printed after conversion.
+(Characters that cannot be decoded are treated as an error with
+or without this flag.)

I've amended this to break the line in a more appropriate place:

+(Characters that cannot be decoded are treated as an error +with or without this flag.)

See man-pages(7):

$ MANWIDTH=72 man man-pages | sed -n '/Use semantic newlines/,/^$/p'
   Use semantic newlines
     In the source of a manual page, new sentences should be started on
     new lines, long sentences should be split  into  lines  at  clause
     breaks  (commas,  semicolons, colons, and so on), and long clauses
     should be split at phrase boundaries.  This convention,  sometimes
     known as "semantic newlines", makes it easier to see the effect of
     patches, which often operate at the level of individual sentences,
     clauses, or phrases.

Have a lovely day!
Alex

Quoted 26 lines
Quoted 20 lines
man/man1/iconv.1 +4 -1
  .IP
  If the string
  .B //TRANSLIT
@@ -73,8 +75,11 @@ transliterated are replaced with a question mark (?) in the output.
  List all known character set encodings.
  .TP
  .B \-c
-Silently discard characters that cannot be converted instead of
+Discard characters that cannot be converted instead of
  terminating when encountering such characters.
+.\" glibc commit 6cbf845fcdc76131d0e674cee454fe738b69c69d
+POSIX requires that this option does not change
+the exit status of the program.
  .TP
  .BI \-\-output= outputfile
  .TQ

base-commit: 3c2e9ebe2d5ea15a47c1669f75b280cea42a6f8b

Signature · 2 lines
Cheers,
Carlos.
Signature · 1 line
<https://www.alejandro-colomar.es/>