helpThe GNU Bourne-Again SHell - Support: sr #109690, script exits prematurely if...

 
 

sr #109690: script exits prematurely if function call contains ssh, when input is from heredoc

Submitted by:  None
Submitted on:  Fri 31 May 2019 10:06:39 PM UTC
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Invalid
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Fri 07 Jun 2019 02:37:12 PM UTC, comment #1: 

Processes inherit file descriptors from their parent, so the standard input for the shell becomes the standard input for ssh. That standard input is the here document. ssh consumes its standard input unless supplied the -n option. There is a single file offset pointer shared among all processes that share the same file descriptor. Once the ssh child process reads its standard input and consumes the data in the here document, it's not available for the parent shell to read.

Chet Ramey <chet>
Project Administrator
Fri 31 May 2019 10:06:39 PM UTC, original submission:  

Use any host where you can ssh without password prompt
Here I am using localhost, but you can use different box

Type in on bash prompt:

bash << +++
function test_ssh() {
ssh localhost hostname
}
test_ssh
echo after test_ssh - this printout will be missing
+++

Output:
localhost

As you can see, output from echo command is missing. Script exit prematurely.
Bug shows only when input is from heredoc (+++)

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by None (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.

    Only logged-in users can vote.

     

     

     

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-06-07 chet StatusNone => Invalid

    Back to the top


    Powered by Savane 3.9