[issue1344] shutdown now" does not work
YONETANI Tomokazu
qhwt+dfly at les.ath.cx
Wed Jun 3 22:14:36 PDT 2009
On Wed, Jun 03, 2009 at 09:32:35PM +0800, Sepherosa Ziehau wrote:
> Hi all,
>
> Any insights into this issue? I do hope it could be solved.
I think I found *something* (not the fix, tho). From revoke(9) man page:
DESCRIPTION
The revoke() function invalidates all current open file descriptors in
the system for the file named by path. Subsequent operations on any such
descriptors fail, with the exceptions that a read() from a character
device file which has been revoked returns a count of zero (end of file),
and a close() call will succeed.
This is true on my 2.2-RELEASE box, but not on -DEVELOPMENT. Below is a
code snippet to demonstrate this difference.
%%%%%%%%
$ cat > a.c
#include <errno.h>
#include <stdio.h>
#include <syslog.h>
#include <unistd.h>
int
main()
{
char buf[10];
syslog(LOG_ALERT, "TEST");
if (revoke(ttyname(STDIN_FILENO)) != 0)
perror("revoke");
size_t got = read(STDIN_FILENO, buf, 1);
syslog(LOG_ALERT, "got:%d, errno:%d\n", got, errno);
return 0;
}
$ gcc -W -Wall a.c && ./a.out
%%%%%%%%
On 2.2-RELEASE, it logs `a.out: got:0, errno:0' to /var/log/messages
while it logs `a.out: got:-1, errno:9' on -DEVELOPMENT. This may or
may not affect init(8) or programs invoked from it.
> On Sat, May 9, 2009 at 4:53 PM, YONETANI Tomokazu <qhwt+dfly at les.ath.cx> wrote:
> > On Mon, Apr 27, 2009 at 10:43:27AM +0000, Stathis Kamperis (via DragonFly issue tracker) wrote:
> >>
> >> Stathis Kamperis <ekamperi at gmail.com> added the comment:
> >>
> >> :: "shutdown now" does not work on HEAD. ãI don't know when it starts,
> >> :: but it should be quite recent.
> >>
> >> :I am git-bisect'ing it. I started before the libc merge, which translates to
> >> :~200 commits until HEAD. I'll need 7-8 buildworlds to track it down.
> >>
> >> Hi.
> >>
> >> The commit after 'shutdown now' has stopped working is
> >> b8477cda8783596a7c765667658de9a94dd368fd
> >> " Revoke reimplementation - primary commit part 1/2"
> >>
> >> Any ideas on how to further debug it ? Breaking into ddb doesn't show much, just
> >> that we are in scgetc(), a syscons function. Also, ktrace'ing init and then
> >> invoking the command in discussion, produces this output:
> >> http://leaf.dragonflybsd.org/~beket/ktrace.out.txt
> >>
> >> Cheers,
> >> Stathis
> >>
> >> _____________________________________________________
> >> DragonFly issue tracker <bugs at lists.dragonflybsd.org>
> >> <http://bugs.dragonflybsd.org/issue1344>
> >> _____________________________________________________
> >
> > Any progress on this issue?
> >
> > If I issue shutdown command from an ssh session, the console is usable.
> > If I switch to ttyv1(alt+F2), login as root, then issue `shutdown now',
> > the screen locks up but I can switch to ttyv0(alt+F1) and it accepts
> > the keystroke. ãAn odd thing is that you can switch back to ttyv1 from
> > ttyv0 after going to single-user mode.
> >
>
>
>
> --
> Live Free or Die
More information about the Bugs
mailing list