qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Bug 1739304] Re: Passing a directory to (eg.) -cdrom r


From: Michal Suchánek
Subject: Re: [Qemu-devel] [Bug 1739304] Re: Passing a directory to (eg.) -cdrom results in misleading error message
Date: Wed, 31 Jan 2018 19:36:13 +0100

On Wed, 20 Dec 2017 21:57:00 -0500
John Snow <address@hidden> wrote:

> On 12/20/2017 05:31 AM, Dr. David Alan Gilbert wrote:
> > Yep, can repeat it here, it seems pretty random which error it
> > gives:
> > 
> > address@hidden try]$ ./x86_64-softmmu/qemu-system-x86_64
> > -cdrom /tmp qemu-system-x86_64: -cdrom /tmp: Could not refresh
> > total sector count: Invalid argument address@hidden
> > try]$ ./x86_64-softmmu/qemu-system-x86_64 -cdrom /var
> > qemu-system-x86_64: -cdrom /var: Could not read image for
> > determining its format: File too large
> > 
> > 
> > ** Changed in: qemu
> >        Status: New => Confirmed
> >   
> 
> Looks like directories play funny games.
> 

...

> specifically:
> 
> (gdb) s
> 1963      size = lseek(s->fd, 0, SEEK_END);
> (gdb) s
> 1964      if (size < 0) {
> (gdb) print size
> $37 = 9223372036854775807
> 
> cool, cool, cool. This value is 0x7fffffffffffffff and errno isn't
> set. cool and good function.

Indeed: The behavior of lseek() on devices which are incapable of
seeking is implementation-defined.

> 
> so, lseek on a folder returns crazy nonsense. Perhaps we ought to
> actually specifically disallow folders, we don't appear to.

It probably returns -1 which it is supposed to do on error. It should
also set errno in that case, though.

So this is probably bug in the error handling code in lseek.

Thanks

Michal



reply via email to

[Prev in Thread] Current Thread [Next in Thread]