onepub-dev / dcli

An extensive library and tooling for building console/cli applications and scripts using the Dart programming language.
242 stars 28 forks source link

FileSystemException when running compile --install from home directory #119

Closed relf108 closed 2 years ago

relf108 commented 3 years ago

Describe the bug FileSystemException when running compile --install from home directory. Looks like dcli picked up my path as the path to my wine vms. FileSystemException: Directory listing failed, path = '/home/tsutton/.wine/dosdevices/z:/proc/2514/task/109324/' (OS Error: No such file or directory, errno = 2) To Reproduce Setup wine device and run dcli compile --install in home directory. Logs ➜ ~ dcli compile --install findavcat.dart

Compiling findavcat.dart...

path: /home/tsutton/findavcat.dart Unhandled exception: FileSystemException: Directory listing failed, path = '/home/tsutton/.wine/dosdevices/z:/proc/2514/task/109324/' (OS Error: No such file or directory, errno = 2)

0 NamedLock.withLock. (package:dcli/src/util/named_lock.dart:129:9)

1 _rootRunBinary (dart:async/zone.dart:1222:13)

2 _RootZone.runBinary (dart:async/zone.dart:1456:12)

3 runZonedGuarded. (dart:async/zone.dart:1601:18)

4 _CustomZone.handleUncaughtError (dart:async/zone.dart:1076:19)

5 _CustomZone.runBinaryGuarded (dart:async/zone.dart:1015:7)

6 _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:376:15)

7 _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:394:16)

8 _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:294:7)

9 _SyncStreamControllerDispatch._sendError (dart:async/stream_controller.dart:812:19)

10 _StreamController._addError (dart:async/stream_controller.dart:690:7)

11 _StreamController.addError (dart:async/stream_controller.dart:642:5)

12 _AsyncDirectoryLister.error (dart:io/directory_impl.dart:443:18)

13 _AsyncDirectoryLister.next. (dart:io/directory_impl.dart:392:15)

14 _rootRunUnary (dart:async/zone.dart:1198:47)

15 _CustomZone.runUnary (dart:async/zone.dart:1100:19)

16 _FutureListener.handleValue (dart:async/future_impl.dart:143:18)

17 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)

18 Future._propagateToListeners (dart:async/future_impl.dart:725:32)

19 Future._completeWithValue (dart:async/future_impl.dart:529:5)

20 Future._asyncCompleteWithValue. (dart:async/future_impl.dart:567:7)

21 _rootRun (dart:async/zone.dart:1182:47)

22 _CustomZone.run (dart:async/zone.dart:1093:19)

23 _CustomZone.runGuarded (dart:async/zone.dart:997:7)

24 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23)

25 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)

26 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)

27 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)

28 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

29 _waitForEvent (dart:cli-patch/cli_patch.dart:8:64)

30 _WaitForUtils.waitForEvent (dart:cli/wait_for.dart:64:12)

31 waitFor (dart:cli/wait_for.dart:141:19)

32 waitForEx (package:dcli/src/util/wait_for_ex.dart:20:13)

33 Find._find (package:dcli/src/functions/find.dart:112:12)

34 find (package:dcli/src/functions/find.dart:92:17)

35 NamedLock._takeLock. (package:dcli/src/util/named_lock.dart:243:13)

36 NamedLock._withHardLock (package:dcli/src/util/named_lock.dart:357:11)

37 NamedLock._takeLock (package:dcli/src/util/named_lock.dart:236:7)

38 NamedLock.withLock. (package:dcli/src/util/named_lock.dart:108:38)

39 _rootRun (dart:async/zone.dart:1190:13)

40 _CustomZone.run (dart:async/zone.dart:1093:19)

41 _runZoned (dart:async/zone.dart:1630:10)

42 runZonedGuarded (dart:async/zone.dart:1618:12)

43 runZoned (dart:async/zone.dart:1547:12)

44 NamedLock.withLock (package:dcli/src/util/named_lock.dart:104:5)

45 DartProject.warmup (package:dcli/src/script/dart_project.dart:126:11)

46 CompileCommand.compileScript (package:dcli/src/script/commands/compile.dart:108:17)

47 CompileCommand.run (package:dcli/src/script/commands/compile.dart:65:20)

48 CommandLineRunner.process (package:dcli/src/script/command_line_runner.dart:86:26)

49 EntryPoint._parseCmdLine (package:dcli/src/script/entry_point.dart:40:38)

50 EntryPoint.process (package:dcli/src/script/entry_point.dart:34:12)

51 DCli.run (file:///home/tsutton/.pub-cache/hosted/pub.dartlang.org/dcli-0.34.1/bin/dcli.dart:11:33)

52 main (file:///home/tsutton/.pub-cache/hosted/pub.dartlang.org/dcli-0.34.1/bin/dcli.dart:6:10)

53 _startIsolate. (dart:isolate-patch/isolate_patch.dart:299:32)

54 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

Run dcli doctor: From the cli run dcli doctor

 dcli doctor
DCli version      0.34.1                                                 

OS                linux                                                  
OS Version        Linux 5.8.16-xanmod1 #0~git20201018.dc69f04 SMP PREEMPT Sun Oct 18 12:32:07 UTC 2020
Path separator    /                                                      

dart version      2.10.4                                                 

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    Not Passed                                             

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

$SHELL            /usr/bin/zsh                                           
Detected SHELL    zsh                                                    
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 
templates         rwxrwxr-x <user>:<user> /<HOME>/.dcli/templates 
bsutton commented 3 years ago

I believe this is caused by a process list directory.

As the find command process the directory files come and go very rapidly.

Find uses a two phase process, get the list of files/directories then process them. I think the bug is in the processing stage when the file is deleted between the two stages. I've put checks in the processing stage to ensure the file still exists.

More tests are required as its hard to reproduce.

bsutton commented 2 years ago

Closing this issue as no reports of a problems scine the change to the find command.