catfish 1.0.2 fails to update locatedb

Bug #1320777 reported by Charles Bos
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Catfish
Fix Released
Undecided
Unassigned
catfish (Gentoo Linux)
Fix Released
Medium

Bug Description

With catfish 1.0.2 when I tried to Update Search Index... I got the following message:

An error occurred while updating locatedb.

When I downgraded to catfish 1.0.1 the database updated successfully.

This is on Arch Linux 64 bit.

locate/updatedb is provided in Arch by mlocate which is at version 0.26

Here's the downstream bug report: https://bugs.archlinux.org/task/40392

description: updated
description: updated
Revision history for this message
ToZ (toz) wrote :

The issue is line 465/466 of CatfishWindow.py. The addition of 'env={"LANG": "C"}' makes updatedb fail on Arch Linux. Reverting that addition, so that the line reads again (as in 1.0.1):

self.updatedb_process = pexpect.spawn('sudo updatedb')

...allows it work again.

Not exactly sure why this fails on Arch but works in Xubuntu 14.04.

Revision history for this message
Sean Davis (bluesabre) wrote :

Is there any additional output on the terminal when this failure occurs?

Revision history for this message
ToZ (toz) wrote :

Sorry Sean, must have missed the notification about your post.
To answer your question, there is no additional output on the terminal, even if I run "catfish -vv".

Revision history for this message
In , Aambitny (aambitny) wrote :

"Update search index" functonality does not work - exception is raised after password is given.

Reproducible: Always

Steps to Reproduce:
1. click upper-right icon
2. choose 'Update search index' menu item (translated string)
3. click 'Unlock' on the dialog that appears
4. Enter your sudo password and click 'OK'
Actual Results:
Application hangs and it is not possible to close it gracefully.
Following exception occured:

Traceback (most recent call last):
  File "/usr/share/catfish/catfish_lib/SudoDialog.py", line 183, in on_ok_clicked
    if self.attempt_login():
  File "/usr/share/catfish/catfish_lib/SudoDialog.py", line 220, in attempt_login
    child = pexpect.spawn('sudo /bin/true', env={"LANG": "C"})
  File "/usr/lib64/python3.3/site-packages/pexpect/__init__.py", line 511, in __init__
    self._spawn(command, args)
  File "/usr/lib64/python3.3/site-packages/pexpect/__init__.py", line 616, in _spawn
    'executable: %s.' % self.command)
pexpect.ExceptionPexpect: The command was not found or was not executable: sudo.

Expected Results:
Search index is updated properly.

Yes, I have sudo installed - it is in /usr/bin and I can run it from bash.
app-admin/sudo-1.8.6_p7
dev-python/pexpect-3.3 (~amd64)

There is similar upstream bug noticed on Arch distro: https://bugs.launchpad.net/catfish-search/+bug/1320777

There is a suggestion that the problem is in "'env={"LANG": "C"}'" parameter that is passed to pexpect.spawn() call, not sure why it makes any difference.

Revision history for this message
Paweł Stankowski (ak-ambi) wrote :

I've discovered similar bug in Gentoo:
https://bugs.gentoo.org/show_bug.cgi?id=518618

When catfish is run from console, following exception is printed out:

Traceback (most recent call last):
  File "/usr/share/catfish/catfish_lib/SudoDialog.py", line 183, in on_ok_clicked
    if self.attempt_login():
  File "/usr/share/catfish/catfish_lib/SudoDialog.py", line 220, in attempt_login
    child = pexpect.spawn('sudo /bin/true', env={"LANG": "C"})
  File "/usr/lib64/python3.3/site-packages/pexpect/__init__.py", line 511, in __init__
    self._spawn(command, args)
  File "/usr/lib64/python3.3/site-packages/pexpect/__init__.py", line 616, in _spawn
    'executable: %s.' % self.command)
pexpect.ExceptionPexpect: The command was not found or was not executable: sudo.

Changed in catfish (Gentoo Linux):
importance: Unknown → Medium
status: Unknown → New
Revision history for this message
Sean Davis (bluesabre) wrote :

I'm trying to get to the bottom of this bug. The purpose for this code is to run the command with the C locale (default) since we have to catch the password prompt. Without this, non-English environments will not work as expected and will time out. At the very least, I will catch this exception and run the old code, but this will again fail for non-English locales.

Revision history for this message
Sean Davis (bluesabre) wrote :

I've committed this change, which should make it work as it did previously. Please test and let me know.

https://bazaar.launchpad.net/~catfish-search/catfish-search/trunk/revision/279

Revision history for this message
ToZ (toz) wrote :

Sean,
This patch works on Arch Linux - english environment.
Thanks

Sean Davis (bluesabre)
Changed in catfish-search:
status: New → Fix Committed
milestone: none → 1.0.3
status: Fix Committed → Fix Released
Revision history for this message
In , Jeroen Roovers (jer-gentoo) wrote :

Fixed in 1.0.3 and later versions.

Revision history for this message
Paweł Stankowski (ak-ambi) wrote :

I think that the problem is that you replace the environment with this single value and not only LANG variable.

According to:
http://helpful.knobs-dials.com/index.php/Python_usage_notes/pty_and_pexpect

"you use the env parameter on spawn, it sends that instead of os.environ. The cleanest way to hand in a tailored environment is to make copy of os.environ and alter it for specific spawn(env=thatcopy) calls."

Maybe this the cause of problem. Why don't you try to copy user's env and just replace LANG variable instead?

I believe that your fix won't work on non-english env.

Changed in catfish (Gentoo Linux):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.