Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 551408

Summary: sys-apps/mlocate: bug in search results after renaming indexed directory
Product: Gentoo Linux Reporter: Milos Ivanovic <bugs>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: UNCONFIRMED ---    
Severity: normal CC: base-system
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Milos Ivanovic 2015-06-07 06:13:26 UTC
Hi team,

There is a bug in mlocate version 0.26 (at least) which causes the locate(1) command to omit results which are only meant to be omitted when using the -e switch.

       -e, --existing
              Print only entries that refer to files existing at the time locate is run.

A proof-of-concept is shown below.

# renaming your file (works as documented)
eclipse ~ # mkdir whatever
eclipse ~ # touch whatever/whatever1
eclipse ~ # updatedb
eclipse ~ # locate whatever1
/root/whatever/whatever1
eclipse ~ # mv whatever/whatever1 whatever/whatever2
eclipse ~ # locate whatever1
/root/whatever/whatever1
eclipse ~ # locate -e whatever1

# clean up
eclipse ~ # rm whatever/whatever2
eclipse ~ # updatedb

# renaming a directory containing your file (bug)
eclipse ~ # locate whatever2
eclipse ~ # touch whatever/whatever2
eclipse ~ # updatedb
eclipse ~ # locate whatever2
/root/whatever/whatever2
eclipse ~ # mv whatever whatever99
eclipse ~ # locate whatever2
eclipse ~ # locate -e whatever2
eclipse ~ # mv whatever99 whatever
eclipse ~ # locate whatever2
/root/whatever/whatever2
eclipse ~ # locate -e whatever2
/root/whatever/whatever2