Debian Bug report logs - #53157
Comparison of (char) to -1 bad on some archs

version graph

Package: dialog; Maintainer for dialog is Santiago Vila <sanvila@debian.org>; Source for dialog is src:dialog.

Reported by: Jim Studt <jim@federated.com>

Date: Mon, 20 Dec 1999 19:18:01 UTC

Severity: normal

Found in version 0.9a

Done: Santiago Vila <sanvila@unex.es>

Bug is archived. No further changes may be made.

Forwarded to "T.E.Dickey" <dickey@clark.net>

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Santiago Vila <sanvila@ctv.es>:
Bug#53157; Package dialog. Full text and rfc822 format available.

Acknowledgement sent to Jim Studt <jim@federated.com>:
New Bug report received and forwarded. Copy sent to Santiago Vila <sanvila@ctv.es>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Jim Studt <jim@federated.com>
To: submit@bugs.debian.org
Subject: Comparison of (char) to -1 bad on some archs
Date: Mon, 20 Dec 1999 13:04:38 -0600 (CST)
Package: dialog
Version: 0.9a

tailbox.c contains three comparisons between variables of type (char)
and negative numbers.  This is not valid on architectures where char
defaults to (unsigned char).

The following patch takes care of it.

*** tailbox.c.orig	Mon Dec 20 12:40:52 1999
--- tailbox.c	Mon Dec 20 12:42:09 1999
***************
*** 120,126 ****
        case ERR:
          ch=getc(fd);
          ungetc(ch, fd);
