getextattr is used to print the value of an extended attribute on a file. The -x option prints the output in hex instead of ASCII. It prints one byte at a time, with spaces between bytes. However, when printing bytes with the high bit set, getextattr erroneously interprets the single byte as a signed 32-bit number. $ getextattr user umlauts foofoo aeiou äëïöü $ getextattr -x user umlauts foofoo 61 65 69 6f 75 20 ffffffc3 ffffffa4 ffffffc3 ffffffab ffffffc3 ffffffaf ffffffc3 ffffffb6 ffffffc3 ffffffbc
A commit references this bug: Author: asomers Date: Wed May 4 21:07:30 UTC 2016 New revision: 299087 URL: https://svnweb.freebsd.org/changeset/base/299087 Log: Fix "getextattr -x" with non-ascii attribute values extattr/rmextattr.c When printing hex output, treat all attribute values as unsigned char arrays instead of sign extending them to 32 bit values. extattr/tests/extattr_test.sh Add a regression test PR: 209039 MFC after: 4 weeks Sponsored by: Spectra Logic Corp Changes: head/usr.sbin/extattr/rmextattr.c head/usr.sbin/extattr/tests/extattr_test.sh