@@ -17,6 +17,7 @@ mod test_mount {
17
17
18
18
use libc:: { EACCES , EROFS } ;
19
19
20
+ use nix:: errno:: Errno ;
20
21
use nix:: mount:: { mount, umount, MsFlags , MS_BIND , MS_RDONLY , MS_NOEXEC } ;
21
22
use nix:: sched:: { unshare, CLONE_NEWNS , CLONE_NEWUSER } ;
22
23
use nix:: sys:: stat:: { self , S_IRWXU , S_IRWXG , S_IRWXO , S_IXUSR , S_IXGRP , S_IXOTH } ;
@@ -49,6 +50,23 @@ exit 23";
49
50
. write ( true )
50
51
. mode ( ( S_IRWXU | S_IRWXG | S_IRWXO ) . bits ( ) )
51
52
. open ( & test_path)
53
+ . or_else ( |e|
54
+ if Errno :: from_i32 ( e. raw_os_error ( ) . unwrap ( ) ) == Errno :: EOVERFLOW {
55
+ // Skip tests on certain Linux kernels which have a bug
56
+ // regarding tmpfs in namespaces.
57
+ // Ubuntu 14.04 and 16.04 are known to be affected; 16.10 is
58
+ // not. There is no legitimate reason for open(2) to return
59
+ // EOVERFLOW here.
60
+ // https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1659087
61
+ let stderr = io:: stderr ( ) ;
62
+ let mut handle = stderr. lock ( ) ;
63
+ writeln ! ( handle, "Buggy Linux kernel detected. Skipping test." )
64
+ . unwrap ( ) ;
65
+ process:: exit ( 0 ) ;
66
+ } else {
67
+ panic ! ( "open failed: {}" , e) ;
68
+ }
69
+ )
52
70
. and_then ( |mut f| f. write ( SCRIPT_CONTENTS ) )
53
71
. unwrap_or_else ( |e| panic ! ( "write failed: {}" , e) ) ;
54
72
0 commit comments