Skip to contentSkip to conversation

Fix tail option problem in test

PATCH In review A Large Angry SCM 2 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix tail option problem in test

The tail command on my system complains:

tail: cannot open `8192' for reading: No such file or directory

if there is any whitespace between the '-c' option and the byte count.

---

 t/t5302-pack-index.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
t/t5302-pack-index.sh +1 -1
index 232e5f1..b7870a8 100755
@@ -16,7 +16,7 @@ test_expect_success \
          test-genrandom "$i" 8192 >>file_$i &&
          git-update-index --add file_$i || return 1
      done &&
-     echo 101 >file_101 && tail -c 8192 file_100 >>file_101 &&
+     echo 101 >file_101 && tail -c8192 file_100 >>file_101 &&
      git-update-index --add file_101 &&
      tree=`git-write-tree` &&
      commit=`git-commit-tree $tree </dev/null` && {
#1 lore raw
Quoted 17 lines · A Large Angry SCM

The tail command on my system complains:

tail: cannot open `8192' for reading: No such file or directory

if there is any whitespace between the '-c' option and the byte count.

---

 t/t5302-pack-index.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
t/t5302-pack-index.sh +0 -0
index 232e5f1..b7870a8 100755

t/t5302-pack-index.sh test_expect_success \ · line 22

Quoted 8 lines
t/t5302-pack-index.sh +1 -1
@@ -16,7 +16,7 @@ test_expect_success \
          test-genrandom "$i" 8192 >>file_$i &&
          git-update-index --add file_$i || return 1
      done &&
-     echo 101 >file_101 && tail -c 8192 file_100 >>file_101 &&
+     echo 101 >file_101 && tail -c8192 file_100 >>file_101 &&
      git-update-index --add file_101 &&
      tree=`git-write-tree` &&
      commit=`git-commit-tree $tree </dev/null` && {

I do not like using tail to do a byte-oriented thing like this to begin with. How about using the plain old trustworthy and portable program, "dd", instead?

#2 lore raw
Quoted 23 lines · Junio C Hamano
Quoted 21 lines · A Large Angry SCM

The tail command on my system complains:

tail: cannot open `8192' for reading: No such file or directory

if there is any whitespace between the '-c' option and the byte count.

---

 t/t5302-pack-index.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
t/t5302-pack-index.sh +0 -1
index 232e5f1..b7870a8 100755
@@ -16,7 +16,7 @@ test_expect_success \
          test-genrandom "$i" 8192 >>file_$i &&
          git-update-index --add file_$i || return 1
      done &&
-     echo 101 >file_101 && tail -c 8192 file_100 >>file_101 &&
Quoted 8 lines

t/t5302-pack-index.sh test_expect_success \ · line 22

Quoted 4 lines
t/t5302-pack-index.sh +1 -0
+     echo 101 >file_101 && tail -c8192 file_100 >>file_101 &&
      git-update-index --add file_101 &&
      tree=`git-write-tree` &&
      commit=`git-commit-tree $tree </dev/null` && {

I do not like using tail to do a byte-oriented thing like this to begin with. How about using the plain old trustworthy and portable program, "dd", instead?

It's not as easy to get the last X bytes of a file with dd.

#3 lore raw
Quoted 1 line · A Large Angry SCM

It's not as easy to get the last X bytes of a file with dd.

Fair enough.