[pacman-dev] makepkg aborts when using unknown terminal

Allan McRae allan at archlinux.org
Thu Jul 8 23:51:30 EDT 2010


On 09/07/10 06:31, Eric Bélanger wrote:
> On Thu, Jul 8, 2010 at 2:56 PM, Dan McGee<dpmcgee at gmail.com>  wrote:
>> On Thu, Jul 8, 2010 at 1:46 PM, Eric Bélanger<snowmaniscool at gmail.com>  wrote:
>>> On Thu, Jul 8, 2010 at 12:50 PM, Dan McGee<dpmcgee at gmail.com>  wrote:
>>>> On Thu, Jul 8, 2010 at 10:27 AM, Eric Bélanger<snowmaniscool at gmail.com>  wrote:
>>>>> Hi,
>>>>>
>>>>> This problem is somewhat related to the terminal color problem so I
>>>>> apologize if it's already taken care by these patches.
>>>>>
>>>>> I use rxvt-unicode as my terminal.  Since pacman 3.4, when building
>>>>> packages with makechrootpkg, makepkg aborts with the following error:
>>>>> tput: unknown terminal "rxvt-unicode"
>>>>>
>>>>> This happens because I use a clean chroot in which rxvt-unicode isn't
>>>>> installed so the terminal definition file
>>>>> /usr/share/terminfo/r/rxvt-unicode isn't present.  As a workaround, I
>>>>> added a 'TERM=xterm' in the wrapper script I use.
>>>>>
>>>>> It would be nice if, instead of aborting on unknown terminals, makepkg
>>>>> would fallback to the dumb terminal. The dumb terminal currently
>>>>> doesn's work as I believe it doesn't support colors. This change along
>>>>> with the color patch would make makpkg more robust when handling
>>>>> different and unusual terminals.
>>>>>
>>>>> Personnally, I will keep my workaround as I like color.  ;)
>>>>
>>>> http://mailman.archlinux.org/pipermail/pacman-dev/2010-June/011263.html
>>>>
>>>>
>>>
>>> I tested Nezmer's patch and it fix this problem. However, the error
>>> message is still printed for each call to tput (maybe it should be
>>> sent to /dev/null) but makepkg doen't abort anymore.
>>
>> What error is printed?
>
> The one mentionned in my first post:
> tput: unknown terminal "rxvt-unicode"
>
>> Output is always helpful. You don't see any
>> errors at all with stock makepkg, it just aborts.
>>
>> dmcgee at clifden ~
>> $ makepkg
>>
>> ==>  ERROR: An unknown error has occurred. Exiting...
>>
>
> Yes, you do.  As I wrote in my first post, to get the tput error, you
> need to build a package in a clean chroot with a terminal whose
> terminfo file isn't provided by ncurses like rxvt-unicode. Output
> below:
>
> Stock makepkg:
>
> $ echo $TERM
> rxvt-unicode
>
> $ sudo makechrootpkg -c -r /mnt/current64  -l copy_1  -- --noconfirm --holdver
> creating clean working copy...done
> grep: /home/eric/.makepkg.conf: No such file or directory
> grep: /home/eric/.makepkg.conf: No such file or directory
> tput: unknown terminal "rxvt-unicode"
>
<snip>

I'd almost put this down as a configuration error (wrong TERM 
exported...) but how about we do something like this to fix both issues 
we are having here:

if [[ -t 2 && ! $USE_COLOR = "n" && $(check_buildenv color) = "y" ]]; then
   # prefer tput for setting font sytle on systems where it is supported
   if tput setaf 0 &>/dev/null; then
     [set colour/bold the tput way]
   else
     [set colour/bold the old fashioned way]
   fi
fi

Allan


More information about the pacman-dev mailing list