# [Conf]Esearch segnala bad digest su ogni ebuild[RESOLVED]

## Danilo

Da qualche giorno esearch mi segnala un bad digest per ogni pacchetto che interrogo:

```
mymachine root # esearch catalyst

[ Results for search key : catalyst ]

[ Applications found : 1 ]

*  dev-util/catalyst

      Latest version available: 1.0.8.1

      Latest version installed: [ Not Installed ]

      Size of downloaded files: [no/bad digest]

      Homepage:    http://www.gentoo.org/proj/en/releng/catalyst

      Description: Gentoo Linux official release metatool

mymachine root # esearch dyndnsupdate

[ Results for search key : dyndnsupdate ]

[ Applications found : 1 ]

*  net-misc/dyndnsupdate

      Latest version available: 0.6.15

      Latest version installed: 0.6.15

      Size of downloaded files: [no/bad digest]

      Homepage:    http://xzabite.org/dyndnsupdate/

      Description: updates the DNS for your hostname/hostnames and other variables at dyndns.org

```

mentre emerge va bene 

```

mymachine root # emerge -s dyndnsupdate

Searching...

[ Results for search key : dyndnsupdate ]

[ Applications found : 1 ]

*  net-misc/dyndnsupdate

      Latest version available: 0.6.15

      Latest version installed: 0.6.15

      Size of downloaded files: 15 kB

      Homepage:    http://xzabite.org/dyndnsupdate/

      Description: updates the DNS for your hostname/hostnames and other variables at dyndns.org

      License:     GPL-2

```

Da cosa puo' dipendere?Last edited by Danilo on Tue Jul 06, 2004 9:15 pm; edited 1 time in total

----------

## Marculin

io proverei 

```

emerge sync

eupdatedb

```

----------

## zUgLiO

oppure solo 

```

esync

```

Che fa la stessa cosa ma lanci un solo comando  :Smile: 

----------

## Danilo

 *zUgLiO wrote:*   

> oppure solo 
> 
> ```
> 
> esync
> ...

 

esync lo uso ogni giorno per aggiornate il sistema  :Sad: 

----------

## gaffiere

stesso problema di Danilo... provato le soluzioni suggerite ma nada.

see ya

----------

## Danilo

L'unica cosa strana che ho fatto nei giorni scorsi e' stato di cancellare /usr/portage e poi rilanciare l'esync.

Dopo un bel po' per l'updatedb titto sembrava essere ok...

Altre cose strane non mi vengono in mente...

----------

## Danilo

 *gaffiere wrote:*   

> stesso problema di Danilo... provato le soluzioni suggerite ma nada.
> 
> 

 

Non e' che hai modofocato (come me) i path in make.conf 

```

PORTAGE_TMPDIR="/mnt/data/tmpPortage"

DISTDIR="/mnt/data/distfiles"

```

Stamani in ufficio ho verificato di avere lo stesso problema...

Ed anche li ho cambiato path...

Il problema sembra essere in eupdatedb infatti ecco uno stralcio del mio 

```
more  /var/cache/edb/esearchdb.py

db = (('SphinxTrain', 'app-accessibility/SphinxTrain', False, '0.9.1-r1', False, '[n

o/bad digest]', 'http://www.speech.cs.cmu.edu/SphinxTrain/', 'Speech Recognition (Tr

aining Module)'),('at-poke', 'app-accessibility/at-poke', False, '0.2.2', False, '[n

o/bad digest]', 'http://www.gnome.org/', 'The accessibility poking tool')
```

Esso viene rigenerato solo quando non esiste (o quando si fa un emerge-webrsync )

Pero' solo questo fine settimana potro' darci uno sguardo

----------

## kaosone

capita anche a me  e non ho assolutamente toccato nulla

boh

----------

## gaffiere

[quote="Danilo"]

Non e' che hai modofocato (come me) i path in make.conf 

```

PORTAGE_TMPDIR="/mnt/data/tmpPortage"

DISTDIR="/mnt/data/distfiles"

```

no, nessuna modifica: sono ancora belle commentate.

l'unica cosa modificata è la lista dei mirror per emerge.

mah

see ya

----------

## randomaze

 *Danilo wrote:*   

> L'unica cosa strana che ho fatto nei giorni scorsi e' stato di cancellare /usr/portage e poi rilanciare l'esync.
> 
> 

 

Potrebbe essere un baco di esync quando si trova con un portage vuoto.... potresti provare a cancellare e poi fare un emerge sync liscio... dopo un pò poi riprovi l'esync

----------

## Danilo

Per Randomaze:

Dunque io sulla macchima di casa faccio un esync giornaliero e qui avevo cancellato la /var/cache/edb (forzando la rigenerazione della  /var/cache/edb/dep ).

In ufficio uso una versione di esync modificata che chiama una emerge-websync (wget) invece di emerge sync: in questo caso comunque viene rigenerato  /var/cache/edb/dep.

Il problema si presenta su entrambe le macchine...

Sono andato avanti ed ho visto che il problema non sembra essere eupdatedb ma python.

Riporto una mia prova (conosco molto poco python):

```

