On 04/30/2014 02:57 PM, [email protected] wrote:
> From: Shuang Qiu <[email protected]>
>
> It does not make sense to use stdout as the file description to test the
> system call fstatfs().We may get unexpected result(i.e.
> errno=38:Function not implemented) if redirect stdout when running ltp.
> Using ltp temporary file instead.
>
> Signed-off-by: Shuang Qiu <[email protected]>

The problem is that with the 2.6.39 series of kernels ENOSYS is returned 
where EFAULT is expected.

The reproducer:
#include <error.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/vfs.h>

int main(void)
{
   int fds[2];

   if (pipe(fds) < 0) {
     perror("pipe() failed");
     return 1;
   }

   if (fstatfs(fds[1], (void *)-1) < 0) {
     perror("fstatfs() failed");
     return 1;
   }

   return 0;
}

With 2.6.18, 2.6.32, 3.8.13 this reproducer returns EFAULT,
but with 2.6.39 - ENOSYS.

If we change '(void *)-1' to a vaild pointer, fstatfs() + 2.6.39 will 
succeed.

So it's a bug in 2.6.39, which is fixed in modern kernels.

 From one side, the above patch makes fstatfs02 pass by hiding an old 
(and already fixed) kernel bug.

But from the other side, it also enlarges the test scope by allowing to 
test different file systems.

So, personally, I would accept it.

Are there any thoughts about it?

Thanks.

------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to