{"thread":{"id":"59131","subject":"[PATCH v1 1/1] t0003: Call dd with portable blocksize","startedAt":"2023-01-21T11:05:18Z","lastAt":"2023-01-22T18:00:51Z","messageCount":5,"participants":["tboegi@web.de","Junio C Hamano","Torsten Bögershausen"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"470838","messageId":"20230121110505.21362-1-tboegi@web.de","threadId":"59131","inReplyTo":null,"subject":"[PATCH v1 1/1] t0003: Call dd with portable blocksize","fromName":"","fromEmail":"tboegi@web.de","sentAt":"2023-01-21T11:05:05Z","receivedAt":"2023-01-21T11:05:18Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"From: Torsten Bögershausen <tboegi@web.de>\n\nThe command `dd -bs=101M count=1` is not portable.\nUse `bs=1048576 count=101`, which does the same, instead.\n\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\n t/t0003-attributes.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh\nindex d0284fe2d7..394a08e6d6 100755\n--- a/t/t0003-attributes.sh\n+++ b/t/t0003-attributes.sh\n@@ -400,7 +400,7 @@ test_expect_success 'large attributes line ignores trailing content in tree' '\n\n test_expect_success EXPENSIVE 'large attributes file ignored in tree' '\n \ttest_when_finished \"rm .gitattributes\" &&\n-\tdd if=/dev/zero of=.gitattributes bs=101M count=1 2>/dev/null &&\n+\tdd if=/dev/zero of=.gitattributes bs=1048576 count=101 2>/dev/null &&\n \tgit check-attr --all path >/dev/null 2>err &&\n \techo \"warning: ignoring overly large gitattributes file ${SQ}.gitattributes${SQ}\" >expect &&\n \ttest_cmp expect err\n@@ -428,7 +428,7 @@ test_expect_success 'large attributes line ignores trailing content in index' '\n\n test_expect_success EXPENSIVE 'large attributes file ignored in index' '\n \ttest_when_finished \"git update-index --remove .gitattributes\" &&\n-\tblob=$(dd if=/dev/zero bs=101M count=1 2>/dev/null | git hash-object -w --stdin) &&\n+\tblob=$(dd if=/dev/zero bs=1048576 count=101 2>/dev/null | git hash-object -w --stdin) &&\n \tgit update-index --add --cacheinfo 100644,$blob,.gitattributes &&\n \tgit check-attr --cached --all path >/dev/null 2>err &&\n \techo \"warning: ignoring overly large gitattributes blob ${SQ}.gitattributes${SQ}\" >expect &&\n--\n2.39.1.254.g904d404274\n\n"},{"id":"470850","messageId":"xmqq8rhvwhv6.fsf@gitster.g","threadId":"59131","inReplyTo":"20230121110505.21362-1-tboegi@web.de","subject":"Re: [PATCH v1 1/1] t0003: Call dd with portable blocksize","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-01-22T00:08:45Z","receivedAt":"2023-01-22T00:08:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"tboegi@web.de writes:\n\n> From: Torsten Bögershausen <tboegi@web.de>\n>\n> The command `dd -bs=101M count=1` is not portable.\n\nNo need for '-'; the UI of dd was meant as a joke and deliberately\ndeviates from UNIX norm to use '-' as an option introducer.\n\n> Use `bs=1048576 count=101`, which does the same, instead.\n\nThanks for catching this.  It always is hard to catch these mistakes\nmade in code that was cooked behind embargo, as there aren't many\neyeballs on the changes.\n\nStrictly speaking, \"bs=1048576 count=101\" does not do the same thing\n(unlike the original that does a single write(2)system call of a\nhuge buffer, it issues 101 smaller write(2)).\n\nIt definitely is an improvement, independently from the portability\nissues, to rewrite it like you did.  Unnecessarily large an I/O\nshould be avoided.\n\nWill queue.  Thanks.\n\n> Signed-off-by: Torsten Bögershausen <tboegi@web.de>\n> ---\n>  t/t0003-attributes.sh | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh\n> index d0284fe2d7..394a08e6d6 100755\n> --- a/t/t0003-attributes.sh\n> +++ b/t/t0003-attributes.sh\n> @@ -400,7 +400,7 @@ test_expect_success 'large attributes line ignores trailing content in tree' '\n>\n>  test_expect_success EXPENSIVE 'large attributes file ignored in tree' '\n>  \ttest_when_finished \"rm .gitattributes\" &&\n> -\tdd if=/dev/zero of=.gitattributes bs=101M count=1 2>/dev/null &&\n> +\tdd if=/dev/zero of=.gitattributes bs=1048576 count=101 2>/dev/null &&\n>  \tgit check-attr --all path >/dev/null 2>err &&\n>  \techo \"warning: ignoring overly large gitattributes file ${SQ}.gitattributes${SQ}\" >expect &&\n>  \ttest_cmp expect err\n> @@ -428,7 +428,7 @@ test_expect_success 'large attributes line ignores trailing content in index' '\n>\n>  test_expect_success EXPENSIVE 'large attributes file ignored in index' '\n>  \ttest_when_finished \"git update-index --remove .gitattributes\" &&\n> -\tblob=$(dd if=/dev/zero bs=101M count=1 2>/dev/null | git hash-object -w --stdin) &&\n> +\tblob=$(dd if=/dev/zero bs=1048576 count=101 2>/dev/null | git hash-object -w --stdin) &&\n>  \tgit update-index --add --cacheinfo 100644,$blob,.gitattributes &&\n>  \tgit check-attr --cached --all path >/dev/null 2>err &&\n>  \techo \"warning: ignoring overly large gitattributes blob ${SQ}.gitattributes${SQ}\" >expect &&\n> --\n> 2.39.1.254.g904d404274\n"},{"id":"470870","messageId":"20230122062839.14542-1-tboegi@web.de","threadId":"59131","inReplyTo":"20230121110505.21362-1-tboegi@web.de","subject":"[PATCH v2 1/1] t0003: Call dd with portable blocksize","fromName":"","fromEmail":"tboegi@web.de","sentAt":"2023-01-22T06:28:39Z","receivedAt":"2023-01-22T06:33:51Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"From: Torsten Bögershausen <tboegi@web.de>\n\nThe command `dd bs=101M count=1` is not portable,\ne.g. dd shipped with MacOs does not understand the 'M'.\n\nUse `bs=1048576 count=101`, which achives the same, instead.\n\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\n t/t0003-attributes.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh\nindex d0284fe2d7..394a08e6d6 100755\n--- a/t/t0003-attributes.sh\n+++ b/t/t0003-attributes.sh\n@@ -400,7 +400,7 @@ test_expect_success 'large attributes line ignores trailing content in tree' '\n\n test_expect_success EXPENSIVE 'large attributes file ignored in tree' '\n \ttest_when_finished \"rm .gitattributes\" &&\n-\tdd if=/dev/zero of=.gitattributes bs=101M count=1 2>/dev/null &&\n+\tdd if=/dev/zero of=.gitattributes bs=1048576 count=101 2>/dev/null &&\n \tgit check-attr --all path >/dev/null 2>err &&\n \techo \"warning: ignoring overly large gitattributes file ${SQ}.gitattributes${SQ}\" >expect &&\n \ttest_cmp expect err\n@@ -428,7 +428,7 @@ test_expect_success 'large attributes line ignores trailing content in index' '\n\n test_expect_success EXPENSIVE 'large attributes file ignored in index' '\n \ttest_when_finished \"git update-index --remove .gitattributes\" &&\n-\tblob=$(dd if=/dev/zero bs=101M count=1 2>/dev/null | git hash-object -w --stdin) &&\n+\tblob=$(dd if=/dev/zero bs=1048576 count=101 2>/dev/null | git hash-object -w --stdin) &&\n \tgit update-index --add --cacheinfo 100644,$blob,.gitattributes &&\n \tgit check-attr --cached --all path >/dev/null 2>err &&\n \techo \"warning: ignoring overly large gitattributes blob ${SQ}.gitattributes${SQ}\" >expect &&\n--\n2.39.1.254.g904d404274\n\n"},{"id":"470882","messageId":"xmqqtu0isfom.fsf@gitster.g","threadId":"59131","inReplyTo":"20230122062839.14542-1-tboegi@web.de","subject":"Re: [PATCH v2 1/1] t0003: Call dd with portable blocksize","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-01-22T16:21:45Z","receivedAt":"2023-01-22T16:21:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"tboegi@web.de writes:\n\n> From: Torsten Bögershausen <tboegi@web.de>\n>\n> The command `dd bs=101M count=1` is not portable,\n> e.g. dd shipped with MacOs does not understand the 'M'.\n\nVery good piece of information to have here.\n\n> Use `bs=1048576 count=101`, which achives the same, instead.\n\nI'd locally tweak (read: no need to resend) it to\n\n    Use `dd bs=1048576 count=101`, which ...\n\nand downcase \"Call\" on the title line.\n\nA tangent.  I wonder how portable \n\n    dd bs=1024x1024 count=101\n    dd bs=1kx1k count=101\n\nare in practice.  \"Two or more positive decimal numbers (with or\nwithout 'k' or 'b') separated by 'x', specifying the product of the\nindicated values\" is from POSIX, but I haven't used it myself (I\nknow GNU dd groks it).\n\nIn any case, thanks for the update.\n"},{"id":"470888","messageId":"20230122180043.jfexuzsdiwqraqma@tb-raspi4","threadId":"59131","inReplyTo":"xmqqtu0isfom.fsf@gitster.g","subject":"Re: [PATCH v2 1/1] t0003: Call dd with portable blocksize","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2023-01-22T18:00:43Z","receivedAt":"2023-01-22T18:00:51Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On Sun, Jan 22, 2023 at 08:21:45AM -0800, Junio C Hamano wrote:\n> tboegi@web.de writes:\n>\n> > From: Torsten Bögershausen <tboegi@web.de>\n> >\n> > The command `dd bs=101M count=1` is not portable,\n> > e.g. dd shipped with MacOs does not understand the 'M'.\n>\n> Very good piece of information to have here.\n>\n> > Use `bs=1048576 count=101`, which achives the same, instead.\n>\n> I'd locally tweak (read: no need to resend) it to\n>\n>     Use `dd bs=1048576 count=101`, which ...\n>\n> and downcase \"Call\" on the title line.\n>\n> A tangent.  I wonder how portable\n>\n>     dd bs=1024x1024 count=101\nThis works all Unix-ish system I have: both on MacOs and FreeBSD.\n\n>     dd bs=1kx1k count=101\nWorks on FreeBSD.\nDoes not work under MacOS: \"dd: bs: illegal numeric value\"\n\n\n> In any case, thanks for the update.\n\nThanks for the review and the tweaking.\n"}]}