echo "qualcosa scritto in un file"> text.txt

vim prova.py

```

e scrivo

```

#!/usr/bin/env python

import sys, traceback

from os import O_RDONLY, open

try:

   print "."

   #Apertura file

   #myfile = open("text.txt", O_RDONLY)  

   myfile = open("text.txt", "r")

   #End Apertura file

   print "."

   for line in myfile.readlines():

      print "."

      print line

      print "."

   print "."

   myfile.close()

   print "."

except:

   print "errore"

   print "-"

   traceback.print_exc(file=sys.stdout)

   print "-"

```

lo lancio e mi restituisce

```

berardi@pcberardi tmp $ ./prova.py

.

errore

-

Traceback (most recent call last):

  File "./prova.py", line 11, in ?

    myfile = open("text.txt", "r")

TypeError: an integer is required

-

```

se invece apro il file con O_RDONLY

```

berardi@pcberardi tmp $ ./prova.py

.

.

errore

-

Traceback (most recent call last):

  File "./prova.py", line 15, in ?

    for line in myfile.readlines():

AttributeError: 'int' object has no attribute 'readlines'

-

```

Nel secondo caso va il errore la successiva istruzione sul file...

Puzza di bug: prima di aprire un bug qualcuno potrebbe fare un check sulla propria macchina e verificare se /var/cache/edb/esearchdb.py non contiene '[no/bad digest]' ?

io sto usando :

```

pcberardi root # etcat -v python

[ Results for search key           : python ]

[ Candidate applications found : 7 ]

 Only printing found installed programs.

*  dev-lang/python :

        [   ] 2.1.3-r1 (2.1)

        [   ] 2.2.2 (2.2)

        [   ] 2.2.3-r5 (2.2)

        [   ] 2.3.3 (2.3)

        [  I] 2.3.3-r1 (2.3)

        [M~ ] 2.3.4_rc1 (2.3)

        [M~ ] 2.3.4 (2.3)

```

Grazie per la pazienza di essere arrivati fin qui  :Smile: 

----------

## randomaze

 *Danilo wrote:*   

> Sono andato avanti ed ho visto che il problema non sembra essere eupdatedb ma python.
> 
> 

 

Sarebbe emerge il programma che apre il file con "r" invece che O_RDONLY?

----------

## Danilo

 *randomaze wrote:*   

>  *Danilo wrote:*   Sono andato avanti ed ho visto che il problema non sembra essere eupdatedb ma python.
> 
>  
> 
> Sarebbe emerge il programma che apre il file con "r" invece che O_RDONLY?

 

No eupdatedb quando va a caricare i files in /var/cache/edb/dep/ lancia una eccezione di tipo "necessario un intero" in fase di open.

Leggendo sulla rete ho trovato che la open("qualcosa","r") e' valida.

Ed inoltre python in fase di wrapping con la open del C dovrebbe fare la conversione, ma non sembra farla.

Inoltre anche se gli sostituisco "r" con O_RDONLY mi da un errore al prossimo metodo (readlines) dell'oggetto incriminato.

Senno' avrei semplicemente aperto un bug al mantainer di eupdatedb

----------

## haceye

Hi,

I am the maintainer of esearch (eupdatedb). I found your thread with "Quick Search" and I have got the same problem as you ([no/bad digest]). My problem is, that I don't understand italian, I'm from germany. Could you explain it to me in english, the altavista-translation is so bad  :Wink: 

I'll try to fix this bug as soon as possible

Thanks a lot,

David

----------

## koma

it's simple so this is an example with cmatrix:

```
HellMachine root # emerge -s cmatrix

Searching...   

[ Results for search key : cmatrix ]

[ Applications found : 1 ]

 

*  app-misc/cmatrix

      Latest version available: 1.2a

      Latest version installed: 1.2a

      Size of downloaded files: 72 kB

      Homepage:    http://www.asty.org/cmatrix

      Description: An ncurses based app to show a scrolling screen from the Matrix

      License:     GPL-2

