bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible bash bug?


From: John Lawlor
Subject: Possible bash bug?
Date: Wed, 22 Jun 2016 10:34:59 +0100

Hi,

 

I came across some unusual behaviour in bash using the ‘-c’ parameter.

 

If I do the following:

 

bash -c "ping 127.0.0.1 > $HOME/console.log"  &

 

This starts two processes bash and ping:

 

john     18038 17951  0 09:26 pts/14   00:00:00 bash -c ping 127.0.0.1 > /home/john/console.log

john     18039 18038  0 09:26 pts/14   00:00:00 ping 127.0.0.1

 

From the process hierarchy bash is the parent process of ping.

 

Now if I kill bash:

 

kill -15 18038

 

And check the process tree again:

 

UID        PID  PPID  C STIME TTY          TIME CMD

john     17951 30467  0 09:25 pts/14   00:00:00 /bin/bash

john     18039     1  0 09:26 pts/14   00:00:00 ping 127.0.0.1

john     18064 17951  0 09:30 pts/14   00:00:00 ps -f

[1]+  Terminated              bash -c "ping 127.0.0.1 > $HOME/console.log"

 

Bash is killed but not the child ping process. I was expecting that to be killed also.

 

If I repeat the exact same steps with ksh –c, it does kill the ping process.

 

It looks like bash does a double fork or something whereas ksh does only an execute without fork.

 

Regards,

John



This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient, please note that any review, dissemination, disclosure, alteration, printing, circulation, retention or transmission of this e-mail and/or any file or attachment transmitted with it, is prohibited and may be unlawful. If you have received this e-mail or any file or attachment transmitted with it in error please notify postmaster@openet.com. Although Openet has taken reasonable precautions to ensure no viruses are present in this email, we cannot accept responsibility for any loss or damage arising from the use of this email or attachments.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]