Patchwork [2,of,2,already-pushed] lfs: generate a large file by using `python` instead of yes | head

login
register
mail settings
Submitter Augie Fackler
Date Nov. 20, 2017, 11:15 p.m.
Message ID <f6f8b7c8919a5aa1f711.1511219718@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/25680/
State Accepted
Headers show

Comments

Augie Fackler - Nov. 20, 2017, 11:15 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1511219115 18000
#      Mon Nov 20 18:05:15 2017 -0500
# Node ID f6f8b7c8919a5aa1f711e3463f7dd9afa6b734c5
# Parent  7ea56f5700b8175b13d3960434fd5f8cd04306c3
lfs: generate a large file by using `python` instead of yes | head

yes(1) on some systems (like gcc112) feels compelled to inform you of
broken pipes, such as those triggered by head(1). This works around
the problem portably.
Augie Fackler - Nov. 20, 2017, 11:16 p.m.
These two patches were needed to fix up the lfs patches and make them pass. Rather than incurring an extra roundtrip for Matt or having us sit with broken CI, I took the liberty of just pushing them (folding the first one seems a little confusing, and I like keeping this one split out for documentation on the brokenness of some yes(1)s.)

> On Nov 20, 2017, at 18:15, Augie Fackler <raf@durin42.com> wrote:
> 
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1511219115 18000
> #      Mon Nov 20 18:05:15 2017 -0500
> # Node ID f6f8b7c8919a5aa1f711e3463f7dd9afa6b734c5
> # Parent  7ea56f5700b8175b13d3960434fd5f8cd04306c3
> lfs: generate a large file by using `python` instead of yes | head
> 
> yes(1) on some systems (like gcc112) feels compelled to inform you of
> broken pipes, such as those triggered by head(1). This works around
> the problem portably.
> 
> diff --git a/tests/test-lfs-largefiles.t b/tests/test-lfs-largefiles.t
> --- a/tests/test-lfs-largefiles.t
> +++ b/tests/test-lfs-largefiles.t
> @@ -199,7 +199,7 @@ largefiles since it hooks cmdutil.add() 
> commit.  By the time the commit occurs, the tracked file is smaller than the
> threshold (assuming it is > 41, so the standins don't become lfs objects).
> 
> -  $ yes | head -n 1048576 > large_by_size.bin
> +  $ $PYTHON -c 'import sys ; sys.stdout.write("y\n" * 1048576)' > large_by_size.bin
>   $ hg --config largefiles.minsize=1 ci -Am 'large by size'
>   adding large_by_size.bin as a largefile
>   $ hg manifest
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/tests/test-lfs-largefiles.t b/tests/test-lfs-largefiles.t
--- a/tests/test-lfs-largefiles.t
+++ b/tests/test-lfs-largefiles.t
@@ -199,7 +199,7 @@  largefiles since it hooks cmdutil.add() 
 commit.  By the time the commit occurs, the tracked file is smaller than the
 threshold (assuming it is > 41, so the standins don't become lfs objects).
 
-  $ yes | head -n 1048576 > large_by_size.bin
+  $ $PYTHON -c 'import sys ; sys.stdout.write("y\n" * 1048576)' > large_by_size.bin
   $ hg --config largefiles.minsize=1 ci -Am 'large by size'
   adding large_by_size.bin as a largefile
   $ hg manifest