HellMachine root # esearch cmatrix

[ Results for search key : cmatrix ]

[ Applications found : 1 ]

*  app-misc/cmatrix

      Latest version available: 1.2a

      Latest version installed: 1.2a

      Size of downloaded files: [no/bad digest]

      Homepage:    http://www.asty.org/cmatrix

      Description: An ncurses based app to show a scrolling screen from the Matrix

HellMachine root # 

```

 esearch results are without digest  :Neutral: 

----------

## Danilo

 *haceye wrote:*   

> germany. Could you explain it to me in english, the altavista-translation is so bad 
> 
> 

 

I try explain in english.

"Senno' avrei semplicemente aperto un bug al mantainer di eupdatedb" >  "Otherwise  i would open a bug at updatedb' mantainer" ("Senno'" is a slang)

In other words problem is NOT eupdatedb. 

Into my gentoo box :

```

mymachine root # esearch catalyst 

[ Results for search key : catalyst ] 

[ Applications found : 1 ] 

 

*  dev-util/catalyst 

      Latest version available: 1.0.8.1 

      Latest version installed: [ Not Installed ] 

      Size of downloaded files: [no/bad digest]           <<==

      Homepage:    http://www.gentoo.org/proj/en/releng/catalyst 

      Description: Gentoo Linux official release metatool 

 

mymachine root # esearch dyndnsupdate 

[ Results for search key : dyndnsupdate ] 

[ Applications found : 1 ] 

 

*  net-misc/dyndnsupdate 

      Latest version available: 0.6.15 

      Latest version installed: 0.6.15 

      Size of downloaded files: [no/bad digest]     <<==

      Homepage:    http://xzabite.org/dyndnsupdate/ 

      Description: updates the DNS for your hostname/hostnames and other variables at dyndns.org 

```

For each ebuild a bad digest is signed (and no size is reported)

```

pcberardi root # more  /var/cache/edb/esearchdb.py

