Patchwork osutil: fix the bug on OS X when we return more in listdir

login
register
mail settings
Submitter Maciej Fijalkowski
Date Aug. 20, 2016, 9:06 p.m.
Message ID <17bb55a4276ea6d85e10.1471727178@brick.arcode.com>
Download mbox | patch
Permalink /patch/16365/
State Accepted
Headers show

Comments

Maciej Fijalkowski - Aug. 20, 2016, 9:06 p.m.
# HG changeset patch
# User Maciej Fijalkowski <fijall@gmail.com>
# Date 1471727118 -7200
#      Sat Aug 20 23:05:18 2016 +0200
# Node ID 17bb55a4276ea6d85e10c128fa2b83c7e170e9de
# Parent  21b2401d468d6b24c1658468e4fc5ce8744f925b
osutil: fix the bug on OS X when we return more in listdir

The pointer arithmetic somehow got ommitted during the recent change to use
a struct.
Pierre-Yves David - Aug. 22, 2016, 12:31 p.m.
On 08/20/2016 11:06 PM, Maciej Fijalkowski wrote:
> # HG changeset patch
> # User Maciej Fijalkowski <fijall@gmail.com>
> # Date 1471727118 -7200
> #      Sat Aug 20 23:05:18 2016 +0200
> # Node ID 17bb55a4276ea6d85e10c128fa2b83c7e170e9de
> # Parent  21b2401d468d6b24c1658468e4fc5ce8744f925b
> osutil: fix the bug on OS X when we return more in listdir

Pushed, thanks.

Patch

diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py
--- a/mercurial/pure/osutil.py
+++ b/mercurial/pure/osutil.py
@@ -120,13 +120,14 @@ 
                 if skip == name and tp == statmod.S_ISDIR:
                     return []
                 if stat:
-                    mtime = cur.time.tv_sec
+                    mtime = cur.mtime.tv_sec
                     mode = (cur.accessmask & ~lib.S_IFMT)| tp
                     ret.append((name, tp, stat_res(st_mode=mode, st_mtime=mtime,
                                 st_size=cur.datalength)))
                 else:
                     ret.append((name, tp))
-                cur += lgt
+                cur = ffi.cast("val_attrs_t*", int(ffi.cast("intptr_t", cur))
+                    + lgt)
         return ret
 
     def listdir(path, stat=False, skip=None):