For safety across different systems, avoid using "sed -i".
authorSteve McIntyre <steve@einval.com>
Fri, 15 Jun 2012 23:00:22 +0000 (23:00 +0000)
committerSteve McIntyre <steve@einval.com>
Fri, 15 Jun 2012 23:00:22 +0000 (23:00 +0000)
Closes issue 66.

abcde
changelog

diff --git a/abcde b/abcde
index 56b0a64..5c15c2c 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -2282,9 +2282,11 @@ do_cdtext ()
                TRACKM1=$(($TRACK - 1))
                TITLE="$(grep -E ^Track\ +$TRACK: "$ABCDETEMPDIR/cd-text" | tr -d \\r\\n | sed 's~^Track ..: .~~g;'"s~'$~~g")"
                echo "$TRACK: $TITLE" >> "$ABCDETEMPDIR/cddbchoices"
-               sed -i "s~^TTITLE${TRACKM1}=.*~TTITLE${TRACKM1}=${TITLE}~" "$ABCDETEMPDIR/cddbread.1"
+               sed "s~^TTITLE${TRACKM1}=.*~TTITLE${TRACKM1}=${TITLE}~" "$ABCDETEMPDIR/cddbread.1" > "$ABCDETEMPDIR/cddbread.new"
+        mv -f "$ABCDETEMPDIR/cddbread.new" "$ABCDETEMPDIR/cddbread.1"
        done
-       sed -i "s~^DTITLE=.*~DTITLE=${ATITLE}~" "$ABCDETEMPDIR/cddbread.1"
+       sed "s~^DTITLE=.*~DTITLE=${ATITLE}~" "$ABCDETEMPDIR/cddbread.1" > "$ABCDETEMPDIR/cddbread.new"
+    mv -f "$ABCDETEMPDIR/cddbread.new" "$ABCDETEMPDIR/cddbread.1"
        echo >> "$ABCDETEMPDIR/cddbchoices"
        echo "cdtext-readcomplete" >> "$ABCDETEMPDIR/status"
 }
index b1fb954..b7874e7 100644 (file)
--- a/changelog
+++ b/changelog
@@ -22,6 +22,8 @@ abcde 2.5.3 UNRELEASED
   * Change cddb-tool to use bash to make sure that echo -n works.
     Closes issue 67.
   * Fixes for lots of spelling mistakes from vskytta. Closes issue 68.
+  * For safety across different systems, avoid using "sed -i".
+    Closes issue 66.
 
  -- Steve McIntyre <93sam@debian.org>  Mon, 30 Apr 2012 16:59:14 +0100