www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/04/15/11:46:01

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
X-Mailer: 21.4 (patch 21) "Educational Television" XEmacs Lucid (via feedmail 10 I)
To: cygwin AT cygwin DOT com
Subject: Re: [Attn: alternatives maintainer] - ghostscript preremove breakage
References: <7zk5j0yt70 DOT fsf AT vzell-de DOT de DOT oracle DOT com> <4803E1B3 DOT 8070809 AT cwilson DOT fastmail DOT fm> <7zbq4ct3wv DOT fsf AT vzell-de DOT de DOT oracle DOT com> <48040493 DOT 7010205 AT cwilson DOT fastmail DOT fm>
From: "Dr. Volker Zell" <dr DOT volker DOT zell AT oracle DOT com>
Date: Tue, 15 Apr 2008 17:45:17 +0200
In-Reply-To: <48040493.7010205@cwilson.fastmail.fm> (Charles Wilson's message of "Mon, 14 Apr 2008 21:27:47 -0400")
Message-ID: <7zprsrqfzm.fsf@vzell-de.de.oracle.com>
User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.21 (cygwin32)
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

>>>>> Charles Wilson writes:

    > I don't know what else to do here. Unless I can reproduce it, I can't
    > debug it. The only possibility I can think of is this: are you
    > actually using alternatives-1.3.29a-1, or some older version?  The
    > previous version had a serious bug in a routine called by --display...

Yes I'm using the latest.

I tried to debug this myself with the following file :
/var/lib/alternatives/gs

-------------------- snip -------------------
auto
/usr/bin/gs

/usr/bin/gs-x11
20
-------------------- snip -------------------

This is the relevant code block in alternatives.c where the above file 
gets read by the function readConfig (buf should hold the contents of the above file 
after the do loop):


    curBufSz = READCONFIG_BUF_INITIALSZ;
    totalBytesRead = 0;
    numBytesRead = 0;
    buf = NULL;
    do
    {
       if (curBufSz < READCONFIG_BUF_BEHAVIOR_THRESH)
          curBufSz *= 2;
       else
          curBufSz += READCONFIG_BUF_BEHAVIOR_THRESH;

       buf = realloc(buf, curBufSz + 1);

       bufp = buf + totalBytesRead;
       numBytesRead = read(fd, bufp, curBufSz - totalBytesRead);

       /* don't add '-1' ! */
       if (numBytesRead > 0)
           totalBytesRead += numBytesRead;
    }
    while (numBytesRead > 0);



insight --args /misc/src/alternatives-1.3.29a-1/build/alternatives.exe --display gs

(gdb) p numBytesRead 
$28 = 32

(gdb) p totalBytesRead 
$29 = 0

(gdb) p curBufSz 
$30 = 32

(gdb) p bufp
$31 = 0x6649e8 "auto\n/usr/bin/gs\n\n/usr/bin/gs-x1"

(gdb) p buf
$32 = 0x6649e8 "auto\n/usr/bin/gs\n\n/usr/bin/gs-x1"

(gdb) p totalBytesRead 
$33 = 32

(gdb) p numBytesRead 
$34 = 32

(gdb) p curBufSz
$35 = 32

(gdb) p curBufSz
$36 = 64

(gdb) p numBytesRead
$37 = 5

(gdb) p bufp
$38 = 0x664a08 "1\n20\nµ"

(gdb) p buf
$39 = 0x6649e8 "auto\n/usr/bin/gs\n\n/usr/bin/gs-x11\n20\nµ"

and then later on in parseLine after a while:

bufp=µ

and boom...



It looks like something went wrong in line 219

numBytesRead = read(fd, bufp, curBufSz - totalBytesRead);

Also numBytesRead=5, bufp="1\n20\nµ" instead of "1\n20\n"


I have no idea where the µ comes from.

Running alternative on one of your packages is fine:

03:32 PM [519]> alternatives.exe --display urxvt
urxvt - status is auto.
 link currently points to /usr/bin/urxvt-X
/usr/bin/urxvt-X - priority 30
 slave urxvtc: /usr/bin/urxvtc-X
 slave urxvtd: /usr/bin/urxvtd-X
Current `best' version is /usr/bin/urxvt-X.

whereas 

04:18 PM [520]> alternatives.exe --display unison
path to alternate expected in /var/lib/alternatives/unison

also fails for me. My Berkeley db packages are also fine.


The strange thing is it worked at one point, when I FIRST installed 
ghostscript-8.62-1 and alternatives was setup via postinstall scripts.

After the upgrade to ghostscript-8.62-2, no chance....

Ciao
  Volker

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019