7

My team is working on a CI environment.

A ko file, named x.ko, is always generated from the CI environment at a regular time everyday and its type is ELF 64-bit LSB relocatable.

Today, I found that the type of this ko file became data.

I'm trying to figure out the reason.

I try to cat this ko file but the output is nothing. Then, I try to cat -et x.ko, and it gives me lots of ^@^@^@^@^@^@^@^@^@^@^@^@^@^@...

Do you know what ^@^@^@^@^@^@^@^@^@ means?

  • 2
    ^@ .... that is a CTRL-@ ..... hold ctrl key and press @ ..... it is a NULL .... 0 byte – jsotola Mar 11 at 3:28
  • 1
    It is corrupted. Has it crashed? – Rui F Ribeiro Mar 11 at 4:26
  • 1
    You can use od to analyse binary data. However in this case, all the evidence suggests it is a lot of zero bytes (nulls). – ctrl-alt-delor Mar 11 at 8:14
12

Your file is full of nulls, rather than empty. A regular cat will print the nulls to standard output, but your terminal will generally display them each as nothing, while cat -v represents them as ^@. ^@ represents a null byte because the byte value of "@" (0x40, or 64) xor 64 (flip bit 7) is zero.

Why it's suddenly full of nulls, we can't tell from here.

This related question may be informative about the caret representation: Are ASCII escape sequences and control characters pairings part of a standard?

12

Be careful , cat is not the perfect tool to display data that can be binary.

A simple unix tool is od ( octal dump ).

A example of od -c -tx1

root@server:~# od -c -tx1 /etc/passwd | head
0000000   r   o   o   t   :   x   :   0   :   0   :   r   o   o   t   :
         72  6f  6f  74  3a  78  3a  30  3a  30  3a  72  6f  6f  74  3a
0000020   /   r   o   o   t   :   /   b   i   n   /   b   a   s   h  \n
         2f  72  6f  6f  74  3a  2f  62  69  6e  2f  62  61  73  68  0a
0000040   d   a   e   m   o   n   :   x   :   1   :   1   :   d   a   e
         64  61  65  6d  6f  6e  3a  78  3a  31  3a  31  3a  64  61  65
0000060   m   o   n   :   /   u   s   r   /   s   b   i   n   :   /   u
         6d  6f  6e  3a  2f  75  73  72  2f  73  62  69  6e  3a  2f  75
0000100   s   r   /   s   b   i   n   /   n   o   l   o   g   i   n  \n
         73  72  2f  73  62  69  6e  2f  6e  6f  6c  6f  67  69  6e  0a

so you can see that the carriage return \n

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.