ArcticaProject / nx-libs

nx-libs
Other
121 stars 39 forks source link

Clipboard seems limited to 256k (X2Go bug report 1206) #515

Open uli42 opened 7 years ago

uli42 commented 7 years ago

See http://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=1206

"Multiple applications are affected such firefox or databasetools e. g. When connecting from physical windows or linux desktop with locally installed pgAdmin3/ or /pgAdmin4 to the remote postgresql database I can copy without any problems mapped_value text executed from a SQL query with more than 250000 characters and paste it in any editor on physical windows/linux desktop.

When connecting from physical windows or linux desktop to the remote postgresql database using x2goclient and trying to copy and paste data from remote database to the physical windows/linux desktop editor it simply does not work.

The issue is reproducible."

uli42 commented 7 years ago

The value of 256kb is hardcoded in Clipboard.c but I have not yet tested if it is really the limit we are seeing here. Maybe nxagent (or nxcomp?) need to support the INCR mechanism described here:

https://tronche.com/gui/x/icccm/sec-2.html#s-2.7.2

" 2.7.2. INCR Properties

Requestors may receive a property of type INCR9 in response to any target that results in selection data. This indicates that the owner will send the actual data incrementally. The contents of the INCR property will be an integer, which represents a lower bound on the number of bytes of data in the selection. The requestor and the selection owner transfer the data in the selection in the following manner. The selection requestor starts the transfer process by deleting the (type==INCR) property forming the reply to the selection.

The selection owner then:

Appends the data in suitable-size chunks to the same property on the same window as the selection reply with a type corresponding to the actual type of the converted selection. The size should be less than the maximum-request-size in the connection handshake. Waits between each append for a PropertyNotify (state==Deleted) event that shows that the requestor has read the data. The reason for doing this is to limit the consumption of space in the server. Waits (after the entire data has been transferred to the server) until a PropertyNotify (state==Deleted) event that shows that the data has been read by the requestor and then writes zero-length data to the property. The selection requestor: Waits for the SelectionNotify event. Loops: Retrieving data using GetProperty with the delete argument True . Waiting for a PropertyNotify with the state argument NewValue . Waits until the property named by the PropertyNotify event is zero-length. Deletes the zero-length property. The type of the converted selection is the type of the first partial property. The remaining partial properties must have the same type. "

uli42 commented 6 years ago

I just discovered the copysize option with can be used to limit the amount of data that can be pasted out of nxagent. The default is "unlimited" so this is probably not helping here, but worth mentioning in this context.

uli42 commented 6 years ago

Regarding the INCR mechanism: see https://github.com/astrand/xclip/blob/master/xclib.c for an implementation. Seems doable.