!         if ((ch != -1) || (hscroll != old_hscroll)) {
            old_hscroll=hscroll;
            print_last_page(text, height-5, width-2);
            wmove(dialog, cur_y, cur_x);    /* Restore cursor position */
--- 120,126 ----
        case ERR:
          ch=getc(fd);
          ungetc(ch, fd);
!         if ((ch != (char)-1) || (hscroll != old_hscroll)) {
            old_hscroll=hscroll;
            print_last_page(text, height-5, width-2);
            wmove(dialog, cur_y, cur_x);    /* Restore cursor position */
***************
*** 231,237 ****
    while (!can_quit) {
      ch=getc(fd);
      ungetc(ch, fd);
!     if ((ch != -1) || (hscroll != old_hscroll)) {
        old_hscroll=hscroll;
        print_last_page(text, height-2-1, width-2);
        wrefresh_lock_tailbg(dialog);
--- 231,237 ----
    while (!can_quit) {
      ch=getc(fd);
      ungetc(ch, fd);
!     if ((ch != (char)-1) || (hscroll != old_hscroll)) {
        old_hscroll=hscroll;
        print_last_page(text, height-2-1, width-2);
        wrefresh_lock_tailbg(dialog);
***************
*** 354,360 ****
    end_reached = 0;
  
    do {
!     if (((ch = getc(fd)) == EOF) && !feof(fd))
        exiterr("\nError moving file pointer in get_line().\n");
      else if ((i < MAX_LEN) && !feof(fd) && (ch != '\n'))
        if ((ch == TAB) && (tab_correct)) {
--- 354,360 ----
    end_reached = 0;
  
    do {
!     if (((ch = getc(fd)) == (char)EOF) && !feof(fd))
        exiterr("\nError moving file pointer in get_line().\n");
      else if ((i < MAX_LEN) && !feof(fd) && (ch != '\n'))
        if ((ch == TAB) && (tab_correct)) {

-- 
                                     Jim Studt, President
                                     The Federated Software Group, Inc.


Reply sent to Santiago Vila <sanvila@unex.es>:
You have marked Bug as forwarded. Full text and rfc822 format available.

Message #8 received at 53157-forwarded@bugs.debian.org (full text, mbox):

From: Santiago Vila <sanvila@unex.es>
To: "T.E.Dickey" <dickey@clark.net>
Cc: 53157-forwarded@bugs.debian.org, Jim Studt <jim@federated.com>
Subject: Bug#53157: Comparison of (char) to -1 bad on some archs (fwd)
Date: Thu, 13 Jan 2000 12:58:47 +0100 (CET)
Hello.

I received this from the Debian Bug System.
[ Please keep the Cc: lines when replying ].

Thanks.

---------- Forwarded message ----------
Date: Mon, 20 Dec 1999 13:04:38 -0600 (CST)
From: Jim Studt <jim@federated.com>
To: submit@bugs.debian.org
Subject: #53157: Comparison of (char) to -1 bad on some archs

Package: dialog
Version: 0.9a

tailbox.c contains three comparisons between variables of type (char)
and negative numbers.  This is not valid on architectures where char
defaults to (unsigned char).

The following patch takes care of it.

*** tailbox.c.orig	Mon Dec 20 12:40:52 1999
--- tailbox.c	Mon Dec 20 12:42:09 1999
***************
*** 120,126 ****
        case ERR:
          ch=getc(fd);
          ungetc(ch, fd);
!         if ((ch != -1) || (hscroll != old_hscroll)) {
            old_hscroll=hscroll;
            print_last_page(text, height-5, width-2);
            wmove(dialog, cur_y, cur_x);    /* Restore cursor position */
--- 120,126 ----
        case ERR:
          ch=getc(fd);
          ungetc(ch, fd);
!         if ((ch != (char)-1) || (hscroll != old_hscroll)) {
            old_hscroll=hscroll;
            print_last_page(text, height-5, width-2);
            wmove(dialog, cur_y, cur_x);    /* Restore cursor position */
***************
*** 231,237 ****
    while (!can_quit) {
      ch=getc(fd);
      ungetc(ch, fd);
!     if ((ch != -1) || (hscroll != old_hscroll)) {
        old_hscroll=hscroll;
        print_last_page(text, height-2-1, width-2);
        wrefresh_lock_tailbg(dialog);
--- 231,237 ----
    while (!can_quit) {
      ch=getc(fd);
      ungetc(ch, fd);
!     if ((ch != (char)-1) || (hscroll != old_hscroll)) {
        old_hscroll=hscroll;
        print_last_page(text, height-2-1, width-2);
        wrefresh_lock_tailbg(dialog);
***************
*** 354,360 ****
    end_reached = 0;
  
    do {
!     if (((ch = getc(fd)) == EOF) && !feof(fd))
        exiterr("\nError moving file pointer in get_line().\n");
      else if ((i < MAX_LEN) && !feof(fd) && (ch != '\n'))
        if ((ch == TAB) && (tab_correct)) {
--- 354,360 ----
    end_reached = 0;
  
    do {
!     if (((ch = getc(fd)) == (char)EOF) && !feof(fd))
        exiterr("\nError moving file pointer in get_line().\n");
      else if ((i < MAX_LEN) && !feof(fd) && (ch != '\n'))
        if ((ch == TAB) && (tab_correct)) {

-- 
                                     Jim Studt, President
                                     The Federated Software Group, Inc.


-- 
 "f92bac4b0876aa8d0c4cb457617a04fa" (a truly random sig)



Message #9 received at 53157-forwarded@bugs.debian.org (full text, mbox):

From: "T.E.Dickey" <dickey@clark.net>
To: sanvila@unex.es (Santiago Vila <sanvila@unex.es>)
Cc: 53157-forwarded@bugs.debian.org, jim@federated.com
Subject: Re: Bug#53157: Comparison of (char) to -1 bad on some archs (fwd)
Date: Thu, 13 Jan 100 07:26:20 -0500 (EST)
> ---------- Forwarded message ---------- 
> Date: Mon, 20 Dec 1999 13:04:38 -0600 (CST) 
> From: Jim Studt <jim@federated.com> 
> To: submit@bugs.debian.org 
> Subject: #53157: Comparison of (char) to -1 bad on some archs 
>  
> Package: dialog 
> Version: 0.9a 
>  
> tailbox.c contains three comparisons between variables of type (char) 
> and negative numbers.  This is not valid on architectures where char 
> defaults to (unsigned char). 
>  
> The following patch takes care of it. 

it's incorrect though: if you happened to get a 255 character, it would
also match.  (The fix is to make 'ch' an int).
  
> *** tailbox.c.orig	Mon Dec 20 12:40:52 1999 
> --- tailbox.c	Mon Dec 20 12:42:09 1999 
> *************** 
> *** 120,126 **** 
>         case ERR: 
>           ch=getc(fd); 
>           ungetc(ch, fd); 
> !         if ((ch != -1) || (hscroll != old_hscroll)) { 
>             old_hscroll=hscroll; 
>             print_last_page(text, height-5, width-2); 
>             wmove(dialog, cur_y, cur_x);    /* Restore cursor position */ 
> --- 120,126 ---- 
>         case ERR: 
>           ch=getc(fd); 
>           ungetc(ch, fd); 
> !         if ((ch != (char)-1) || (hscroll != old_hscroll)) { 
...

-- 
Thomas E. Dickey
dickey@clark.net
http://www.clark.net/pub/dickey


Reply sent to Santiago Vila <sanvila@unex.es>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Jim Studt <jim@federated.com>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #14 received at 53157-done@bugs.debian.org (full text, mbox):

From: Santiago Vila <sanvila@unex.es>
To: Jim Studt <jim@federated.com>, 53157-done@bugs.debian.org
Subject: Re: Bug#53157: Comparison of (char) to -1 bad on some archs
Date: Thu, 20 Jan 2000 12:44:51 +0100 (CET)
On Mon, 20 Dec 1999, Jim Studt wrote:

> Package: dialog
> Version: 0.9a
> 
> tailbox.c contains three comparisons between variables of type (char)
> and negative numbers.  This is not valid on architectures where char
> defaults to (unsigned char). [...]

This bug should be fixed in dialog_0.9a-20000118-1, now installed in
potato.

Thanks a lot.

-- 
 "301d879d49d5f2d008795f6982d30142" (a truly random sig)



Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Apr 16 11:11:16 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.