This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: [Attn: alternatives maintainer] - ghostscript preremove breakage
>>>>> 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/