{"thread":{"id":"32294","subject":"[PATCH 1/8] t9402: sed -i is not portable","startedAt":"2012-12-08T21:33:38Z","lastAt":"2012-12-08T21:33:38Z","messageCount":1,"participants":["Torsten Bögershausen"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"204609","messageId":"201212082233.39169.tboegi@web.de","threadId":"32294","inReplyTo":null,"subject":"[PATCH 1/8] t9402: sed -i is not portable","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2012-12-08T21:33:38Z","receivedAt":"2012-12-08T21:33:38Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On some systems sed allows the usage of e.g.\nsed -i -e \"s/line1/line2/\" afile\nto edit the file \"in place\".\nOther systems don't allow that: one observed behaviour is that\nsed -i -e \"s/line1/line2/\" afile\ncreates a backup file called afile-e, which breaks the test.\nAs sed -i is not part of POSIX, avoid it.\n\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\nChanges since v2:\nSplit up into many small commits\nThe fix of sed -i is the first and most important one\n\n\n t/t9402-git-cvsserver-refs.sh | 9 ++++++---\n 1 file changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t9402-git-cvsserver-refs.sh b/t/t9402-git-cvsserver-refs.sh\nindex 858ef0f..c01748a 100755\n--- a/t/t9402-git-cvsserver-refs.sh\n+++ b/t/t9402-git-cvsserver-refs.sh\n@@ -155,7 +155,8 @@ test_expect_success 'cvs co b1 [cvswork3]' '\n \n test_expect_success 'edit cvswork3 and save diff' '\n     ( cd cvswork3 &&\n-      sed -i -e \"s/line1/line1 - data/\" adir/afile &&\n+      sed -e \"s/line1/line1 - data/\" adir/afile >adir/afileNEW &&\n+\t\t\tmv -f adir/afileNEW adir/afile &&\n       echo \"afile5\" > adir/afile5 &&\n       rm t2 &&\n       cvs -f add adir/afile5 &&\n@@ -168,7 +169,8 @@ test_expect_success 'setup v1.2 on b1' '\n     git checkout b1 &&\n     echo \"new v1.2\" > t3 &&\n     rm t2 &&\n-    sed -i -e \"s/line3/line3 - more data/\" adir/afile &&\n+    sed -e \"s/line3/line3 - more data/\" adir/afile >adir/afileNEW &&\n+\t\tmv -f adir/afileNEW adir/afile &&\n     rm adir/a2file &&\n     echo \"a3file\" >> adir/a3file &&\n     echo \"bfile line 3\" >> adir/bdir/bfile &&\n@@ -300,7 +302,8 @@ test_expect_success 'root dir rm file [cvswork2]' '\n \n test_expect_success 'subdir edit/add/rm files [cvswork2' '\n     ( cd cvswork2 &&\n-      sed -i -e \"s/line 1/line 1 (v2)/\" adir/bdir/bfile &&\n+      sed -e \"s/line 1/line 1 (v2)/\" adir/bdir/bfile >adir/bdir/bfileNEW &&\n+      mv -f adir/bdir/bfileNEW adir/bdir/bfile &&\n       rm adir/bdir/b2file &&\n       cd adir &&\n       cvs -f rm bdir/b2file &&\n-- \n1.8.0.197.g5a90748\n"}]}