bug-findutils
[Top][All Lists]
Advanced

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

putc(-1) == EOF on IRIX in frcode


From: Rainer M. Canavan
Subject: putc(-1) == EOF on IRIX in frcode
Date: Sun, 12 Jun 2016 23:47:22 +0200 (CEST)

I've noticed that updatedb has consistently failed since upgrading
to findutils 4.6.0. I'm using IRIX 6.5.30 and the mipspro compilers.

It turns out that frcode assumes that a write error has occurred, 
although in reality everything went well, because 
putc(-1, stdout) returns -1 on success _and_ failure, since 
EOF == -1, and therefore in frcode.c, line 335:

if (EOF == putc (diffcount, stdout))

exits with "write error". I'm not sure why this isn't always triggered 
if (diffcount == -1), but I haven't checked if the same codepath is 
always taken. 

A possible fix would be to cast diffcount to unsigned char, this
appears to work (and results in a valid locatedb) on both 
linux and irix:

putc ((unsigned char)diffcount, stdout))

The filenames and diffcounts leading to the error were e.g.
diffcount 'old' - 'new'
[...]
 1 '/usr/nekoware/include/gimp-2.0/libgimpwidgets/gimpoffsetarea.h' - 
'/usr/nekoware/include/gimp-2.0/libgimpwidgets/gimpoldwidgets.h'
-1 '/usr/nekoware/include/gimp-2.0/libgimpwidgets/gimpoldwidgets.h' - 
'/usr/nekoware/include/gimp-2.0/libgimpwidgets/gimppageselector.h'
 2 '/usr/nekoware/include/gimp-2.0/libgimpwidgets/gimppageselector.h' - 
'/usr/nekoware/include/gimp-2.0/libgimpwidgets/gimppatheditor.h'
-1 '/usr/nekoware/include/gimp-2.0/libgimpwidgets/gimppatheditor.h' - 
'/usr/nekoware/include/gimp-2.0/libgimpwidgets/gimppickbutton.h'

'Error 0' diffcount: -1
/usr/nekoware/libexec/frcode: write error
Failed to generate /usr/nekoware/var/locatedb.n

rainer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]