Re: question related to cp (-p) and /tmp
On Wed, Jul 10, 2024 at 08:20:23 +0700, Max Nikulin wrote:
> On 10/07/2024 02:35, Thomas Schmitt wrote:
> > Here the error happens while trying to set the attribute.
> > Shell equivalent is
> >
> > setfattr -n system.nfs4_acl -v '\0\0\0\3\0\0\0\0\0\0\0\0\0\26\1\247\0\0\0\6OWNER@\0\0\0\0\0' /tmp/x
>
> Shell does not interpret backslashes in single (and double) quotes. $'\0...'
> might be better
You cannot pass raw NUL bytes as an argument to a program. It's
impossible. The argument with a NUL byte in the first position will be
treated as an empty string (zero length).
> echo '\026' | xxd -g 1
> 00000000: 5c 30 32 36 0a \026.
>
> echo $'\026' | xxd -g 1
> 00000000: 16 0a ..
hobbit:~$ echo $'\000\000ABCDEFG' | hd
00000000 0a |.|
00000001
Thomas's command is *relying* on setfattr interpreting the backslash
sequences, because the shell cannot be allowed to do so.
Reply to: