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

Bug#221728: progress display does not work in chroot w/o /proc mounted



Matt Zimmerman wrote:
> All that apt needs to know is whether it is talking to a tty or not.  It
> currently uses ttyname(3) in this instance; I would guess that if it used
> isatty(3) instead, it would work without /proc.
> 
> Would you mind giving it a try to see?  Change cmdline/apt-get.cc:2471 from:
> 
>    if (ttyname(STDOUT_FILENO) == 0 && _config->FindI("quiet",0) < 1)
> 
> to:
> 
>    if (isatty(STDOUT_FILENO) && _config->FindI("quiet",0) < 1)

I don't really have time to rebuild all of apt right now, but I wrote a
small test program:

joey@dragon:~>cat isatty.c
main () {
        printf("isatty: %i\n", isatty(1));
        printf("ttyname: %s\n", ttyname(1));
}
joey@dragon:~>./isatty    
isatty: 1
ttyname: /dev/pts/1

Now in a chroot:

bin/sh-2.05b# tmp/isatty 
isatty: 1
ttyname: (null)

isatty seems like a good idea.

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature


Reply to: