[PATCH 1 of 4] tests: make 'f' tool open files in binary mode when hexdumping

Matt Mackall mpm at selenic.com
Mon Nov 23 14:50:37 CST 2015


On Thu, 2015-11-12 at 22:33 -0800, Gregory Szorc wrote:
> On Thu, Nov 12, 2015 at 8:01 PM, Matt Harbison <mharbison72 at gmail.com
> >
> wrote:
> 
> > On Thu, 12 Nov 2015 22:24:57 -0500, Matt Mackall <mpm at selenic.com>
> > wrote:
> > 
> > On Mon, 2015-11-09 at 16:30 -0600, Matt Harbison wrote:
> > > 
> > > > # HG changeset patch
> > > > # User Matt Harbison <matt_harbison at yahoo.com>
> > > > # Date 1447091371 18000
> > > > #      Mon Nov 09 12:49:31 2015 -0500
> > > > # Node ID 0b2b461f75b2c73adeb0728ed081c0222fc4f52e
> > > > # Parent  f9984f76fd90e439221425d751e29bae17bec995
> > > > tests: make 'f' tool open files in binary mode when hexdumping
> > > > 
> > > 
> > > Queued for default, thanks. We need a checkcode rule for this.
> > > 
> > 
> > That's probably beyond my regex capabilities if anyone else wants
> > to
> > attempt it.  Wondering how many different ways there are to open a
> > file got
> > me poking around in vfs, and it looks like abstractvfs.open() (and
> > __call__) uses 'r' as its default mode.  I assume this is a
> > (potential)
> > problem?  Likely all of the current callers are providing an
> > explicit mode.
> 
> 
> I think 'r' as the default is a bit worrisome.

Indeed. We should treat any bare "r" as unaudited. From a glance at
cpython source, it looks like "rt" should be a good way to document an
intent to use text, but if not, check-code could require ("r").

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list