{"thread":{"id":"35220","subject":"[PATCH] Change sed i\\ usage to something Solaris' sed can handle","startedAt":"2013-10-27T21:26:48Z","lastAt":"2013-11-03T13:08:29Z","messageCount":6,"participants":["Ben Walton","Andreas Schwab","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"229622","messageId":"1382909208-7716-1-git-send-email-bdwalton@gmail.com","threadId":"35220","inReplyTo":null,"subject":"[PATCH] Change sed i\\ usage to something Solaris' sed can handle","fromName":"Ben Walton","fromEmail":"bdwalton@gmail.com","sentAt":"2013-10-27T21:26:48Z","receivedAt":"2013-10-27T21:26:48Z","isPatch":true,"sender":{"key":"bdwalton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/396061?v=4"},"body":"Solaris' sed was choking on the i\\ commands used in\nt4015-diff-whitespace as it couldn't parse the program properly.\nModify two uses of sed that worked in GNU sed but not Solaris'\n(/usr/bin or /usr/xpg4/bin) to an equivalent form that is handled\nproperly by both.\n\nSigned-off-by: Ben Walton <bdwalton@gmail.com>\n---\n t/t4015-diff-whitespace.sh | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh\nindex 3fb4b97..0126154 100755\n--- a/t/t4015-diff-whitespace.sh\n+++ b/t/t4015-diff-whitespace.sh\n@@ -145,7 +145,8 @@ test_expect_success 'another test, with --ignore-space-at-eol' 'test_cmp expect\n test_expect_success 'ignore-blank-lines: only new lines' '\n \ttest_seq 5 >x &&\n \tgit update-index x &&\n-\ttest_seq 5 | sed \"/3/i \\\\\n+\ttest_seq 5 | sed \"/3/i\\\\\n+\\\n \" >x &&\n \tgit diff --ignore-blank-lines >out &&\n \t>expect &&\n@@ -155,7 +156,8 @@ test_expect_success 'ignore-blank-lines: only new lines' '\n test_expect_success 'ignore-blank-lines: only new lines with space' '\n \ttest_seq 5 >x &&\n \tgit update-index x &&\n-\ttest_seq 5 | sed \"/3/i \\ \" >x &&\n+\ttest_seq 5 | sed \"/3/i\\\\\n+ \" >x &&\n \tgit diff -w --ignore-blank-lines >out &&\n \t>expect &&\n \ttest_cmp out expect\n-- \n1.8.1.2\n"},{"id":"229653","messageId":"877gcx1eho.fsf@igel.home","threadId":"35220","inReplyTo":"1382909208-7716-1-git-send-email-bdwalton@gmail.com","subject":"Re: [PATCH] Change sed i\\ usage to something Solaris' sed can handle","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2013-10-28T17:39:47Z","receivedAt":"2013-10-28T17:39:47Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Ben Walton <bdwalton@gmail.com> writes:\n\n> diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh\n> index 3fb4b97..0126154 100755\n> --- a/t/t4015-diff-whitespace.sh\n> +++ b/t/t4015-diff-whitespace.sh\n> @@ -145,7 +145,8 @@ test_expect_success 'another test, with --ignore-space-at-eol' 'test_cmp expect\n>  test_expect_success 'ignore-blank-lines: only new lines' '\n>  \ttest_seq 5 >x &&\n>  \tgit update-index x &&\n> -\ttest_seq 5 | sed \"/3/i \\\\\n> +\ttest_seq 5 | sed \"/3/i\\\\\n> +\\\n>  \" >x &&\n\nWhy do you need the \\<nl>?  Since it is inside double quotes the shell\nwill remove it during expansion.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"229671","messageId":"CAP30j15+E4cz_kwJwaSH7-3agwC5J3jGNfaixSUg2=8xAzZoQg@mail.gmail.com","threadId":"35220","inReplyTo":"877gcx1eho.fsf@igel.home","subject":"Re: [PATCH] Change sed i\\ usage to something Solaris' sed can handle","fromName":"Ben Walton","fromEmail":"bdwalton@gmail.com","sentAt":"2013-10-28T21:10:46Z","receivedAt":"2013-10-28T21:10:46Z","isPatch":true,"sender":{"key":"bdwalton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/396061?v=4"},"body":"On Mon, Oct 28, 2013 at 5:39 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:\n> Ben Walton <bdwalton@gmail.com> writes:\n>\n>> diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh\n>> index 3fb4b97..0126154 100755\n>> --- a/t/t4015-diff-whitespace.sh\n>> +++ b/t/t4015-diff-whitespace.sh\n>> @@ -145,7 +145,8 @@ test_expect_success 'another test, with --ignore-space-at-eol' 'test_cmp expect\n>>  test_expect_success 'ignore-blank-lines: only new lines' '\n>>       test_seq 5 >x &&\n>>       git update-index x &&\n>> -     test_seq 5 | sed \"/3/i \\\\\n>> +     test_seq 5 | sed \"/3/i\\\\\n>> +\\\n>>  \" >x &&\n>\n> Why do you need the \\<nl>?  Since it is inside double quotes the shell\n> will remove it during expansion.\n\nIt's an escape. Without it, sed throws:\n\nsed: -e expression #1, char 5: expected \\ after `a', `c' or `i'\n\nThanks\n-Ben\n-- \n---------------------------------------------------------------------------------------------------------------------------\nTake the risk of thinking for yourself.  Much more happiness,\ntruth, beauty and wisdom will come to you that way.\n\n-Christopher Hitchens\n---------------------------------------------------------------------------------------------------------------------------\n"},{"id":"229679","messageId":"87y55dys2o.fsf@igel.home","threadId":"35220","inReplyTo":"CAP30j15+E4cz_kwJwaSH7-3agwC5J3jGNfaixSUg2=8xAzZoQg@mail.gmail.com","subject":"Re: [PATCH] Change sed i\\ usage to something Solaris' sed can handle","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2013-10-28T21:59:59Z","receivedAt":"2013-10-28T21:59:59Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Ben Walton <bdwalton@gmail.com> writes:\n\n> It's an escape. Without it, sed throws:\n\nThe shell removes it before sed can see it.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"229854","messageId":"xmqqeh72blpt.fsf@gitster.dls.corp.google.com","threadId":"35220","inReplyTo":"CAP30j15+E4cz_kwJwaSH7-3agwC5J3jGNfaixSUg2=8xAzZoQg@mail.gmail.com","subject":"Re: [PATCH] Change sed i\\ usage to something Solaris' sed can handle","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-10-30T19:30:22Z","receivedAt":"2013-10-30T19:30:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ben Walton <bdwalton@gmail.com> writes:\n\n> On Mon, Oct 28, 2013 at 5:39 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:\n>> Ben Walton <bdwalton@gmail.com> writes:\n>>\n>>> diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh\n>>> index 3fb4b97..0126154 100755\n>>> --- a/t/t4015-diff-whitespace.sh\n>>> +++ b/t/t4015-diff-whitespace.sh\n>>> @@ -145,7 +145,8 @@ test_expect_success 'another test, with --ignore-space-at-eol' 'test_cmp expect\n>>>  test_expect_success 'ignore-blank-lines: only new lines' '\n>>>       test_seq 5 >x &&\n>>>       git update-index x &&\n>>> -     test_seq 5 | sed \"/3/i \\\\\n>>> +     test_seq 5 | sed \"/3/i\\\\\n>>> +\\\n>>>  \" >x &&\n>>\n>> Why do you need the \\<nl>?  Since it is inside double quotes the shell\n>> will remove it during expansion.\n>\n> It's an escape. Without it, sed throws:\n>\n> sed: -e expression #1, char 5: expected \\ after `a', `c' or `i'\n\nI think Andreas means the \"feed blank line\" part, i.e.\n\n>> +     test_seq 5 | sed \"/3/i\\\\\n>> +\\\n>>  \" >x &&\n\nshould be the same as\n\n>> +     test_seq 5 | sed \"/3/i\\\\\n>>  \" >x &&\n\nbecause the lone \\<nl> will be eaten and will not be seen by sed.\n\nDo you see different results on Solaris between the following two?\n\n\t$ echo \"/3/i\\\\\n\t\\\n\t\" | od\n\t$ echo \"/3/i\\\\\n        \" | od\n"},{"id":"230051","messageId":"1383484109-30838-1-git-send-email-bdwalton@gmail.com","threadId":"35220","inReplyTo":"xmqqeh72blpt.fsf@gitster.dls.corp.google.com","subject":"[PATCH] Change sed i\\ usage to something Solaris' sed can handle","fromName":"Ben Walton","fromEmail":"bdwalton@gmail.com","sentAt":"2013-11-03T13:08:29Z","receivedAt":"2013-11-03T13:08:29Z","isPatch":true,"sender":{"key":"bdwalton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/396061?v=4"},"body":"Solaris' sed was choking on the i\\ commands used in\nt4015-diff-whitespace as it couldn't parse the program properly.\nModify two uses of sed that worked in GNU sed but not Solaris'\n(/usr/bin or /usr/xpg4/bin) to an equivalent form that is handled\nproperly by both.\n\nSigned-off-by: Ben Walton <bdwalton@gmail.com>\n---\nThis addresses Andreas' comment about the extraneous \\<nl>.\nSorry, I misunderstood the original comment.\n\n t/t4015-diff-whitespace.sh | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh\nindex 3fb4b97..604a838 100755\n--- a/t/t4015-diff-whitespace.sh\n+++ b/t/t4015-diff-whitespace.sh\n@@ -145,7 +145,7 @@ test_expect_success 'another test, with --ignore-space-at-eol' 'test_cmp expect\n test_expect_success 'ignore-blank-lines: only new lines' '\n \ttest_seq 5 >x &&\n \tgit update-index x &&\n-\ttest_seq 5 | sed \"/3/i \\\\\n+\ttest_seq 5 | sed \"/3/i\\\\\n \" >x &&\n \tgit diff --ignore-blank-lines >out &&\n \t>expect &&\n@@ -155,7 +155,8 @@ test_expect_success 'ignore-blank-lines: only new lines' '\n test_expect_success 'ignore-blank-lines: only new lines with space' '\n \ttest_seq 5 >x &&\n \tgit update-index x &&\n-\ttest_seq 5 | sed \"/3/i \\ \" >x &&\n+\ttest_seq 5 | sed \"/3/i\\\\\n+ \" >x &&\n \tgit diff -w --ignore-blank-lines >out &&\n \t>expect &&\n \ttest_cmp out expect\n-- \n1.8.3.2\n"}]}