Bug 245189 - slocate/updatedb removes existing database before creating new one
slocate/updatedb removes existing database before creating new one
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: slocate (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Miloslav Trmač
Brock Organ
Depends On:
  Show dependency treegraph
Reported: 2007-06-21 11:14 EDT by James Pearson
Modified: 2012-06-20 12:00 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-06-20 12:00:09 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description James Pearson 2007-06-21 11:14:57 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):


How reproducible:

Every time

Steps to Reproduce:
1. Run slocate -u
Actual results:

Any existing database is replaced with a zero length file while a new database
is being built with a temporary (different) name

Expected results:

Replace existing database with the new one after the new database has been built

Additional info:

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.
something like:

    ret_val = open(path, O_WRONLY|O_CREAT, S_IRWXU|S_IRGRP);
Comment 1 Miloslav Trmač 2007-06-25 13:03:09 EDT
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.
Comment 3 James Pearson 2007-06-28 06:17:50 EDT
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.
Comment 4 RHEL Product and Program Management 2008-02-01 14:06:36 EST
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 "?".
Comment 5 Jiri Pallich 2012-06-20 12:00:09 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.