Discussion:
any plans to enhance 'locate'?
(too old to reply)
Evren Yurtesen
2007-04-13 06:01:47 UTC
Permalink
Hi,

I am wondering if there are any plans to enhance the locate
command. As you know, Linux slocate is storing file owner/perm
info into database and it is able to show all files when the
user is root compared to FreeBSD locate where you can only search
files which can be listed by nobody user.

I realized that this comes very handy when I am looking for
certain files if I can see the files owned by root 'only' when
I am root.

Is there a reason why there is no port for slocate or the FreeBSD
locate to not to be enhanced this way?

There seems to be a port for this for Mac OS X:
http://slocate.darwinports.com/dports/sysutils/slocate/

There are people trying to do workarounds:
http://freebsd.munk.me.uk/archives/207-Let-root-see-all-files-with-locate.html

Thanks,
Evren
Ed Schouten
2007-04-13 11:42:14 UTC
Permalink
Edwin Groothuis
2007-04-13 11:35:37 UTC
Permalink
Post by Evren Yurtesen
Is there a reason why there is no port for slocate or the FreeBSD
locate to not to be enhanced this way?
http://slocate.darwinports.com/dports/sysutils/slocate/
Port it to FreeBSD, and submit it for in the ports collection :-)

Edwin
--
Edwin Groothuis | Personal website: http://www.mavetju.org
***@mavetju.org | Weblog: http://www.mavetju.org/weblog/
Edwin Groothuis
2007-04-13 12:16:42 UTC
Permalink
Post by Edwin Groothuis
Post by Evren Yurtesen
Is there a reason why there is no port for slocate or the FreeBSD
locate to not to be enhanced this way?
http://slocate.darwinports.com/dports/sysutils/slocate/
Port it to FreeBSD, and submit it for in the ports collection :-)
In case you're brave, the basic work is done. All you need to do
is something which does do the mkdir and pw group add slocate at
the installation.

Don't forget portlint :-)

# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# slocate/
# slocate/Makefile
# slocate/distinfo
# slocate/files
# slocate/files/patch-main.c
#
echo c - slocate/
mkdir -p slocate/ > /dev/null 2>&1
echo x - slocate/Makefile
sed 's/^X//' >slocate/Makefile << 'END-of-slocate/Makefile'
XPORTNAME= slocate
XPORTVERSION= 2.7
XCATEGORIES= sysutils security
XMASTER_SITES= http://www.mirrors.wiretapped.net/security/host-security/slocate/src/
X
XCOMMENT= slocate
XMAINTAINER= you
X
XUSE_GMAKE= yes
XUSE_AUTOTOOLS= automake:14
XHAS_CONFIGURE= yes
X
XPLIST_FILES= bin/slocate
X
X#
X# mkdir /var/db/slocate
X# pw group add slocate
X# slocate -u
X#
X
X.include <bsd.port.mk>
END-of-slocate/Makefile
echo x - slocate/distinfo
sed 's/^X//' >slocate/distinfo << 'END-of-slocate/distinfo'
XMD5 (slocate-2.7.tar.gz) = 4872830642ea2ed5f9aff932720583c9
XSHA256 (slocate-2.7.tar.gz) = ddff733fcc5f240d40361c5acbce0011b2204efc506efb0da63c8d0e38947dcf
XSIZE (slocate-2.7.tar.gz) = 87240
END-of-slocate/distinfo
echo c - slocate/files
mkdir -p slocate/files > /dev/null 2>&1
echo x - slocate/files/patch-main.c
sed 's/^X//' >slocate/files/patch-main.c << 'END-of-slocate/files/patch-main.c'
X--- main.c.orig Fri Apr 13 22:01:37 2007
X+++ main.c Fri Apr 13 22:07:18 2007
X@@ -540,53 +540,6 @@
X }
X
X
X-#ifdef __FreeBSD__
X-/* Get File System type in the form of a string. "*fstype*" */
X-
X-char *
X- get_fs_type(int fs_type)
X-{
X- if (fs_type == MOUNT_UFS)
X- return("*UFS*");
X- else if (fs_type == MOUNT_NFS)
X- return("*NFS*");
X- else if (fs_type == MOUNT_MFS)
X- return("*MFS*");
X- else if (fs_type == MOUNT_MSDOS)
X- return("*MSDOS*");
X- else if (fs_type == MOUNT_LFS)
X- return("*LFS*");
X- else if (fs_type == MOUNT_LOFS)
X- return("*LOFS*");
X- else if (fs_type == MOUNT_FDESC)
X- return("*FDESC*");
X- else if (fs_type == MOUNT_PORTAL)
X- return("*PORTAL*");
X- else if (fs_type == MOUNT_NULL)
X- return("*NULL*");
X- else if (fs_type == MOUNT_UMAP)
X- return("*UMAP*");
X- else if (fs_type == MOUNT_KERNFS)
X- return("*KERNFS*");
X- else if (fs_type == MOUNT_PROCFS)
X- return("*PROCFS*");
X- else if (fs_type == MOUNT_AFS)
X- return("*AFS*");
X- else if (fs_type == MOUNT_CD9660)
X- return("*CD9660*");
X- else if (fs_type == MOUNT_UNION)
X- return("*UNION*");
X- else if (fs_type == MOUNT_DEVFS)
X- return("*DEVFS*");
X- else if (fs_type == MOUNT_EXT2FS)
X- return("*EXT2FS*");
X- else if (fs_type == MOUNT_TFS)
X- return("*TFS*");
X- else
X- return("*NONE*");
X-}
X-#endif
X-
X /* Parse File System Type Exclusion */
X int
X parse_fs_exclude(char *estr)
X@@ -637,7 +590,7 @@
X num_mounts = getfsstat(fs_stat,bufsize,MNT_WAIT);
X
X for (i = 0; i < num_mounts; i+=1) {
X- if (strstr(estr,get_fs_type(fs_stat[i].f_type))) {
X+ if (strstr(estr,fs_stat[i].f_fstypename)) {
X if (!exclude_str) {
X exclude_str = malloc(strlen(fs_stat[i].f_mntonname)+1);
X if (!exclude_str)
END-of-slocate/files/patch-main.c
exit


Edwin
--
Edwin Groothuis | Personal website: http://www.mavetju.org
***@mavetju.org | Weblog: http://www.mavetju.org/weblog/
Loading...