mirror of
				https://github.com/qemu/qemu.git
				synced 2025-10-31 04:06:46 +00:00 
			
		
		
		
	 b7aa131519
			
		
	
	
		b7aa131519
		
	
	
	
	
		
			
			The result of openfile was not checked, leading to failure deep in the
actual command with confusing error message, and exiting with exit code 0.
Here is a simple example - trying to read with the wrong format:
    $ touch file
    $ qemu-io -f qcow2 -c 'read -P 1 0 1024' file; echo $?
    can't open device file: Image is not in qcow2 format
    no file open, try 'help open'
    0
With this patch, we fail earlier with exit code 1:
    $ ./qemu-io -f qcow2 -c 'read -P 1 0 1024' file; echo $?
    can't open device file: Image is not in qcow2 format
    1
Failing earlier, we don't log this error now:
    no file open, try 'help open'
But some tests expected it; the line was removed from the test output.
Signed-off-by: Nir Soffer <nirsof@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170201003120.23378-2-nirsof@gmail.com
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
		
	
			
		
			
				
	
	
		
			68 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| QA output created by 080
 | |
| 
 | |
| == Huge header size ==
 | |
| Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 | |
| can't open device TEST_DIR/t.qcow2: qcow2 header exceeds cluster size
 | |
| can't open device TEST_DIR/t.qcow2: qcow2 header exceeds cluster size
 | |
| 
 | |
| == Huge unknown header extension ==
 | |
| Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 | |
| can't open device TEST_DIR/t.qcow2: Invalid backing file offset
 | |
| can't open device TEST_DIR/t.qcow2: Header extension too large
 | |
| can't open device TEST_DIR/t.qcow2: Header extension too large
 | |
| 
 | |
| == Huge refcount table size ==
 | |
| Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 | |
| can't open device TEST_DIR/t.qcow2: Reference count table too large
 | |
| can't open device TEST_DIR/t.qcow2: Reference count table too large
 | |
| 
 | |
| == Misaligned refcount table ==
 | |
| Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 | |
| can't open device TEST_DIR/t.qcow2: Invalid reference count table offset
 | |
| 
 | |
| == Huge refcount offset ==
 | |
| Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 | |
| can't open device TEST_DIR/t.qcow2: Invalid reference count table offset
 | |
| 
 | |
| == Invalid snapshot table ==
 | |
| Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 | |
| can't open device TEST_DIR/t.qcow2: Too many snapshots
 | |
| can't open device TEST_DIR/t.qcow2: Too many snapshots
 | |
| can't open device TEST_DIR/t.qcow2: Invalid snapshot table offset
 | |
| can't open device TEST_DIR/t.qcow2: Invalid snapshot table offset
 | |
| 
 | |
| == Hitting snapshot table size limit ==
 | |
| Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 | |
| qemu-img: Could not create snapshot 'test': -27 (File too large)
 | |
| read 512/512 bytes at offset 0
 | |
| 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 | |
| 
 | |
| == Invalid L1 table ==
 | |
| Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 | |
| can't open device TEST_DIR/t.qcow2: Active L1 table too large
 | |
| can't open device TEST_DIR/t.qcow2: Active L1 table too large
 | |
| can't open device TEST_DIR/t.qcow2: Invalid L1 table offset
 | |
| can't open device TEST_DIR/t.qcow2: Invalid L1 table offset
 | |
| 
 | |
| == Invalid L1 table (with internal snapshot in the image) ==
 | |
| Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 | |
| qemu-img: Could not open 'TEST_DIR/t.IMGFMT': L1 table is too small
 | |
| 
 | |
| == Invalid backing file size ==
 | |
| Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 | |
| can't open device TEST_DIR/t.qcow2: Backing file name too long
 | |
| 
 | |
| == Invalid L2 entry (huge physical offset) ==
 | |
| Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 | |
| wrote 512/512 bytes at offset 0
 | |
| 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 | |
| qemu-img: Could not create snapshot 'test': -27 (File too large)
 | |
| qemu-img: Could not create snapshot 'test': -11 (Resource temporarily unavailable)
 | |
| 
 | |
| == Invalid snapshot L1 table ==
 | |
| Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 | |
| wrote 512/512 bytes at offset 0
 | |
| 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 | |
| qemu-img: Failed to load snapshot: Snapshot L1 table too large
 | |
| *** done
 |