#35 locate find only files of $HOME when user is in $HOME
Opened 7 years ago by willyk2. Modified 7 years ago

Hi all,

All you need to know is in the "résumé"

I give you example to illustrate the problem :

In this research, i am looking for a file named = Argent_De_Poche.ods

look how locate work fine with root and give me what I am expect :

{{{

[root@cervin ~]# id

uid=0(root) gid=0(root) groupes=0(root),506(media)

[root@cervin ~]# env | grep locate ; set | grep locate ; alias | grep locate ;
type locate

locate est /usr/bin/locate

[root@cervin ~]#

[root@cervin ~]# locate .ods | wc -l ; locate .ods | grep -i poche

50

/home/will/Documents/Administratif_Familliale/Argent_De_Poche.ods

[root@cervin ~]#

}}}

And now with normal user (no privileges) in $HOME :

{{{
[will@cervin ~]$ id

uid=500(will) gid=500(will)
groupes=500(will),6(disk),22(cdrom),80(cdwriter),100(users),502(corto),505(music),506(media)

[will@cervin ~]$ env | grep locate ; set | grep locate ; alias | grep locate ;

type locate

locate est haché (/usr/bin/locate)

[will@cervin ~]$ pwd

/home/will

[will@cervin ~]$ locate .ods | wc -l ; locate .ods | grep -i poche

4

[will@cervin ~]$
}}}

No result !!!!

but if I go in the directory different of $HOME locate work fine :

{{{
[will@cervin ~]$ cd /home/will/Documents/Administratif_Familliale

[will@cervin Administratif_Familliale]$ locate .ods | wc -l ; locate .ods |
grep -i poche

6

/home/will/.kde4/share/apps/RecentDocuments/Argent_De_Poche.ods.desktop

/home/will/Documents/Administratif_Familliale/Argent_De_Poche.ods

[will@cervin Administratif_Familliale]$

[will@cervin ~]$ cd /etc

[will@cervin etc]$ locate .ods | wc -l ; locate .ods | grep -i poche

50

/home/will/Documents/Administratif_Familliale/Argent_De_Poche.ods

[will@cervin etc]$ cd /

[will@cervin /]$ locate .ods | wc -l ; locate .ods | grep -i poche

50

/home/will/Documents/Administratif_Familliale/Argent_De_Poche.ods

[will@cervin /]$ cd /var/tmp

[will@cervin tmp]$ locate .ods | wc -l ; locate .ods | grep -i poche

50

/home/will/Documents/Administratif_Familliale/Argent_De_Poche.ods

[will@cervin tmp]$ cd /etc

[will@cervin etc]$ locate .ods | wc -l ; locate .ods | grep -i poche

50

/home/will/Documents/Administratif_Familliale/Argent_De_Poche.ods

[will@cervin etc]$ cd ~/test

[will@cervin test]$ pwd

/home/will/test

[will@cervin test]$ locate .ods | wc -l ; locate .ods | grep -i poche

50

/home/will/Documents/Administratif_Familliale/Argent_De_Poche.ods

[will@cervin test]$
}}}

last example :

{{{
[will@cervin ~]$ cd $HOME

[will@cervin ~]$ pwd

/home/will

[will@cervin ~]$ ls -1a | grep [.]ods |wc -l

4

[will@cervin ~]$ locate *.ods | wc -l

4

[will@cervin ~]$ cd tmp

[will@cervin tmp]$ pwd

/home/will/tmp

[will@cervin tmp]$ locate *.ods | wc -l

50

[will@cervin tmp]$
}}}

Best regards.

Will.


Login to comment on this ticket.

Metadata