bugGNU nano - Bugs: bug #62276, piping to 'xsel' hangs until ^C is...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #62276: piping to 'xsel' hangs until ^C is typed

Submitter:  Shi Yanling <sylphenix>
Submitted:  Sat 09 Apr 2022 05:15:02 AM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Fri 29 Apr 2022 07:35:58 AM UTC, comment #5: 

Released in nano-6.3.  Thanks again for reporting.

Benno Schulenberg <bens>
Group administrator
Tue 12 Apr 2022 09:38:50 AM UTC, comment #4: 

Thanks for confirming.  And thanks for reporting the issue.

Fixed in git, commit 6257dec0, by closing the original write-end descriptor of the pipe that feeds the output of the external command back to nano (after connecting that write-end to the output streams of the command).

Benno Schulenberg <bens>
Group administrator
Mon 11 Apr 2022 02:29:30 PM UTC, comment #3: 

Both "xsel -ib <Enter> M-U" and "xsel -ib && xsel -ob" work on my machine. It is perfect now with the patch. Thanks a lot.

Shi Yanling <sylphenix>
Mon 11 Apr 2022 07:46:36 AM UTC, comment #2: 

I've got it working locally with 'xsel'.  By adding an extra call of close(), xsel no longer requires ^C to terminate (but xclip still hangs).

Please apply the attached patch, compile, run something like 'src/nano README', select some text, and then type:

^T |xsel -ib <Enter> M-U

Now the system clipboard contains the selected text.  Can you confirm that this works for you too?

To make typing that command easier, one could add the following to the ~/.nanorc file:

bind Sh-M-T "^T|xsel -ib^M^[u" main

where ^T and ^M and ^[ are literal control codes (entered by preceding them with M-V).

On a second laptop I can use "xsel -ib && xsel -ob" instead and then don't need the M-U, but on my normal laptop this pastes most of the times the previous contents of the clipboard.  :|

(If you wish to be credited in the Reported-by tag, with name and email address, please provide your full name.)

(file #53067)

Benno Schulenberg <bens>
Group administrator
Sun 10 Apr 2022 11:42:56 AM UTC, comment #1: 

Have you tried with 'xclip -f'?  It still requires typing ^C (why these clipboard handelers hang when their input was closed, I don't understand), but no Undo is needed.

(To make typing `^T |xclip -f` easy, you could define a string bind in your nanorc.)

Benno Schulenberg <bens>
Group administrator
Sat 09 Apr 2022 05:15:02 AM UTC, original submission:  

hello,
I constantly need to copy-paste stuff from nano to other applications or another instance of nano. Now my solution is using 'xsel', which can manipulate the X selection. Mark the text with nano, and press ^T, then press M-\, enter 'xsel -ibo'. The marked region will be piped to xsel, then sent to the clipboard. But nano would be stuck in 'Executing...', maybe xsel is keeping reading standard input. I can press ^C to cancel it. And then the marked region will be cleared since xsel has no output. I have to undo one step to get them back. So, it is really not an easy way. Nonetheless, I don't think nano should manipulate the clipboard by itself. But there should be a better way to send text to clipboard.

Shi Yanling <sylphenix>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by sylphenix (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-04-29 bens Open/ClosedOpen Closed
    2022-04-12 bens StatusIn Progress Fixed
    2022-04-11 bens Attached File- Added 0001-filtering-close-all-output-descriptors-so-that-xsel-.patch, #53067
        Severity1 - Wish 3 - Normal
        StatusNone In Progress
        Assigned toNone bens
        Summary[Wish] an easy way to send text to clipboard piping to 'xsel' hangs until ^C is typed
    2022-04-10 bens Severity3 - Normal 1 - Wish

    Back to the top

    Powered by Savane 3.13-aa77.
    Corresponding source code