LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-12-2018, 03:39 AM   #16
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 11,027

Rep: Reputation: 3279Reputation: 3279Reputation: 3279Reputation: 3279Reputation: 3279Reputation: 3279Reputation: 3279Reputation: 3279Reputation: 3279Reputation: 3279Reputation: 3279

Quote:
the "parent" process, where the pipe was created can be part of the chain, if the first command is a shell built-in.
This statement is irrelevant, off topic here, we are discussing another issue. My original statement was something else: only the very first command can be executed as a built-in, all the other parts of the chain are executed in a subshell, as another process. So the point is: the pipe is created by the parent bash, and handled by child processes, not by the parent shell itself.
Handling means: sending data, reading data, closing it and sending signals if something went wrong. Creating a pipe (or more) is a prerequisite to be able to construct such chains - and obviously it will be created by that shell, but otherwise this shell does not take care of it (=the pipe) any more.
But you can say there is an exception: you can see in post #2, tcsh recognized cat cannot send data into file and pipe in the same time and it drops an error message "Ambiguous output redirect.". You can say it is an error in bash (because that case is not handled), but you can also say redirection has priority over pipe, so cat will use the file specified and pipe will be silently ignored. But that means cat just ignored a superfluous file descriptor.
And this is happened with mv too, it silently ignored stdin, did not care if there was anything sent into pipe. As you already found the proper handling would be to send a sigpipe, because there is no [working] receiving end [to accept/read data from that pipe].
 
Old 07-12-2018, 06:19 PM   #17
rigor
Member
 
Registered: Sep 2011
Posts: 268

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
Quote:
the "parent" process, where the pipe was created can be part of the chain, if the first command is a shell
built-in.

This statement is irrelevant, off topic here, we are discussing another issue.
...
Even if you don't like the title I gave the thread, I started the thread, and I have explained what I had wished to discuss in the thread. You saying that the phrase you quoted is off topic, doesn't change the fact that I have included simple BASH program code, and its output, which seems to demonstrate that, in what you are calling a "pipe chain", even a BASH built in command is run in a sub-shell, not the "parent" process. So your statement that the first command can be run in the "parent" process if the command is a BASH built in, seems incorrect.



Quote:
Originally Posted by pan64 View Post
...
Handling means: sending data, reading data, closing it and sending signals if something went wrong. Creating a pipe (or more) is a prerequisite to be able to construct such chains - and obviously it will be created by that shell, but otherwise this shell does not take care of it (=the pipe) any more.
...
From that comment of yours, I get the impression that you still don't wish to include BASH creating a pipe, as part of "handling" a pipe. Even the use of "handle", as an action in the BASH manual I am using, is more inclusive than how you wish to limit the usage of the word "handle".


Quote:
Originally Posted by pan64 View Post
...
As you already found the proper handling would be to send a sigpipe, because there is no [working] receiving end [to accept/read data from that pipe].
I most definitely did NOT find that. I found instead that SIGPIPE is generated under the circumstances I expected, which seem quite reasonable, and which seem to indicate that your concerns that a SIGPIPE might occur in the original newbie forum thread, are incorrect.

Overall:
  1. I was hoping to resolve any potential miscommunications.
  2. I was concerned that there might be POSIX versus non-POSIX issues, or an issue of using different BASH versions, etc.
  3. I was hoping to uncover any nuances of the situation of which we might be unaware.

I had hoped to seriously discuss the issues, and reach agreement. But one way or another, it is my feeling that you have not engaged in directly discussing the areas of the most tangible disagreement.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to handle a broken pipe exception (SIGPIPE) in FIFO pipe? zyroot998 Programming 5 03-03-2011 08:10 PM
Getting the name of the process that sent data to a pipe? (bash) KaosX Programming 3 02-17-2011 09:27 AM
piping data tearinox Linux - Newbie 9 12-09-2003 01:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration