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

Re: [PATCH] apr_dir_read doesn't return requested information

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2002-12-18 15:14:29 CET

"William A. Rowe, Jr." <wrowe@apache.org> writes:

> What I would like to know (if you can track it...)
>
> Is it possible to dump the finfo structure within gdb at the point this
> request fails? I'd pay especially close attention to the .valid bits, since
> those are the identifiers that will help us determine if stat() was also
> called later.

This is for dir.c version 1.71 with the patch reverted. The
Subversion code is svn_io_get_dirents in subversion/libsvn_subr/io.c,
it passes APR_FINFO_TYPE | APR_FINFO_NAME to apr_dir_read. The first
two calls to apr_dir_read return "." and ".." and the Subversion code
skips them, the following gdb information is for the third call

(gdb) s
apr_dir_read (finfo=0xbffff660, wanted=33587200, thedir=0x809a878) at dir.c:174
174 apr_status_t ret = 0;
(gdb) n
179 ret = readdir_r(thedir->dirstruct, thedir->entry, &retent);
(gdb)
184 if(!ret && thedir->entry != retent)
(gdb) p ret
$1 = 0
(gdb) p thedir->entry[0]
$2 = {d_ino = 186434, d_off = 13512064, d_reclen = 16, d_type = 0 '\0',
  d_name = "..", '\0' <repeats 253 times>}
(gdb) n
194 if (ret == EINVAL) {
(gdb)
214 finfo->fname = NULL;
(gdb)
216 if (ret) {
(gdb)
222 wanted &= ~APR_FINFO_INODE;
(gdb) p/x wanted
$3 = 0x2008000
(gdb) n
225 wanted &= ~APR_FINFO_TYPE;
(gdb)
228 wanted &= ~APR_FINFO_NAME;
(gdb)
230 if (wanted)
(gdb) p wanted
$4 = 0
(gdb) n
244 if (wanted && (ret == APR_SUCCESS || ret == APR_INCOMPLETE)) {
(gdb)
251 finfo->pool = thedir->pool;
(gdb)
252 finfo->valid = 0;
(gdb)
254 finfo->filetype = filetype_from_dirent_type(thedir->entry->DIRENT_TYPE);
(gdb)
255 finfo->valid |= APR_FINFO_TYPE;
(gdb) p finfo->filetype
$5 = APR_UNKFILE
(gdb) n
258 finfo->inode = thedir->entry->DIRENT_INODE;
(gdb)
259 finfo->valid |= APR_FINFO_INODE;
(gdb)
263 finfo->name = apr_pstrdup(thedir->pool, thedir->entry->d_name);
(gdb)
264 finfo->valid |= APR_FINFO_NAME;
(gdb)
266 if (wanted)
(gdb)
269 return APR_SUCCESS;
(gdb)

Subversion explicitly requests APR_FINFO_TYPE but then the
apr_dir_read code clears that bit and so doesn't call apr_lstat.
APR_UNKFILE appears to be correct for d_type of 0, but is not a very
useful thing for APR to return in response to APR_FINFO_TYPE. It's a
change in APR's behaviour and it breaks Subversion.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Dec 18 15:15:25 2002

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.