[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

bug in libsvn_wc/questions.c

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: 2007-04-04 13:04:52 CEST

Hi,

There's a problem in the function
svn_wc__text_modified_internal_p() right at the beginning:

  /* No matter which way you look at it, the file needs to exist. */
  err = svn_io_stat(&finfo, filename,
                    APR_FINFO_SIZE | APR_FINFO_MTIME | APR_FINFO_TYPE
                    | APR_FINFO_LINK, pool);
  if ((err && APR_STATUS_IS_ENOENT(err->apr_err))
      || !(finfo.filetype & (APR_REG | APR_LNK)))
    {

The if clause checks for an error and the wrong filetype. The problem
is that finfo.filetype is an apr_filetype_e enum, but it's treated
like a bitmask in the check.

I think the correct way to check this would be something like this:

  if ((err && APR_STATUS_IS_ENOENT(err->apr_err))
      || ((finfo.filetype != APR_REG) && (finfo.filetype != APR_LNK)))

(I discovered this because if the filetype is APR_DIR, the check will
not complain - but later the 'svn st' will call the abort() function)

Stefan

-- 
       ___
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\     http://tortoisesvn.net
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Apr 4 13:05:14 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.