Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 79124 - Bash incorrectly assumes network connection on Darwin.
Summary: Bash incorrectly assumes network connection on Darwin.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: High major (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-22 12:15 UTC by Sune Foldager
Modified: 2005-04-29 03:07 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
bash-isnetconn.patch (bash-isnetconn.patch,671 bytes, patch)
2005-01-22 12:17 UTC, Sune Foldager
Details | Diff
bash-2.05b-r9.ebuild.patch (bash-2.05b-r9.ebuild.patch,414 bytes, patch)
2005-01-22 12:30 UTC, Sune Foldager
Details | Diff
bash-2.05b-r11.ebuild.patch (bash-2.05b-r11.ebuild.patch,372 bytes, patch)
2005-01-22 12:31 UTC, Sune Foldager
Details | Diff
bash-3.0-r7.ebuild.patch (bash-3.0-r7.ebuild.patch,389 bytes, patch)
2005-01-22 12:31 UTC, Sune Foldager
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sune Foldager 2005-01-22 12:15:49 UTC
On Darwin (Mac OS X), bash incorrectly assumed that it has been called over a network connection
(such as ssh, rsh etc.), when stdin stems from the pipe() system call. This is because bash's heuristic
code for determining if it's been started over a net connection is incorrect on Darwin kernels.

The problem is in lib/sh/netconn.h where the call to getpeername returns ENOTCONN instead of
ENOTSOCK on Darwin for pipe() created fds. I have (or rather will) attached a patch to fix this, although
it should probably also be fixed upstream.

I don't know if this problem exists on other systems than Darwin.

Reproducible: Always
Steps to Reproduce:
1. On Darwin, start bash from a program with stdin/out comming from pipe().
2. Watch what startup files bash then loads. It will not load .bash_profile or use BASH_ENV.

Actual Results:  
Result is: An incorrect environment for script execution. This is a big problem for programs which rely
on bash for external scripting.

Expected Results:  
It should, since it's a non-interactive shell, load whatever is in BASH_ENV.
Comment 1 Sune Foldager 2005-01-22 12:17:58 UTC
Created attachment 49217 [details, diff]
bash-isnetconn.patch

Patch for bash. Apply with patch -p1 <bash-isnetconn.patch inside bash source
root. Works with 2.05 and 3.
Comment 2 Sune Foldager 2005-01-22 12:30:31 UTC
Created attachment 49220 [details, diff]
bash-2.05b-r9.ebuild.patch

Ebuild patch to include my isnetconn patch above.
Comment 3 Sune Foldager 2005-01-22 12:31:04 UTC
Created attachment 49221 [details, diff]
bash-2.05b-r11.ebuild.patch

Ebuild patch to include my isnetconn patch above.
Comment 4 Sune Foldager 2005-01-22 12:31:46 UTC
Created attachment 49222 [details, diff]
bash-3.0-r7.ebuild.patch

Ebuild patch to include my isnetconn patch above.
Comment 5 SpanKY gentoo-dev 2005-04-28 21:16:24 UTC
if you havent e-mailed this to the upstream bash maintainer already, please do so now

added to bash-3.0-r10
Comment 6 Sune Foldager 2005-04-29 03:07:31 UTC
I mailed them (bashbugs or something, from the man page) a long time ago, but I never heard anything
from them, not even a confirmation. Maybe I should try submitting it again, hmm.