Switch the printf over to %s because the input is actually hex (so %d
is wrong), but without the leading "0x" that %x would require.

For some reason the NODE assignment wasn't providing any input to awk
(hence the hang), and awk wasn't looking for the correct field anyway.

The tests still fail for me:

  losetup: /dev/block/loop0: No such device or address
  losetup: /dev/block/loop0: No such device or address
  losetup: file: No such file or directory
  losetup: needs 1 arg (see "losetup --help")

But at least now they allow the other tests to continue!
---
 tests/losetup.test | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
From 5a080166a2c801aa37bc9e908197637cefdee6a2 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Mon, 22 Jan 2018 14:04:24 -0800
Subject: [PATCH] Fix hang in losetup test.

Switch the printf over to %s because the input is actually hex (so %d
is wrong), but without the leading "0x" that %x would require.

For some reason the NODE assignment wasn't providing any input to awk
(hence the hang), and awk wasn't looking for the correct field anyway.

The tests still fail for me:

  losetup: /dev/block/loop0: No such device or address
  losetup: /dev/block/loop0: No such device or address
  losetup: file: No such file or directory
  losetup: needs 1 arg (see "losetup --help")

But at least now they allow the other tests to continue!
---
 tests/losetup.test | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/losetup.test b/tests/losetup.test
index 651c693..c929250 100755
--- a/tests/losetup.test
+++ b/tests/losetup.test
@@ -13,8 +13,8 @@ fi
 
 truncate -s 1M blah.img &&
 FILE="$(readlink -f blah.img)"
-DEV="$(printf '%04d' $(stat -t blah.img | awk '{print $7}'))"
-NODE="$(awk '{print $7}')"
+DEV="$(printf '%04s' $(stat -t blah.img | awk '{print $7}'))"
+NODE="$(stat -t blah.img | awk '{print $8}')"
 
 losetup -f 
 losetup -f -s
-- 
2.16.0.rc1.238.g530d649a79-goog

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to