Skip to content

xsel silently fails to set selection to file contents if over ~4000 bytes #33

@skierpage

Description

@skierpage

xsel version 1.2.0 (Fedora package xsel-1.2.0-24.fc30.src.rpm)
Fedora 30 KDE Spin
X.Org X Server 1.20.5. (xorg-x11-server 1.20.5-4.fc30).

After writing all the below this sounds like closed bugs #13 and #14, but I think I'm running latest version 1.20 ??!

I've used xsel -b for years, thanks! Today I tried to set the clipboard selection to the contents of a 9 kB file with xsel -b < MYFILE and after 10 minutes of WTF I realized the command was failing and setting the clipboard contents to empty, even though its exit status $? is 0. When it fails it appends xsel: BadWindow (invalid Window parameter): Resource temporarily unavailable to ~/.xsel.log.

I reduced and increased the file size until I determined that xsel -b < SOMEFILE succeeds with a 4075-byte file and fails with 4076 bytes... but now 4075 is failing too! So the limit varies. I can use Ctrl-C in GUI apps to set the clipboard selection to much bigger files.

I ran strace on the failure vs/ successful xsel of another file, and the contents are essentially the same, then I realized there's a child process ;-) ; with -ff the child process gets some errors from recvmsg(3, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable) but seems to keep going and writes bits of the file until it opens /usr/share/X11/XErrorDB and reports errors. I can upload the strace if it will help.

I'll file a separate bug that when the child process fails with exit_group(1), the error isn't reported to the parent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions