{"thread":{"id":"26028","subject":"SIGPIPE in t9300-fast-import","startedAt":"2010-12-12T20:49:03Z","lastAt":"2010-12-13T09:28:05Z","messageCount":6,"participants":["Brian Gernhardt","Jonathan Nieder","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"157896","messageId":"0BB1933F-1C3D-4C24-9C91-263121BF55FB@gernhardtsoftware.com","threadId":"26028","inReplyTo":null,"subject":"SIGPIPE in t9300-fast-import","fromName":"Brian Gernhardt","fromEmail":"brian@gernhardtsoftware.com","sentAt":"2010-12-12T20:49:03Z","receivedAt":"2010-12-12T20:49:03Z","isPatch":false,"sender":{"key":"brian@gernhardtsoftware.com","avatar":"https://avatars.githubusercontent.com/u/133455?v=4"},"body":"The new cat-blob test (9300.114) is failing for me on OS X, and has been since it's introduction in \"85c6239 fast-import: let importers retrieve blobs\":\n\n---- 8< ----\n\nok 113 - setup: have pipes?\n\nexpecting success: \n\texpect_id=$(git hash-object big) &&\n\texpect_len=$(wc -c <big) &&\n\techo $expect_id blob $expect_len >expect.response &&\n\n\trm -f blobs &&\n\tcat >frontend <<-\\FRONTEND_END &&\n\t#!/bin/sh\n\tcat <<EOF &&\n\tfeature cat-blob\n\tblob\n\tmark :1\n\tdata <<BLOB\n\tEOF\n\tcat big\n\tcat <<EOF\n\tBLOB\n\tcat-blob :1\n\tEOF\n\n\tread blob_id type size <&3 &&\n\techo \"$blob_id $type $size\" >response &&\n\tdd of=blob bs=$size count=1 <&3 &&\n\tread newline <&3 &&\n\n\tcat <<EOF &&\n\tcommit refs/heads/copied\n\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n\tdata <<COMMIT\n\tcopy big file as file3\n\tCOMMIT\n\tM 644 inline file3\n\tdata <<BLOB\n\tEOF\n\tcat blob &&\n\tcat <<EOF\n\tBLOB\n\tEOF\n\tFRONTEND_END\n\n\tmkfifo blobs &&\n\t(\n\t\texport GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&\n\t\tsh frontend 3<blobs |\n\t\tgit fast-import --cat-blob-fd=3 3>blobs\n\t) &&\n\tgit show copied:file3 >actual &&\n\ttest_cmp expect.response response &&\n\ttest_cmp big actual\n\n0+1 records in\n0+1 records out\n8139 bytes transferred in 0.000062 secs (131297847 bytes/sec)\nerror: git-fast-import died of signal 13\nnot ok - 114 R: copy using cat-file\n---- 8< ----\n\nI don't have the tuits right now to dig into this, but \"trash directory.t9300-fast-input\" has a good response (`cmp expect.response response` is true), but has no refs/heads/copied.  I can run help provide diagnostics, if anyone needs more data.\n\n~~ Brian\n\nPS:  Isn't t9300 getting a little crazily long?  Is there a good way to split it up by feature or something? It runs quickly, but finding were something is failing is getting a little difficult."},{"id":"157898","messageId":"20101212214909.GA19709@burratino","threadId":"26028","inReplyTo":"0BB1933F-1C3D-4C24-9C91-263121BF55FB@gernhardtsoftware.com","subject":"Re: SIGPIPE in t9300-fast-import","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-12-12T21:49:09Z","receivedAt":"2010-12-12T21:49:09Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brian Gernhardt wrote:\n\n> \tread blob_id type size <&3 &&\n> \techo \"$blob_id $type $size\" >response &&\n> \tdd of=blob bs=$size count=1 <&3 &&\n[...]\n> 0+1 records in\n> 0+1 records out\n> 8139 bytes transferred in 0.000062 secs (131297847 bytes/sec)\n> error: git-fast-import died of signal 13\n[...]\n> I can run help provide diagnostics, if anyone needs more data.\n\nHmm.  Any idea why dd is ending early?  Does using\n\n\thead -c \"$size\" >blob <&3 &&\n\nor\n\n\tdd of=blob bs=1 count=$size <&3 &&\n\nin its place work?  What does the Mac OS X equivalent of\n\n\tstrace dd of=blob bs=$size count=1 <&3\n\n(dtrace or ktrace, I guess) tell?\n\nThanks for noticing.\n"},{"id":"157899","messageId":"2F4185D2-5846-45CB-BC92-6BC07AE5CEC8@gernhardtsoftware.com","threadId":"26028","inReplyTo":"20101212214909.GA19709@burratino","subject":"Re: SIGPIPE in t9300-fast-import","fromName":"Brian Gernhardt","fromEmail":"brian@gernhardtsoftware.com","sentAt":"2010-12-12T22:04:06Z","receivedAt":"2010-12-12T22:04:06Z","isPatch":false,"sender":{"key":"brian@gernhardtsoftware.com","avatar":"https://avatars.githubusercontent.com/u/133455?v=4"},"body":"\nOn Dec 12, 2010, at 4:49 PM, Jonathan Nieder wrote:\n\n> Hmm.  Any idea why dd is ending early?\n\nNo idea.\n\n> Does using\n> \n> \thead -c \"$size\" >blob <&3 &&\n\nYes.\n\n> \tdd of=blob bs=1 count=$size <&3 &&\n> \n> in its place work?\n\nYes.\n\n> What does the Mac OS X equivalent of\n> \n> \tstrace dd of=blob bs=$size count=1 <&3\n> \n> (dtrace or ktrace, I guess) tell?\n\nThe moral equivalent seems to be \"dtruss\" (which I think is a front end to DTrace) in modern OS X.\n\n0+1 records in\n0+1 records out\n8139 bytes transferred in 0.000205 secs (39694698 bytes/sec)\nSYSCALL(args) \t\t = return\nioctl(0x6, 0x80086804, 0x7FFF5FBFD0A0)\t\t = 0 0\nclose(0x6)\t\t = 0 0\n__sysctl(0x7FFF5FBFCF90, 0x2, 0x7FFF5FBFCF80)\t\t = 0 0\nbsdthread_register(0x7FFF852F43DC, 0x7FFF852D4FF8, 0x2000)\t\t = 0 0\nthread_selfid(0x7FFF852F43DC, 0x7FFF852D4FF8, 0x0)\t\t = 1850088 0\nopen_nocancel(\"/dev/urandom\\0\", 0x0, 0x7FFF70ABABE0)\t\t = 6 0\nread_nocancel(0x6, \"\\350>6\\026\\310R\\251_\\227\\213h\\237\\304\\330&Q-\\247\\0313\\020BnH\\277\\337z\\276c\\247\\206\\017\\340/\\302} \\2644\\273\\003\\252`\\363d8\\252\\247)V2\\323\\021\\320\\\\\\214\\001\\331\\226\\020RY\\024I\\0\", 0x40)\t\t = 64 0\nclose_nocancel(0x6)\t\t = 0 0\nmmap(0x0, 0x3000, 0x3, 0x1002, 0x1000000, 0x7FFF00000001)\t\t = 0xD000 0\n__sysctl(0x7FFF5FBFCE10, 0x2, 0x7FFF5FBFCDD0)\t\t = 0 0\n__sysctl(0x7FFF5FBFCDD0, 0x2, 0x7FFF5FBFCE68)\t\t = 0 0\ngetpid(0x7FFF5FBFCD60, 0x7FFFFFE00050, 0x0)\t\t = 94596 0\nopen_nocancel(\"/dev/urandom\\0\", 0x0, 0x0)\t\t = 6 0\nread_nocancel(0x6, \"\\253\\331\\354\\357A)G\\3256\\222\\024=\\242E\\261\\301\\314\\351\\017K\\301;O\\256I\\270\\301\\312\\263M\\307\\340+U\\217\\242\\230\\335\\020\\275\\356T\\323\\334\\312\\313\\331*\\037\\273K\\332\\a\\247\\323\\324\\377m\\360\\204\\375c\\026i\\345\\017x\\2070n\\026\\266\\027\\021k\\340( \\245\\337\\3277H\\214\\0\", 0x6C)\t\t = 108 0\nclose_nocancel(0x6)\t\t = 0 0\n__sysctl(0x7FFF5FBFCE10, 0x2, 0x7FFF5FBFCE3C)\t\t = 0 0\nmmap(0x0, 0x17000, 0x3, 0x1002, 0x1000000, 0x7FFF00000001)\t\t = 0x10000 0\nmmap(0x0, 0x17000, 0x3, 0x1002, 0x1000000, 0x7FFF00000001)\t\t = 0x27000 0\nmmap(0x0, 0x1000, 0x3, 0x1002, 0x1000000, 0x7FFF00000001)\t\t = 0x3E000 0\nmmap(0x0, 0x200000, 0x3, 0x1002, 0x7000000, 0x7FFF00000001)\t\t = 0x3F000 0\nmunmap(0x10003F000, 0xC1000)\t\t = 0 0\nmunmap(0x100200000, 0x3F000)\t\t = 0 0\n__sysctl(0x7FFF5FBFCF70, 0x2, 0x7FFF5FBFCF30)\t\t = 0 0\n__sysctl(0x7FFF5FBFCF30, 0x2, 0x7FFF70AC7760)\t\t = 0 0\n__sysctl(0x7FFF5FBFCF70, 0x2, 0x7FFF5FBFCF30)\t\t = 0 0\n__sysctl(0x7FFF5FBFCF30, 0x2, 0x7FFF70AC7764)\t\t = 0 0\n__sysctl(0x7FFF5FBFCF70, 0x2, 0x7FFF5FBFCF30)\t\t = 0 0\n__sysctl(0x7FFF5FBFCF30, 0x2, 0x7FFF70AC7768)\t\t = 0 0\nmmap(0x0, 0x3000, 0x3, 0x1002, 0x1000000, 0x7FFF00000001)\t\t = 0x3F000 0\n__sysctl(0x7FFF5FBFCF40, 0x2, 0x7FFF5FBFCF00)\t\t = 0 0\n__sysctl(0x7FFF5FBFCF00, 0x2, 0x7FFF5FBFCF98)\t\t = 0 0\n__sysctl(0x7FFF5FBFCF40, 0x2, 0x7FFF5FBFCF6C)\t\t = 0 0\nmmap(0x0, 0x17000, 0x3, 0x1002, 0x1000000, 0x7FFF00000001)\t\t = 0x42000 0\nmmap(0x0, 0x17000, 0x3, 0x1002, 0x1000000, 0x7FFF00000001)\t\t = 0x59000 0\nmmap(0x0, 0x200000, 0x3, 0x1002, 0x7000000, 0x7FFF00000001)\t\t = 0x200000 0\nmunmap(0x100300000, 0x100000)\t\t = 0 0\nfstat64(0x0, 0x7FFF5FBFF320, 0x17FFF)\t\t = 0 0\nlseek(0x0, 0x0, 0x1)\t\t = -1 Err#29\nopen(\"blob\\0\", 0x602, 0x1B6)\t\t = 6 0\nfstat64(0x6, 0x7FFF5FBFF320, 0x0)\t\t = 0 0\nlseek(0x6, 0x0, 0x1)\t\t = 0 0\nmmap(0x0, 0x58000, 0x3, 0x1002, 0x3000000, 0x7FFF00000000)\t\t = 0x70000 0\nmmap(0x0, 0x1000, 0x3, 0x1002, 0x3000000, 0x7FFF00000000)\t\t = 0xC8000 0\nsigaction(0x1D, 0x7FFF5FBFF380, 0x7FFF5FBFF3B0)\t\t = 0 0\nsigaction(0x2, 0x7FFF5FBFF380, 0x7FFF5FBFF3B0)\t\t = 0 0\nread(0x0, \"the quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the l\", 0x2C000)\t\t = 8139 0\nwrite(0x6, \"the quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the l\", 0x1FCB)\t\t = 8139 0\nwrite(0x2, \"0+1 records in\\n0+1 records out\\n quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quic\", 0x1F)\t\t = 31 0\nwrite(0x2, \"8139 bytes transferred in 0.000205 secs (39694698 bytes/sec)\\nuick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quick brown fox jumps over the lazy dog\\nthe quick brown fox jump\", 0x3D)\t\t = 61 0\ngetpid(0x7FFF5FBFF250, 0x7FFFFFE00050, 0x0)\t\t = 94596 0\nopen_nocancel(\"/dev/urandom\\0\", 0x0, 0x0)\t\t = 6 0\nread_nocancel(0x6, \"\\232/\\226\\373ld\\353\\r+l\\236qV\\317\\370\\271.0\\353=\\316\\3464\\t\\263\\262r\\022\\362w\\360H\\245LdE\\3769\\254\\3309m\\246I\\361\\374\\307\\342]6\\n\\337\\303\\310\\333\\332\\036\\327\\313\\224(\\3443C\\327\\224\\225\\376\\221\\311-\\323\\272\\344\\275l\\034\\353LR<\\236\\t\\202\\250\\353\\202\\276AS\\363\\023@\\353\\331[\\037\\bC\\036)\\336\\363WZ\\003\\0\", 0x6C)\t\t = 108 0\nclose_nocancel(0x6)\t\t = 0 0\nissetugid(0x100000000, 0x7FFF5FBFF5B0, 0x7FFF5FC40530)\t\t = 0 0\ngeteuid(0x100000000, 0x7FFF5FBFF5B0, 0x0)\t\t = 0 0\n__sysctl(0x7FFF5FBFD140, 0x2, 0x7FFF5FBFD100)\t\t = 0 0\n__sysctl(0x7FFF5FBFD100, 0x2, 0x7FFF5FBFD19C)\t\t = 0 0\nshared_region_check_np(0x7FFF5FBFD308, 0x0, 0x7FFF5FC1DC86)\t\t = 0 0\nstat64(\"/usr/lib/dtrace/libdtrace_dyld.dylib\\0\", 0x7FFF5FBFC710, 0x7FFF5FBFCD50 = 0 0\nopen(\"/usr/lib/dtrace/libdtrace_dyld.dylib\\0\", 0x0, 0x0)\t\t = 6 0\npread(0x6, \"\\312\\376\\272\\276\\0\", 0x1000, 0x0)\t\t = 4096 0\npread(0x6, \"\\317\\372\\355\\376\\a\\0\", 0x1000, 0x1000)\t\t = 4096 0\nmmap(0x100008000, 0x2000, 0x5, 0x12, 0x6, 0x1FFFFFFFF)\t\t = 0x8000 0\nmmap(0x10000A000, 0x1000, 0x3, 0x12, 0x6, 0x1FFFFFFFF)\t\t = 0xA000 0\nmmap(0x10000B000, 0x1F10, 0x1, 0x12, 0x6, 0x1FFFFFFFF)\t\t = 0xB000 0\nclose(0x6)\t\t = 0 0\nstat64(\"/usr/lib/libSystem.B.dylib\\0\", 0x7FFF5FBFC4C0, 0x7FFF5FBFCB00)\t\t = 0 0\nstat64(\"/usr/lib/system/libmathCommon.A.dylib\\0\", 0x7FFF5FBFC370, 0x7FFF5FBFC9B0)\t\t = 0 0\nmadvise(0x7FFF89610000, 0x2000, 0x5)\t\t = 0 0\nopen(\"/dev/dtracehelper\\0\", 0x2, 0x7FFF5FC45258)\t\t = 6 0\nioctl(0x6, 0x80086804, 0x7FFF5FBFD0A0)\t\t = 0 0\nclose(0x6)\t\t = 0 0\nstat64(\"/usr/lib/libstdc++.6.dylib\\0\", 0x7FFF5FBFC4B0, 0x7FFF5FBFCAF0)\t\t = 0 0\nopen(\"/dev/dtracehelper\\0\", 0x2, 0x7FFF5FC45320)\t\t = 6 0\n\nerror: git-fast-import died of signal 13\n---- 8< ----\n\nblob does exist, it just seems to end early:\n\n--- big 2010-12-12 16:56:32.000000000 -0500\n+++ blob        2010-12-12 16:56:33.000000000 -0500\n@@ -182,3915 +182,4 @@\n\nFollowed by many lines of:\n\n-the quick brown fox jumps over the lazy dog\n\nand then:\n\n+the quick brown fox jumps over the lazy dog\n\\ No newline at end of file\n\n> Thanks for noticing.\n\nI tend to update to latest next, compile, and test about once a day so exactly so I can catch things.  :-D\n\n~~ Brian"},{"id":"157924","messageId":"20101213063151.GB20812@burratino","threadId":"26028","inReplyTo":"2F4185D2-5846-45CB-BC92-6BC07AE5CEC8@gernhardtsoftware.com","subject":"[PATCH jn/fast-import-blob-access] t9300: avoid short reads from dd","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-12-13T06:31:51Z","receivedAt":"2010-12-13T06:31:51Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"dd is a thin wrapper around read(2).  As open group Issue 7 explains:\n\n\tIt shall read the input one block at a time, using the specified\n\tinput block size; it shall then process the block of data\n\tactually returned, which could be smaller than the requested\n\tblock size.\n\nAny short read --- for example from a pipe whose capacity cannot fill\na block --- results in that block being truncated.  As a result, the\nfirst cat-blob test (9300.114) fails on Mac OS X, where the pipe\ncapacity is around 8 KiB.\n\nFix the test by using a block size of 1.  Each read will block until\nthe next byte of input is available.\n\nIt would be even nicer to use head -c which expresses the intention\nmore clearly.  Alas, IRIX \"head\" does not support the -c option.\n\nReported-by: Brian Gernhardt <brian@gernhardtsoftware.com>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t9300-fast-import.sh |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex 055ddc6..ed28d3c 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -1794,7 +1794,7 @@ test_expect_success PIPE 'R: copy using cat-file' '\n \n \tread blob_id type size <&3 &&\n \techo \"$blob_id $type $size\" >response &&\n-\tdd of=blob bs=$size count=1 <&3 &&\n+\tdd of=blob bs=1 count=$size <&3 &&\n \tread newline <&3 &&\n \n \tcat <<EOF &&\n@@ -1845,7 +1845,7 @@ test_expect_success PIPE 'R: print blob mid-commit' '\n \t\tEOF\n \n \t\tread blob_id type size <&3 &&\n-\t\tdd of=actual bs=$size count=1 <&3 &&\n+\t\tdd of=actual bs=1 count=$size <&3 &&\n \t\tread newline <&3 &&\n \n \t\techo\n@@ -1880,7 +1880,7 @@ test_expect_success PIPE 'R: print staged blob within commit' '\n \t\techo \"cat-blob $to_get\" &&\n \n \t\tread blob_id type size <&3 &&\n-\t\tdd of=actual bs=$size count=1 <&3 &&\n+\t\tdd of=actual bs=1 count=$size <&3 &&\n \t\tread newline <&3 &&\n \n \t\techo deleteall\n-- \n1.7.2.4\n"},{"id":"157926","messageId":"7vfwu25e9q.fsf@alter.siamese.dyndns.org","threadId":"26028","inReplyTo":"20101213063151.GB20812@burratino","subject":"Re: [PATCH jn/fast-import-blob-access] t9300: avoid short reads from dd","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-12-13T07:21:37Z","receivedAt":"2010-12-13T07:21:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> dd is a thin wrapper around read(2).  As open group Issue 7 explains:\n>\n> \tIt shall read the input one block at a time, using the specified\n> \tinput block size; it shall then process the block of data\n> \tactually returned, which could be smaller than the requested\n> \tblock size.\n>\n> Any short read --- for example from a pipe whose capacity cannot fill\n> a block --- results in that block being truncated.  As a result, the\n> first cat-blob test (9300.114) fails on Mac OS X, where the pipe\n> capacity is around 8 KiB.\n\nI saw a similar breakage on my FBSD 8 bochs.  It is unfortunate and feels\nyucky that we have to issue 8k+ read(2) of one byte, but I don't think of\na better way.  I thought it might be possible to specify cbs and/or conv\nto have the input buffered to a size to defeat the short read issue, but\ncount specifies in terms of input blocks, so there doesn't seem to be a\nway to do so...  Oh well...\n\nThanks.\n"},{"id":"157934","messageId":"20101213092805.GB23443@burratino","threadId":"26028","inReplyTo":"7vfwu25e9q.fsf@alter.siamese.dyndns.org","subject":"[PATCH jn/fast-import-blob-access] t9300: use perl \"head -c\" clone in place of \"dd bs=1 count=16000\" kluge","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-12-13T09:28:05Z","receivedAt":"2010-12-13T09:28:05Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"It is unfortunate to have to issue thousands of one-byte read calls to\nwork around dd's refusal to buffer input that would fill a block after\na short read (a3a6f4, 2010-12-13).  We could do better by using\n\"head -c\", if it were available on all platforms we cared about.\nReplace it with some simple perl.\n\nWhile doing so, restructure 9300.114 to use a subshell instead of a\nscript.  Subshells can inherit functions (like the new head_c) from\nthe parent shell while external scripts cannot.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nJunio C Hamano wrote:\n\n> It is unfortunate and feels\n> yucky that we have to issue 8k+ read(2) of one byte\n\nHow about this?\n\n t/t9300-fast-import.sh |   84 ++++++++++++++++++++++++++++--------------------\n 1 files changed, 49 insertions(+), 35 deletions(-)\n\ndiff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh\nindex ed28d3c..924a833 100755\n--- a/t/t9300-fast-import.sh\n+++ b/t/t9300-fast-import.sh\n@@ -7,6 +7,23 @@ test_description='test git fast-import utility'\n . ./test-lib.sh\n . \"$TEST_DIRECTORY\"/diff-lib.sh ;# test-lib chdir's into trash\n \n+# Print $1 bytes from stdin to stdout.\n+#\n+# This could be written as \"head -c $1\", but IRIX \"head\" does not\n+# support the -c option.\n+head_c () {\n+\tperl -e '\n+\t\tmy $len = $ARGV[1];\n+\t\twhile ($len > 0) {\n+\t\t\tmy $s;\n+\t\t\tmy $nread = sysread(STDIN, $s, $len);\n+\t\t\tdie \"cannot read: $!\" unless defined($nread);\n+\t\t\tprint $s;\n+\t\t\t$len -= $nread;\n+\t\t}\n+\t' - \"$1\"\n+}\n+\n file2_data='file2\n second line of EOF'\n \n@@ -1780,44 +1797,41 @@ test_expect_success PIPE 'R: copy using cat-file' '\n \trm -f blobs &&\n \tcat >frontend <<-\\FRONTEND_END &&\n \t#!/bin/sh\n-\tcat <<EOF &&\n-\tfeature cat-blob\n-\tblob\n-\tmark :1\n-\tdata <<BLOB\n-\tEOF\n-\tcat big\n-\tcat <<EOF\n-\tBLOB\n-\tcat-blob :1\n-\tEOF\n-\n-\tread blob_id type size <&3 &&\n-\techo \"$blob_id $type $size\" >response &&\n-\tdd of=blob bs=1 count=$size <&3 &&\n-\tread newline <&3 &&\n-\n-\tcat <<EOF &&\n-\tcommit refs/heads/copied\n-\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n-\tdata <<COMMIT\n-\tcopy big file as file3\n-\tCOMMIT\n-\tM 644 inline file3\n-\tdata <<BLOB\n-\tEOF\n-\tcat blob &&\n-\tcat <<EOF\n-\tBLOB\n-\tEOF\n \tFRONTEND_END\n \n \tmkfifo blobs &&\n \t(\n \t\texport GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&\n-\t\tsh frontend 3<blobs |\n-\t\tgit fast-import --cat-blob-fd=3 3>blobs\n-\t) &&\n+\t\tcat <<-\\EOF &&\n+\t\tfeature cat-blob\n+\t\tblob\n+\t\tmark :1\n+\t\tdata <<BLOB\n+\t\tEOF\n+\t\tcat big &&\n+\t\tcat <<-\\EOF &&\n+\t\tBLOB\n+\t\tcat-blob :1\n+\t\tEOF\n+\n+\t\tread blob_id type size <&3 &&\n+\t\techo \"$blob_id $type $size\" >response &&\n+\t\thead_c $size >blob <&3 &&\n+\t\tread newline <&3 &&\n+\n+\t\tcat <<-EOF &&\n+\t\tcommit refs/heads/copied\n+\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n+\t\tdata <<COMMIT\n+\t\tcopy big file as file3\n+\t\tCOMMIT\n+\t\tM 644 inline file3\n+\t\tdata <<BLOB\n+\t\tEOF\n+\t\tcat blob &&\n+\t\techo BLOB\n+\t) 3<blobs |\n+\tgit fast-import --cat-blob-fd=3 3>blobs &&\n \tgit show copied:file3 >actual &&\n \ttest_cmp expect.response response &&\n \ttest_cmp big actual\n@@ -1845,7 +1859,7 @@ test_expect_success PIPE 'R: print blob mid-commit' '\n \t\tEOF\n \n \t\tread blob_id type size <&3 &&\n-\t\tdd of=actual bs=1 count=$size <&3 &&\n+\t\thead_c $size >actual <&3 &&\n \t\tread newline <&3 &&\n \n \t\techo\n@@ -1880,7 +1894,7 @@ test_expect_success PIPE 'R: print staged blob within commit' '\n \t\techo \"cat-blob $to_get\" &&\n \n \t\tread blob_id type size <&3 &&\n-\t\tdd of=actual bs=1 count=$size <&3 &&\n+\t\thead_c $size >actual <&3 &&\n \t\tread newline <&3 &&\n \n \t\techo deleteall\n-- \n1.7.2.4.568.g3733c.dirty\n"}]}