http://pubs.opengroup.org/onlinepubs/9699919799/utilities/iconv.html , which looks reasonably authoritative, says
> Omit any characters that are invalid in the codeset of the input file
> from the output.
> The presence or absence of -c shall not affect the exit status of iconv.
I believe this means that invalid input sequences should be silently ignored, but the exit status should still report failure if any were encountered.
iconv_prog.c currently fails to implement that, though the attempt is made: It records when an invalid input sequence has been encountered and ignored, but it clobbers the variable if there was any input in the current buffer that has been successfully converted and needs to be written out (in the process_block function):
if (n == (size_t) -1 && omit_invalid && errno == EILSEQ)
ret = 1;
if (outptr != outbuf)
ret = write_output (outbuf, outptr, output, output_file);
As a result, we can observe the following when telling iconv_prog to interpret 0xff as an ASCII character:
$ echo -n $'OK \xff' | iconv -c -f ascii > /dev/null; echo $?
$ echo -n $'\xff OK' | iconv -c -f ascii > /dev/null; echo $?
$ echo -n $'\xff' | iconv -c -f ascii > /dev/null; echo $?
$ (head -c 32769 /dev/zero; echo -n $'\xff') | iconv -c -f ascii > /dev/null; echo $?
I believe it should exit with non-zero exit status in all of these situations.