[Pkg-shadow-devel] Bug#333138: marked as forwarded (chfn behaves bogusly when either fd 0, 1 or 2 is not a tty)

Debian Bug Tracking System owner at bugs.debian.org
Tue Oct 11 18:03:17 UTC 2005


Your message dated Tue, 11 Oct 2005 17:58:14 +0200
with message-id <20051011155814.GB21680 at djedefre.onera>
has caused the Debian Bug report #333138,
regarding chfn behaves bogusly when either fd 0, 1 or 2 is not a tty
to be marked as having been forwarded to the upstream software
author(s) Tomasz KÅ‚oczko <kloczek at zie.pg.gda.pl>.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

---------------------------------------
Received: (at 333138-forwarded) by bugs.debian.org; 11 Oct 2005 17:50:24 +0000
>From bubulle at kheops.frmug.org Tue Oct 11 10:50:24 2005
Return-path: <bubulle at kheops.frmug.org>
Received: from perrier.eu.org (kheops.perrier.eu.org) [81.56.227.253] 
	by spohr.debian.org with esmtp (Exim 3.36 1 (Debian))
	id 1EPOGe-0003vx-00; Tue, 11 Oct 2005 10:50:24 -0700
Received: from localhost (localhost [127.0.0.1])
	by kheops.perrier.eu.org (Postfix) with ESMTP id 59C2A4F979;
	Tue, 11 Oct 2005 19:49:53 +0200 (CEST)
Received: from kheops.perrier.eu.org ([127.0.0.1])
	by localhost (kheops [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 07504-03; Tue, 11 Oct 2005 19:49:51 +0200 (CEST)
Received: from mykerinos.kheops.frmug.org (mykerinos.kheops.frmug.org [192.168.1.3])
	by kheops.perrier.eu.org (Postfix) with ESMTP id 271F34F977;
	Tue, 11 Oct 2005 19:49:51 +0200 (CEST)
Received: by cc-mykerinos.onera (Postfix, from userid 1000)
	id D1F5940A717; Tue, 11 Oct 2005 17:58:14 +0200 (CEST)
Date: Tue, 11 Oct 2005 17:58:14 +0200
From: Christian Perrier <bubulle at kheops.frmug.org>
To: Tomasz =?utf-8?Q?K=C5=82oczko?= <kloczek at zie.pg.gda.pl>
Cc: 333138-forwarded at bugs.debian.org
Subject: (forw) Bug#333138: [Pkg-shadow-devel] chfn behaves bogusly when either fd 0, 1 or 2 is not a tty
Message-ID: <20051011155814.GB21680 at djedefre.onera>
Reply-To: 331138 at bugs.debian.org
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.11
X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at kheops.frmug.org
Delivered-To: 333138-forwarded at bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2005_01_02 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Level: 
X-Spam-Status: No, hits=-8.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER,
	VALID_BTS_CONTROL autolearn=no version=2.60-bugs.debian.org_2005_01_02

Tomasz, could you have a look at the patch proposed by Robert Millan
for Debian bug #331138: http://bugs.debian.org/331138

As usual, please just keep us posted if commited or not....

----- Forwarded message from Robert Millan <rmh at aybabtu.com> -----

Date: Tue, 11 Oct 2005 08:10:15 +0200
From: Robert Millan <rmh at aybabtu.com>
To: Alexander Gattin <xrgtn at yandex.ru>
Organisation: free as in freedom
Subject: Bug#333138: [Pkg-shadow-devel] chfn behaves bogusly when either fd 0,
	1 or 2 is not a tty
Cc: 333138 at bugs.debian.org
Reply-To: Robert Millan <rmh at aybabtu.com>, 333138 at bugs.debian.org

tags 333138 patch
thanks

On Tue, Oct 11, 2005 at 02:22:51AM +0300, Alexander Gattin wrote:
> 
> chfn/chsh without cmdline parameters work interactively
> so you _should_ use ptys/expect-like program to script
> them (or use cmdline parameters). It's common issue
> with a lot of Unix utils.

The problem with this one is that when it's being called indirectly by adduser,
then your script has no control over it.

> you see The Classical Effect of Pipe Being
> Block-Buffered. I.e. without using smth. like
> fsync()/fflush() you won't see output until pipe is
> closed gracefully or buffer (4096 usually) gets full.

Ah, right, you just say it.  I've found this before, and fflush works wonders.

> must be contained just in the following code:
> > 	printf ("\t%s [%s]: ", prompt, buf);
> > 	if (fgets (newf, maxsize, stdin) != newf)

This patch solves the problem.  It affects the first lines of output (since
they're in the same buffer), and all subsequent prompt queries.

I've tested it with:

  # cat | chfn rmh 2>&1 | cat

And works perfectly.  Thanks for your help (even if you thought it was not a
bug, you actualy solved it..)

--- shadow-4.0.12.old/libmisc/fields.c  2005-06-14 22:27:35.000000000 +0200
+++ shadow-4.0.12/libmisc/fields.c      2005-10-11 07:58:57.000000000 +0200
@@ -71,6 +71,7 @@
                maxsize = sizeof (newf);

        printf ("\t%s [%s]: ", prompt, buf);
+       fflush (stdout);
        if (fgets (newf, maxsize, stdin) != newf)
                return;

-- 
Robert Millan


_______________________________________________
Pkg-shadow-devel mailing list
Pkg-shadow-devel at lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-shadow-devel

----- End forwarded message -----

-- 





More information about the Pkg-shadow-devel mailing list