dog vdi read recognize offset and len as 0

Bug #1282850 reported by Yoshinori Matsuo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sheepdog
New
Undecided
Unassigned

Bug Description

I found this behavior.
dog vdi read recognize offset and len as 0 when I read with too large offset and len.
Are these behaviors in test 2 & 4 are intended?

I think the both should return some error.

TEST:
--------------------------------------------------------------------------------
#!/bin/bash

BIND_ADDR=192.168.245.162
MY_ADDR=192.168.245.162
echo "starting services"
service corosync start
sheep -p 7000 /var/lib/sheepdog0 --bindaddr ${BIND_ADDR} --myaddr ${MY_ADDR} > /dev/null 3>&1
sheep -p 7001 /var/lib/sheepdog1 --bindaddr ${BIND_ADDR} --myaddr ${MY_ADDR} > /dev/null 3>&1
sheep -p 7002 /var/lib/sheepdog2 --bindaddr ${BIND_ADDR} --myaddr ${MY_ADDR} > /dev/null 3>&1
echo "started services"
echo "formating"
# dog cluster format -a ${BIND_ADDR} # remove for safety
echo "formatted"
echo "------environments------"
sheep -v
corosync -v
uname -a
echo "node list"
dog node list -a ${BIND_ADDR}
echo "vdi list(no VDI)"
dog vdi list -a ${BIND_ADDR}
echo "create test VDI"
dog vdi create test 10M -a ${BIND_ADDR}
echo "vdi list"
dog vdi list -a ${BIND_ADDR}

echo "write VDI(abcde)"
echo "abcde" | dog vdi write -a ${BIND_ADDR} test

echo "------check its content------"
echo "read with valid offest and len"
dog vdi read -a ${BIND_ADDR} test 0 5
echo "" # just for new line

echo "------test 1------"
echo "read with larger offset than VDI size(OK)"
echo -n "result :"
dog vdi read -a ${BIND_ADDR} test 10000000000000000000 1 2>&1
echo "return code :"$?

echo "------test 2------"
echo "read with the offset that is larger than integer(?)."
echo "Result return head of the VDI.(The offset is recognized as 0?)"
echo -n "result :"
dog vdi read -a ${BIND_ADDR} test 100000000000000000000 1
echo "" # just for new line
dog vdi read -a ${BIND_ADDR} test 100000000000000000000 1 > /dev/null # for check return code
echo "return code :"$?

echo "------test 3------"
echo "read with the length that is larger than VDI size(may be OK)"
echo -n "result :"
dog vdi read -a ${BIND_ADDR} test 0 10000000000000000000
echo "return code :"$?

echo "------test 4------"
echo "read with the length that is lager than integer(?)."
echo "Result returns nothing.(The len is recognized as 0?)"
echo "result :"
dog vdi read -a ${BIND_ADDR} test 0 100000000000000000000
echo "return code :"$?

RESULT:
--------------------------------------------------------------------------------
starting services
Starting Corosync Cluster Engine (corosync): [ OK ]
started services
formating
using backend plain store
formatted
------environments------
Sheepdog daemon version 0.7.7
Corosync Cluster Engine, version '1.4.1'
Copyright (c) 2006-2009 Red Hat, Inc.
Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
node list
  Id Host:Port V-Nodes Zone
   0 192.168.245.162:7000 64 2734008512
   1 192.168.245.162:7001 64 2734008512
   2 192.168.245.162:7002 64 2734008512
vdi list(no VDI)
  Name Id Size Used Shared Creation time VDI id Copies Tag
create test VDI
vdi list
  Name Id Size Used Shared Creation time VDI id Copies Tag
  test 0 10 MB 0.0 MB 0.0 MB 2014-02-21 10:47 7c2b25 3
write VDI(abcde)
------check its content------
read with valid offest and len
abcde
------test 1------
read with larger offset than VDI size(OK)
result :Read offset is beyond the end of the VDI
return code :1
------test 2------
read with the offset that is larger than integer(?).
Result return head of the VDI.(The offset is recognized as 0?)
result :a
return code :0
------test 3------
read with the length that is larger than VDI size(may be OK)
result :abcde
return code :0
------test 4------
read with the length that is lager than integer(?).
Result returns nothing.(The len is recognized as 0?)
result : (no output)
return code :0

Revision history for this message
Yoshinori Matsuo (ml-yosinori) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.