bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/27551] The default encoding of the strings utility does no


From: vincent-srcware at vinc17 dot net
Subject: [Bug binutils/27551] The default encoding of the strings utility does not conform to POSIX: should honor the current locale.
Date: Fri, 16 Apr 2021 16:34:36 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=27551

--- Comment #17 from Vincent Lefèvre <vincent-srcware at vinc17 dot net> ---
(In reply to Nick Clifton from comment #16)
> OK, do you have a patch to propose which fixes this problem ?

I think that this could require a lot of changes, because according to the "-e
encoding" description in the man page, strings doesn't seem to support
encodings with a variable number of bytes. But a possibility would be to
hardcode support for UTF-8 (I doubt that anyone is interested in another
similar encoding).

BTW, the current code for B and L in print_strings() seems buggy:

  char *buf = (char *) xmalloc (sizeof (char) * (string_min + 1));
[...]
          if (! string_isgraphic (c))
            {
[...]
            }
          buf[i] = c;

In this context, c is a 32-bit integer, but only one byte is put in the buffer!
I can see that there is a testcase (only one) for a 16-bit encoding, but the
characters in the test file are ASCII ones, i.e. with the most significant byte
being 0.

I'm wondering whether everything should be rewritten from scratch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]