Skip to content

Recursive Directory list causes dart to abort #43176

@bsutton

Description

@bsutton

I have the following code which I'm using to do a scan of the complete file system under linux.

It appears that when the recursive list iterates through /proc (or in that area) that an unexpeted st_mode (384) is returned and the dart aot aborts.

To reproduce the problem:

Save the following code to listing.dart

import 'dart:io';

void main(List<String> args) {
  var lister = Directory('/').list(recursive: true);
  lister.listen((entity) {
    print(entity.path);
  });
}

Compile the script:

dart2native listing.dart
Generated: /tmp/temp/listing.exe

Run the code using sudo

sudo ./listing.exe

....
/proc/slabinfo
/proc/softirqs
../../runtime/bin/directory_linux.cc: 204: error: Unexpected st_mode: 384

/proc/zoneinfo
/proc/buddyinfo
/proc/diskstats
/proc/key-users
....

System information:

dcli doctor
DCli version      0.21.0                                                 

OS                linux                                                  
OS Version        Linux 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020
Path separator    /                                                      

dart version      2.9.1                                                  

dcli path         /<HOME>/.pub-cache/bin/dcli                            
dart exe path     /usr/bin/dart                                          
dart path         /usr/bin/dart                                           which: /usr/bin/dart                                   
dart2Native path  /usr/lib/dart/bin/dart2native                           which: /usr/lib/dart/bin/dart2native                   

pub path          /usr/lib/dart/bin/pub                                   which: /usr/lib/dart/bin/pub                           
Pub cache         /<HOME>/.pub-cache                                     

Package Config    /tmp/temp/file:/<HOME>/git/dcli/.packages              

PATH
                  /usr/local/sbin                                        
                  /usr/local/bin                                         
                  /usr/sbin                                              
                  /usr/bin                                               
                  /sbin                                                  
                  /bin                                                   
                  /usr/games                                             
                  /usr/local/games                                       
                  /snap/bin                                              
                  /usr/lib/dart/bin                                      
                  /<HOME>/apps/flutter/bin                               
                  /<HOME>/.pub-cache/bin                                 
                  /<HOME>/.dcli/bin                                      

$SHELL            /bin/bash                                              
Detected SHELL    bash                                                   
Shell Start Scrip Not Found                                              

Dart location(s)
                  /usr/bin/dart                                          

Permissions
HOME              rwxr-xr-x <user>:<user> /<HOME> 
.dcli             rwxrwxr-x <user>:<user> /<HOME>/.dcli 
cache             rwxrwxr-x <user>:<user> /<HOME>/.dcli/cache 
dependencies.yaml rw-rw-r-- <user>:<user> /<HOME>/.dcli/dependencies.yaml 
templates         rwxrwxr-x <user>:<user> /<HOME>/.dcli/templates 

Metadata

Metadata

Assignees

Labels

area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-io

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions