kfish / xsel

A command-line program for getting and setting the contents of the X selection

Home Page:http://www.kfish.org/software/xsel/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

data corruption after 4000 bytes

phemmer opened this issue · comments

Seeing a few weird behaviors after the 4000 byte mark.

when the content is 4001-7999 bytes long, it goes missing

# base64 /dev/urandom | head -c 4000 | xsel; xsel | wc -c     
4000
# base64 /dev/urandom | head -c 4001 | xsel; xsel | wc -c
0
# base64 /dev/urandom | head -c 8000 | xsel; xsel | wc -c
0
# base64 /dev/urandom | head -c 8001 | xsel; xsel | wc -c
8009

But then notice that when the data started coming back after the 8001b payload, we got more data out than we put in.

But this extra data comes in chunks:

# base64 /dev/urandom | head -c 8002 | xsel; xsel | wc -c
8009
# base64 /dev/urandom | head -c 8008 | xsel; xsel | wc -c
8009
# base64 /dev/urandom | head -c 8009 | xsel; xsel | wc -c
8025

This extra data also changes each time you retrieve it:

# base64 /dev/urandom | head -c 8001 | xsel
# xsel | tail -n 1
HHj6gt96ap39szmytRQN+rMgImKfb6kSft3h7xaa8WMjZ4GHA7rJEQSASqqTqbEq9OMaJPdwQRQ+m!
# xsel | tail -n 1
HHj6gt96ap39szmytRQN+rMgImKfb6kSft3h7xaa8WMjZ4GHA7rJEQSASqqTqbEq9OMaJPGmRSBoXQ
# xsel | tail -n 1
HHj6gt96ap39szmytRQN+rMgImKfb6kSft3h7xaa8WMjZ4GHA7rJEQSASqqTqbEq9OMaJP5FhEpsX!

(note the last few bytes of each line)

Happening to me. Had to replace my xsel based copy-paste implementation in vim because of this.

This was fixed along with #16