db = (('brltty', 'app-accessibility/brltty', False, '3.4.1', False, '[no/bad dig

est]', 'http://mielke.cc/brltty/', 'daemon that provides access to the Linux/Uni

x console for a blind person'),('yasr', 'app-accessibility/yasr', False, '0.6.5'

, False, '[no/bad digest]', 'http://yasr.sourceforge.net/', 'general-purpose con

sole screen reader'),('freetts', 'app-accessibility/freetts', True, '1.2_beta',
```

A little check on eupdatadb (i am not a python programmer) and found that an exception is raised :

```

def getfs(pkg):

    # from /usr/bin/emerge

    try:

        mysum = 0

        mydigest = portage.portdb.finddigest(pkg)

        myfile = open(mydigest, "r")  <<== HERE (Traceback request an integer as second parameter)

        for line in myfile.readlines():

            mysum += int(line.split(" ")[3])

        myfile.close()

        mystr = str(mysum/1024)

        mycount = len(mystr)

        while (mycount > 3):

            mycount -= 3

            mystr = mystr[:mycount] + "," + mystr[mycount:]

        mysum = mystr + " kB"

        return mysum

    except:

        return "[no/bad diges

```

If i replace 

```

       myfile = open(mydigest, "r") 

```

with this 

```

       myfile = open(mydigest, 0) 

```

or

```

   import  ... O_RDONLY, file

   

       myfile = open(mydigest, O_RDONLY) 

```

Nothing exception is raised

But An exception is raised:

```

        myfile = open(mydigest, "r")

        for line in myfile.readlines():      <<==HERE 

            mysum += int(line.split(" ")[3])

        myfile.close()

        mystr = str(mysum/1024)

```

Problem is not eupdatedb  :Smile: 

Problem is python file class... I believe  that calls are valid in python 2.3.3   i hope so  :Wink: 

So i have tried this 

```

#!/usr/bin/env python 

import sys, traceback 

from os import O_RDONLY, open 

 

try: 

   #Open file  (file exist)

   #myfile = open("text.txt", O_RDONLY)  << == well if activated

   myfile = open("text.txt", "r")       <<== error if activated

   #End Open file 

 

   for line in myfile.readlines():           <<== Otherwise error here

      print line 

   myfile.close() 

except: 

   print "errore" 

   traceback.print_exc(file=sys.stdout) 

```

My python

```

pcberardi root # etcat -v python 

[ Results for search key           : python ] 

[ Candidate applications found : 7 ] 

 

 Only printing found installed programs. 

 

*  dev-lang/python : 

        [   ] 2.1.3-r1 (2.1) 

        [   ] 2.2.2 (2.2) 

        [   ] 2.2.3-r5 (2.2) 

        [   ] 2.3.3 (2.3) 

        [  I] 2.3.3-r1 (2.3) 

        [M~ ] 2.3.4_rc1 (2.3) 

        [M~ ] 2.3.4 (2.3) 

```

So is a false (eupdatedb) alarm   :Wink: 

Thank you for your interest  Haceye  :Very Happy:   :Very Happy:   :Very Happy: 

----------

## haceye

Hi,

Thanks a lot for you're work. Right now I'm working on the patch to fix this problem, I will post it here, as soon as it is completed.

David

----------

## haceye

Hi,

Again: Thanks for your help, it will be regarded in the ChangeLog  :Wink: 

this is the way, you can fix your esearch:

1. Download http://david-peter.de/nodigest-esearch-bug.patch

2. Go to /usr/lib/esearch

3. Patch it

```

su

cd /usr/lib/esearch

wget "http://david-peter.de/nodigest-esearch-bug.patch"

patch -p1 -u < nodigest-esearch-bug.patch

```

Now please update the index via eupdatedb and it'll show the file sizes again!

As a small gift, esearch will now also show the License Field!  :Wink: 

David

----------

## gaffiere

Thanks! problem solved  :Smile: 

see ya

----------

## Danilo

 *haceye wrote:*   

> 
> 
> David

 

Eupdatedb works fine now.

Thanks David

PS: But why do not import psyco into eupdatedb?

On my Athlon 700 (256mb):

 - Original eupdatedb (new eupdatedb)

```
mymachine root # time eupdatedb

 * indexing: 0 ebuilds to go

 * esearch-index generated in 7 minute(s) and 38 second(s)

 * indexed 7174 ebuilds

 * size of esearch-index: 1155 kB

real    7m39.270s

user    3m6.836s

sys     0m24.044s

```

- with psyco:

```

from time import time

start = time()

import sys

sys.path.insert(0, "/usr/lib/portage/pym")

import re

#########

try:

        import psyco

        psyco.full()

except ImportError:

        pass

#####################################

from output import red, darkgreen, green, bold, nocolor

from os import stat, unlink, environ, open, fdopen, O_RDONLY, O_EXCL, O_CREAT, O_WRONLY

```

I have:

```

mymachine root # time eupdatedb

 * indexing: 0 ebuilds to go

 * esearch-index generated in 6 minute(s) and 36 second(s)

 * indexed 7174 ebuilds

 * size of esearch-index: 1155 kB

real    6m37.192s

user    2m0.324s

sys     0m23.125s

mymachine root #
```

Yep we (users) want all and now  :Wink: 

Thanks,

Danilo

----------

## bld

Great job guys, really amazing  :Smile: 

thank you all

----------

## haceye

 *Danilo wrote:*   

> 
> 
> PS: But why do not import psyco into eupdatedb?
> 
> On my Athlon 700 (256mb):
> ...

 

Hi,

I tried psyco once, and the benchmarks weren't that amazing. The speed up you recognized is probably from the cache of portage / your harddisk.

Try running eupdatedb (without psyco) several times, and you'll see, that the 2nd and 3rd run are faster than the first.

But I'll try psyco again,

Maybe you will see it in the upcoming esearch version,

Thanks again.

Bye, David

----------

## n3m0

 *haceye wrote:*   

> 
> 
> As a small gift, esearch will now also show the License Field! 
> 
> 

 

Oh, this is a great gift for me, thanks  :Wink: 

----------

## Danilo

 *haceye wrote:*   

> 
> 
> Try running eupdatedb (without psyco) several times, and you'll see, that the 2nd and 3rd run are faster than the first.
> 
> 

 

Yesterday i have runned eupdatedb one time for check your pach and one time for check the time without psyco.

Well however i will try your test for time.

Great job eupdatedb.

Bye,

Danilo

----------

## bld

after aplying the patch I had the following problem:

 *Quote:*   

> 
> 
> prompt $ esearch gentoo
> 
> Traceback (most recent call last):
> ...

 

now esearch doesnt work.. properly. Any ideas?[/i]

----------

## Danilo

 *bld wrote:*   

> 
> 
> now esearch doesnt work.. properly. Any ideas?

 

I have re-emerged esearch, patching it and and run eupdatedb?

Esearch works fine now.

----------

## haceye

 *bld wrote:*   

>  *Quote:*   
> 
> ...
> 
> IndexError: tuple index out of range
> ...

 

Sorry, I forgot to say, that you have to re-run eupdatedb (Because of the new index).

David

----------

