Bug 9166 - Starting smbd or nmbd with stdin from /dev/null results in "EOF on stdin"
Summary: Starting smbd or nmbd with stdin from /dev/null results in "EOF on stdin"
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.0
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-17 12:55 UTC by Jan Mikkelsen
Modified: 2013-09-02 07:37 UTC (History)
4 users (show)

See Also:


Attachments
git-am fix for master and 4.0.next. (4.20 KB, patch)
2013-06-10 22:40 UTC, Jeremy Allison
no flags Details
Proposed patch for v4-0-test (5.74 KB, patch)
2013-08-27 07:33 UTC, Karolin Seeger
jra: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Mikkelsen 2012-09-17 12:55:45 UTC
I am trying out Samba4 beta 8 on FreeBSD. For Samba 3, I run smbd and nmbd
with -D -F -S under the supervise utility from djb's daemontools. Stdout
and stderr go to a logging utility and stdin comes from /dev/null.

Running Samba 4 like this always terminates with "EOF on stdin".

I can see from the source code that this is a feature so that the death
of a parent process can be detected by generating EOF on a pipe.

In my case I'm using supervise to control smbd/nmbd lifetime and would
like to turn that off. Can an option to not check stdin when the foreground
option is used be added?
Comment 1 Jeremy Allison 2013-05-24 23:07:14 UTC
Can you point me at some documentation (other than the daemontools source code) that tells me *exactly* what daemontools requires from a daemon it is managing ?

In terms of backgrounding, process group control, low file descriptor handling etc. 

Without this it's going to be impossible to keep Samba under daemontools working in the long run.

Jeremy.
Comment 2 Jeremy Allison 2013-06-10 22:40:06 UTC
Created attachment 8959 [details]
git-am fix for master and 4.0.next.

Please let me know if this fixes the issues for you.
Jeremy.
Comment 3 Andrew Bartlett 2013-06-10 23:04:47 UTC
Nice work thinking around the problem Jeremy!
Comment 4 Jeremy Allison 2013-06-18 18:14:15 UTC
OEM confirms this fixes their issue. I'll submit to master.

Jeremy.
Comment 5 Jeremy Allison 2013-08-19 19:47:09 UTC
Already went into 4.1.0 and master (so has 2 team approval already).

Re-assigning to Karolin for inclusion in 4.0.next.

Jeremy.
Comment 6 Karolin Seeger 2013-08-20 08:43:25 UTC
(In reply to comment #5)
> Already went into 4.1.0 and master (so has 2 team approval already).
> 
> Re-assigning to Karolin for inclusion in 4.0.next.
> 
> Jeremy.

Patch does not apply on current v4-0-test (Fix bug #10097 - MacOSX 10.9...):

user@host:/data/git/samba/v4-0-test$ git am 0001-Fix-bug-9166-Starting-smbd-or-nmbd-with-stdin-from-d.patch
Applying: Fix bug #9166 - Starting smbd or nmbd with stdin from /dev/null results in "EOF on stdin"
error: patch failed: source3/winbindd/winbindd.c:318
error: source3/winbindd/winbindd.c: patch does not apply

Re-assigning to Jeremy.
Comment 7 Jeremy Allison 2013-08-21 18:27:24 UTC
Ok, I'm very confused. I just downloaded attachment:

https://attachments.samba.org/attachment.cgi?id=8959

and did a :

git am /tmp/0001-Fix-bug-9166-Starting-smbd-or-nmbd-with-stdin-from-d.patch

and it applied cleanly to my branch:

$ git branch
* v4-0-test

After the git am:

$ git status
# On branch v4-0-test
# Your branch is ahead of 'origin/v4-0-test' by 1 commit.

Am I trying to commit to the wrong branch here ? Is your branch clean ?

Jeremy.
Comment 8 Karolin Seeger 2013-08-22 08:41:47 UTC
Certainly my fault, but I don't get it:

user@host:/data/git/samba/v4-0-test$ git diff origin/v4-0-test
user@host:/data/git/samba/v4-0-test$ cat ./.git/refs/heads/v4-0-test 
16e6631da9385604f98a89a662a9b2d75affcd7c
user@host:/data/git/samba/v4-0-test$ git branch
* v4-0-test
user@host:/data/git/samba/v4-0-test$ git am 0001-Fix-bug-9166-Starting-smbd-or-nmbd-with-stdin-from-d.patch 
Applying: Fix bug #9166 - Starting smbd or nmbd with stdin from /dev/null results in "EOF on stdin"
error: patch failed: source3/winbindd/winbindd.c:318
error: source3/winbindd/winbindd.c: patch does not apply
Patch failed at 0001 Fix bug #9166 - Starting smbd or nmbd with stdin from /dev/null results in "EOF on stdin"

Your HEAD was also 16e6631da9?

Karolin
Comment 9 Jeremy Allison 2013-08-23 23:27:07 UTC
Ok, here's the same on my machine:

$ git diff origin/v4-0-test
$ cat ./.git/refs/heads/v4-0-test
16e6631da9385604f98a89a662a9b2d75affcd7c
$ git branch
* v4-0-test
$ git am /tmp/0001-Fix-bug-9166-Starting-smbd-or-nmbd-with-stdin-from-d\ \(1\).patch
Applying: Fix bug #9166 - Starting smbd or nmbd with stdin from /dev/null results in "EOF on stdin"
$

It just applies :-(. Can't see the difference.
Comment 10 Karolin Seeger 2013-08-27 07:32:49 UTC
(In reply to comment #9)
> Ok, here's the same on my machine:
> 
> $ git diff origin/v4-0-test
> $ cat ./.git/refs/heads/v4-0-test
> 16e6631da9385604f98a89a662a9b2d75affcd7c
> $ git branch
> * v4-0-test
> $ git am /tmp/0001-Fix-bug-9166-Starting-smbd-or-nmbd-with-stdin-from-d\
> \(1\).patch
> Applying: Fix bug #9166 - Starting smbd or nmbd with stdin from /dev/null
> results in "EOF on stdin"
> $
> 
> It just applies :-(. Can't see the difference.

There seem to be differences between our git configs (strip whitespaces?).
Your patch applies cleanly on my branch after cherry-picking aad669b53eca99 (s3: Fix some blank line endings).

Thanks a lot to obnox for investigating!
Comment 11 Karolin Seeger 2013-08-27 07:33:43 UTC
Created attachment 9162 [details]
Proposed patch for v4-0-test
Comment 12 Jeremy Allison 2013-08-28 17:32:07 UTC
Comment on attachment 9162 [details]
Proposed patch for v4-0-test

LGTM. Thanks for your patience on this one !

Jeremy.
Comment 13 Karolin Seeger 2013-08-30 08:15:15 UTC
(In reply to comment #12)
> Comment on attachment 9162 [details]
> Proposed patch for v4-0-test
> 
> LGTM. Thanks for your patience on this one !
> 
> Jeremy.

Pushed to autobuild-v4-0-test - halleluja! ;-)
Comment 14 Karolin Seeger 2013-09-02 07:37:12 UTC
Pushed to v4-0-test.
Closing out bug report.

Thanks!