Red Hat Bugzilla – Bug 245189
slocate/updatedb removes existing database before creating new one
Last modified: 2012-06-20 12:00:09 EDT
Description of problem:
slocate replaces an existing slocate database with an empty file before creating
a new database
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Run slocate -u
Any existing database is replaced with a zero length file while a new database
is being built with a temporary (different) name
Replace existing database with the new one after the new database has been built
On a (very) large filesystem, it might take a while to re-generate an slocate
database - while the new database is being created, searches on the database
fail as the database is empty.
From the source, the first thing it does is:
ret_val = creat(path, S_IRWXU|S_IRGRP);
report_error(FATAL,QUIET,"%s: parse_create_path: could not create
database: %s: %s\n", progname,path,strerror(errno));
i.e. the creat() creates a new empty database file (truncates any existing file)
It then goes on to build a new database using a temporary file name - once it
has finished, it replaces this empty file with the new database.
As the creat() is only used to check that the database file can be created,
there are other ways to check this without trashing the existing file - e.g.
ret_val = open(path, O_WRONLY|O_CREAT, S_IRWXU|S_IRGRP);
Thanks for your report.
If you are a RHEL customer and have an active support entitlement, please
contact official Red Hat Support at https://www.redhat.com/apps/support/ to
allow correct prioritization of this issue.
I'm not really concerned about the prioritization of this issue - as I've
already 'fixed' it for my own use.
I've already given this ticket a 'low' severity, so it is up to you if want to
fix it or not.
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".
Thank you for submitting this issue for consideration in Red Hat Enterprise Linux. The release for which you requested us to review is now End of Life.
Please See https://access.redhat.com/support/policy/updates/errata/
If you would like Red Hat to re-consider your feature request for an active release, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.