]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: avoid hexdump skip and length options 30502/head
authorIlya Dryomov <idryomov@gmail.com>
Fri, 20 Sep 2019 19:01:09 +0000 (21:01 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 20 Sep 2019 19:43:49 +0000 (21:43 +0200)
On Debian-based distros, hexdump(1) comes from FreeBSD in bsdmainutils
package (other distros ship a Linux version from util-linux).  It turns
out that '-s skip' for anything but a regular file has been broken for
ages in FreeBSD -- instead of calling fseek(), it consumed the input
byte by byte with getchar().  This was fixed in commit 7cd5ae492557
"hexdump(1): Speed up -s flag on devices" last year, but it hasn't made
it to the Debian world yet.

bsdmainutils_9.0.6ubuntu3 in xenial had a custom patch for that, but
it's no longer there in bsdmainutils_11.1.2ubuntu1 in bionic.  hexdump
-s <large offset> is now a fancy infinite loop!

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
qa/rbd/krbd_huge_image.t

index 1e58b483c633f7ee615617a0756859624110beba..9fff1d9d44ea21fc29399b98e456b393be863ad2 100644 (file)
@@ -24,18 +24,18 @@ Write to first and last sectors and make sure we hit the right objects:
 Dump first and last megabytes:
 
   $ DEV=$(sudo rbd map hugeimg/img)
-  $ hexdump -n 1048576 $DEV
+  $ dd if=$DEV bs=1M count=1 status=none | hexdump
   0000000 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
   *
   0000200 0000 0000 0000 0000 0000 0000 0000 0000
   *
   0100000
-  $ hexdump -s 4611686018426339328 $DEV
-  3ffffffffff00000 0000 0000 0000 0000 0000 0000 0000 0000
+  $ dd if=$DEV bs=1M skip=4398046511103 status=none | hexdump
+  0000000 0000 0000 0000 0000 0000 0000 0000 0000
   *
-  3ffffffffffffe00 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
+  00ffe00 cdcd cdcd cdcd cdcd cdcd cdcd cdcd cdcd
   *
-  4000000000000000
+  0100000
   $ sudo rbd unmap $DEV
 
   $ ceph osd pool delete hugeimg hugeimg --yes-i-really-really-mean-it >/dev/null 2>&1